The structure you are describing does not fit into a tree. As you can see, 'b', 'c', and 'd' have two parents each, thus clashing with the definition of a tree, where each node can only have one parent.
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.
See S.M. Burke's article on trees for more theoretical stuff.
_ _ _ _
(_|| | |(_|><
_|
| [reply] [d/l] [select] |