X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fgraph.c;h=cd7fbf361f80657a607c68e2fcddaf33917a198e;hp=6ec3724e8d6c59fa2a656cc4c28fb88d97a58790;hb=9d2bf718f233672c11a9740ed2a1539eaab1509b;hpb=72bdc05cb7e246e56ed21a25256d441c45fccca8 diff --git a/src/graph.c b/src/graph.c index 6ec3724e..cd7fbf36 100644 --- a/src/graph.c +++ b/src/graph.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: graph.c,v 1.1.2.28 2003/08/22 11:18:42 guus Exp $ + $Id: graph.c,v 1.1.2.30 2003/10/10 16:23:30 guus Exp $ */ /* We need to generate two trees from the graph: @@ -76,7 +76,7 @@ void mst_kruskal(void) /* Clear MST status on connections */ for(node = connection_tree->head; node; node = node->next) { - c = (connection_t *) node->data; + c = node->data; c->status.mst = false; } @@ -90,7 +90,7 @@ void mst_kruskal(void) /* Clear visited status on nodes */ for(node = node_tree->head; node; node = node->next) { - n = (node_t *) node->data; + n = node->data; n->status.visited = false; nodes++; } @@ -103,7 +103,7 @@ void mst_kruskal(void) for(skipped = false, node = edge_weight_tree->head; node; node = next) { next = node->next; - e = (edge_t *) node->data; + e = node->data; if(!e->reverse || e->from->status.visited == e->to->status.visited) { skipped = true; @@ -158,7 +158,7 @@ void sssp_bfs(void) /* Clear visited status on nodes */ for(node = node_tree->head; node; node = node->next) { - n = (node_t *) node->data; + n = node->data; n->status.visited = false; n->status.indirect = true; } @@ -178,22 +178,23 @@ void sssp_bfs(void) while(todo_tree->head) { for(from = todo_tree->head; from; from = next) { /* "from" is the node from which we start */ next = from->next; - n = (node_t *) from->data; + n = from->data; for(to = n->edge_tree->head; to; to = to->next) { /* "to" is the edge connected to "from" */ - e = (edge_t *) to->data; + e = to->data; if(!e->reverse) continue; /* Situation: - / - / - ------(n)-----(e->to) - \ - \ + / + / + ----->(n)---e-->(e->to) + \ + \ + Where e is an edge, (n) and (e->to) are nodes. n->address is set to the e->address of the edge left of n to n. We are currently examining the edge e right of n from n: @@ -245,7 +246,7 @@ void sssp_bfs(void) for(node = node_tree->head; node; node = next) { next = node->next; - n = (node_t *) node->data; + n = node->data; if(n->status.visited != n->status.reachable) { n->status.reachable = !n->status.reachable;