chiark / gitweb /
Do not include self-edges in routes
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Mon, 31 Aug 2009 23:42:14 +0000 (00:42 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Mon, 31 Aug 2009 23:42:14 +0000 (00:42 +0100)
yarrg/yppedia-chart-parser

index 228d1e2c4fae0f47cd058df5f1cbad73d5378a8c..54a0e4577604592c6e365a1de0be7159c8446e08 100755 (executable)
@@ -423,7 +423,8 @@ sub shortest_path_reduction ($$) {
 
     1. F is an undirected weighted graph with positive edge weights.
 
-    2. All graphs we will consider have the same vertices as F.
+    2. All graphs we will consider have the same vertices as F
+       and none have self-edges.
 
     3. G = Closure(F) is the graph of cliques whose edge weights
        are the shortest paths in F, one clique for each connected
@@ -480,6 +481,7 @@ END
 
     my $result= Graph::Undirected->new();
     foreach my $edge_ac ($g->edges()) {
+        next if $edge_ac->[0] eq $edge_ac->[1];
        my $edgename_ac= join ' .. ', @$edge_ac;
        printf DEBUG "spr %s edge %s\n", $what, $edgename_ac;
        my $w_ac= $g->get_edge_weight(@$edge_ac);