Directed Acyclical Graph Traversal... help?

Viewed 8795

a little out of my depth here and need to phone a friend. I've got a directed acyclical graph I need to traverse and I'm stumbling into to graph theory for the first time. I've been reading a lot about it lately but unfortunately I don't have time to figure this out academically. Can someone give me a kick with some help as to how to process this tree?

Here are the rules:

  • there are n root nodes (I call them "sources")
  • there are n end nodes
  • source nodes carry a numeric value
  • downstream nodes (I call them "worker" nodes) preform various operations on the incoming values like Add, Mult, etc.

As you can see from the graph below, nodes a, b, and c need to be processed before d, e, or f.

What's the proper order to walk this tree?

enter image description here

2 Answers
Related