Edit: dammit, I *just* saw that you can't install CPAN modules. Still, Graph.pm has no dependencies, so maybe there's a chance?

I've been there. What you need is a real directed graph structure. I'm not sure how it will handle a 120k edge graph, but I've put a sizeable subset of the CPAN dependency graph (our entire org's module dep graph, actually -- including the high level modules, web apps, etc. so DBIC and other heavyweight stuff) in a Graph.pm object.

It makes for extremely readable code too. Below is an example (not guaranteed to run, I don't have Perl on this machine):

use Graph::Directed; my $graph = Graph::Directed->new; # Building the graph. In this example, edges are directed from a job +to a dependency. while (my $line = $file->getline) { my ($job, @deps) = split(/,/, $line); foreach my $dep (@deps) { # adds both $job and $dep as nodes in the graph if they don't +exist already $graph->add_edge($job, $dep); } } # What does job FOO require? say "FOO requires $_" foreach $graph->all_successors('FOO'); # Who requires FOO? say "FOO is required by $_" foreach $graph->all_predecessors('FOO'); # Jobs that do not have prerequisites. say "$_ can be executed right now!" foreach $graph->sink_vertices; # Somebody messed up here: say "A job requires itself!" if $graph->has_a_cycle;

It's really comfortable, and reading the POD for Graph.pm might give you lots of ideas of cool stuff to do with your dependency graph :)


In reply to Re: Multi level dependency structure by pokki
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.