Home Tutorials Forums Articles Blogs Movies Library Employment Press
Prev Previous Post   Next Post Next
Old 06-07-2006, 05:02 PM   #11
Joeri Sebrechts
Join Date: Apr 2005
Location: Antwerp, Belgium
Posts: 1,465

Well, I've been looking at it, and the sort of algorithm you really need is way too complicated to explain on this site. And I don't really feel like relearning all that stuff, since it would take me days to get up to speed enough to be able to design new graphing algorithms. Seriously, if you want to do this right, get the book I recommended, and read through the flow and orthogonal drawings section (with your math books open on your lap).

However, if you observe a few simple limitations, this can be done without too much effort. Suppose for example that you were to say that your graph looks like a tree, with a tree root node, and two children per node. So, for example A is the root node, and points to B and C, B points to D, and C points to E and F. That is a tree without cycles, without merging of separate paths, and with at most two children per node. This is easy to layout:
- place the root node at the top left
- place the first child of the root node to the right of the root node, and the second child to the bottom
- with each child node, repeat the process, place one child to the right of it, one child to the bottom
- in some cases this will cause nodes from two branches to overlap, so for each node you place, check that it doesn't overlap any previously placed nodes, and if so, move the right-most branch to the right until there is no more overlap

The result of this is an orthogonal tree that runs mostly horizontally, with vertical split-offs for the branches.

Now, what you really need is a minimum cost orthogonal network flow layout algorithm. There is source code for one here, but it may be difficult to figure out, and the author admits that it doesn't always work correctly and is slow (common for graph layout algorithms, since this is a problem of complexity class NP, meaning you can do it right, or you can do it in reasonable time, but not both).

Or maybe someone else can suggest a quick fix.
jsebrech is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Optimizing Flash Web Sites for Search Engines rockcoastmedia General Chat 19 03-29-2009 09:31 PM
scrollBar on Flash Exchange cdeg Components 5 05-03-2004 07:13 PM
cant get dynamic txt to link other txtfiles, to display in flash ! munkeydude ActionScript 1.0 (and below) 7 04-18-2004 03:06 PM
Building a Dynamic Weather Maps Flash MX Demo DTNFlashman ActionScript 1.0 (and below) 0 08-22-2003 10:19 AM

All times are GMT. The time now is 02:03 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.