in reply to Creating a Dependency Tree Using the Tree::DAG_Node Module and Postorder Transversal
my %rules = ( a => [ 'b', 'c' ], b => [ 'c', 'd' ], c => [ 'd' ], e => [ 'b', 'a' ], f => undef, );
dependency
/ \
f e
| \
| a
| / \
b -- c
| \
+----- d
You can simplify the structure, on the grounds that, since 'a' depends on 'b' and 'e' depends on 'a' as well, then you may assume that 'e' depends implicitly on 'b'. The same line of reasoning solves the problem for 'd' and 'c'. This structure is indeed representable by a Tree::Dag_Node object, even though it looks more like a linked list than a tree. my %rules = ( a => [ 'b' ], b => [ 'c' ], c => [ 'd' ], e => [ 'a' ], f => undef, );
dependency
/ \
f e
\
a
/
b
\
c
\
d
However, if you remove 'a' from e's list and put there only 'b', then you fall back onto forbidden ground, where a node has more than one parent.my %rules = ( a => [ 'b' ], b => [ 'c' ], c => [ 'd' ], e => [ 'b' ], f => undef, );
dependency
/ \ \
f e a
\ / \
b c
\
d
While you can solve this dependency problem in a Makefile, you can't successfully describe it as a Directed Acyclic Graph Tree._ _ _ _ (_|| | |(_|>< _|
|
|---|