I desire to calculate the shortest path from L1 to L4 (In the simple example).
Now I found these wonderful looking graph function, but I'm obviously missing something.
-------------------------------
sample code
use warnings;
use strict;
use Graph::Weighted;
my $g = Graph::Weighted->new(
data ="" {
weight => {
L1 => { L2 => 9, L3 => 6, L4 => 8, L5 => 3, L6 => 2, L7 => 1 },
L2 => { L1 => 9 },
L3 => { L1 => 6, L8 => 4 },
L4 => { L1 => 8, L5 => 5, L8 => 4, L99=> 2 },
L5 => { L1 => 3, L4 => 5, L99=>2 },
L6 => { L1 => 2 },
L7 => { L1 => 1 },
L8 => { L3 => 4, L4 => 4 },
L99=> { L4 => 2, L5 => 2 }
}
}
);
print "The graph: $g\n\n";
my $SSSP = $g->SSSP_Dijkstra("L1");
print "By Dijkstra SSSP - ","$SSSP","\n";
----- result:
The graph: L1-L2,L1-L3,L1-L4,L1-L5,L1-L6,L1-L7,L2-L1,L3-L1,L3-L8,L4-L1,L4-L5,L4-
L8,L4-L99,L5-L1,L5-L4,L5-L99,L6-L1,L7-L1,L8-L3,L8-L4,L99-L4,L99-L5
By Dijkstra SSSP - L1,L2,L3,L4,L5,L6,L7,L8,L99
------------------------
The graph has the defined edges and vertexes I desire.
But I though SSSP would calculate all short paths from the specified vertex.
ie:
L1 -> L1
L1 -> L2
L1 -> L3
L1 -> L5 - L99 - L4
L1 -> L5
L1 -> L6
L1 -> L7
L1 -> L3 - L8
L1 -> L5 - L99
Any suggestions would be greatly appreciated.
Basil
_______________________________________________ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
