# this hash represents a directed graph with vertices {A,B,C,D,E} and # these edges: # A -> B (weight = 3) # B -> D (weight = 1) # B -> C (weight = 1) # D -> E (weight = 1) my $hash= { 'A' => { 'B' => 3 }, 'B' => { 'D' => 1, 'C' => 1 }, 'C' => undef, 'D' => { 'E' => 1 }, 'E' => undef }; my $graph = Bio::Coordinate::Graph->new(-graph => $hash); my @node_names = shortest_path( 'A', 'E' ); # node_names now contains a list of the vertex names that make up the # shortest path (A,B,D,E)