pokki, absolutely brilliant! ++ I needed to see this work myself and had Graph::Easy but couldn't duplicate. The CPAN install for Graph::Directed was easy (Win7 x64 / Strawberry 5.18.1) and I whipped this up based on your example:

#!perl use strict; use warnings; use Graph::Directed; my $graph = Graph::Directed->new; while ( my $line = <DATA> ) { chomp $line; my ( $job, @deps ) = split( /,/, $line ); for my $dep (@deps) { $graph->add_edge( $job, $dep ); } } for my $job ( sort ( $graph->vertices ) ) { print "$job requires "; for ( sort ( $graph->all_successors($job) ) ) { print "$_ "; } print "\n"; } __DATA__ job1, job2,job1, job3,job2 job4,job2 job5,job2,job4 job6,jobz joba,job4,jobb jobz,jobbc,job2

and outputs

job1 requires job2 requires job1 job3 requires job1 job2 job4 requires job1 job2 job5 requires job1 job2 job4 job6 requires job1 job2 jobbc jobz joba requires job1 job2 job4 jobb jobb requires jobbc requires jobz requires job1 job2 jobbc

In reply to Re^2: Multi level dependency structure by VinsWorldcom
in thread Multi level dependency structure by MH1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.