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
In reply to Re: Re: H of A optimization
by Zaxo
in thread H of A optimization
by abitkin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |