graph editor

Started by
4 comments, last by acid2 18 years ago
What kind of data structure would be good for a program like this: http://www.unrealtechnology.com/screens/MaterialEditor.jpg Thanks.
Advertisement
That program will consist of several data structures. Although for the pain graph part, you probably want a tree.
The graph looks like a modified tree structure to me. Apple has a similar material compositor in the Quartz Composer if you are looking for more implementations of such.
just a quick note. if you're using vs 2005 you might want to obtain the (free) DSL (domain specific language) tools. That way you could build something like that rather easily as a custom design in visual studio and have code generated from the diagram just like the epic tool does. no need to draw and lay out these things yourself (if you have vs, that is). i don't know if the dsl tools work with the express editions but i suppose so.

cheers,
simon
I'm not sure what your after here, but that is called a directed acyclic graph (DAG). A tree is a special case DAG where each node is allowed only one child. A node in a tree can be implemented by maintaining one link to the parent and a variable number of links to children. A general DAG node can be implemented the same way, simply allow multiple parent links. This won't ensure that the graph does not have cycles of course, you'll have to do that some other way. This is a little more tricky than with a tree (new connections between two nodes already in the graph may be allowed in some cases).

See google for details: directed acyclic graph
Quote:Original post by Solias
I'm not sure what your after here, but that is called a directed acyclic graph (DAG). A tree is a special case DAG where each node is allowed only one child. A node in a tree can be implemented by maintaining one link to the parent and a variable number of links to children. A general DAG node can be implemented the same way, simply allow multiple parent links. This won't ensure that the graph does not have cycles of course, you'll have to do that some other way. This is a little more tricky than with a tree (new connections between two nodes already in the graph may be allowed in some cases).

See google for details: directed acyclic graph


That's not quite right. A tree may have more than one child node, but each node can only have one parent. You seem to say this in your following sentance, but seeing as you jumped between 2 different definitions I thought I'd clear that up. The diagram above looks more like a restricted dag; each link has a context of what it can link to (what siblings it may have) therefore theoretically elimiated cycles. DAG's can be pretty unwieldly, so I suggest you steer clear of them until you get confident with trees.
Ollie"It is better to ask some of the questions than to know all the answers." ~ James Thurber[ mdxinfo | An iridescent tentacle | Game design patterns ]

This topic is closed to new replies.

Advertisement