]> git.meshlink.io Git - meshlink/commitdiff
When building the minimum spanning tree, make sure we start from a reachable node.
authorGuus Sliepen <guus@tinc-vpn.org>
Tue, 12 Dec 2006 14:49:09 +0000 (14:49 +0000)
committerGuus Sliepen <guus@tinc-vpn.org>
Tue, 12 Dec 2006 14:49:09 +0000 (14:49 +0000)
src/graph.c

index eadb36a7c9d8f6c9f40684943b4ecdbda68d30d5..9dd3fa5df7e94537ed80a94fdebf672f9784f53c 100644 (file)
@@ -101,7 +101,13 @@ void mst_kruskal(void)
 
        /* Starting point */
 
-       ((edge_t *) edge_weight_tree->head->data)->from->status.visited = true;
+       for(node = edge_weight_tree->head; node; node = next) {
+               e = node->data;
+               if(e->from->status.reachable) {
+                       e->from->status.visited = true;
+                       break;
+               }
+       }
 
        /* Add safe edges */
 
@@ -307,8 +313,8 @@ void sssp_bfs(void)
 
 void graph(void)
 {
-       mst_kruskal();
        sssp_bfs();
+       mst_kruskal();
        graph_changed = true;
 }