Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: H of A optimization

by Zaxo (Archbishop)
on Aug 30, 2002 at 23:39 UTC ( #194276=note: print w/replies, xml ) Need Help??


in reply to Re: H of A optimization
in thread H of A optimization

Ok, dpuu suggested Graph, which I recommend. This does it:

#!/usr/bin/perl -w use strict; use Graph::Undirected; my $net = Graph::Undirected->new; while (<DATA>) { $net = $net->add_edge( split ); } use Data::Dumper; print Dumper($net); __END__ 0 1 1 2 1 3 1 4 2 4 4 5

Graph.pm takes care of circular references for you.

After Compline,
Zaxo

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://194276]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2020-07-07 12:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?