static void mst_kruskal(void) {
/* Clear MST status on connections */
- for list_each(connection_t, c, connection_list) {
+ for list_each(connection_t, c, &connection_list) {
c->status.mst = false;
}
/* Clear visited status on nodes */
- for splay_each(node_t, n, node_tree) {
+ for splay_each(node_t, n, &node_tree) {
n->status.visited = false;
}
/* Starting point */
- for splay_each(edge_t, e, edge_weight_tree) {
+ for splay_each(edge_t, e, &edge_weight_tree) {
if(e->from->status.reachable) {
e->from->status.visited = true;
break;
bool skipped = false;
- for splay_each(edge_t, e, edge_weight_tree) {
+ for splay_each(edge_t, e, &edge_weight_tree) {
if(!e->reverse || (e->from->status.visited == e->to->status.visited)) {
skipped = true;
continue;
if(skipped) {
skipped = false;
- next = edge_weight_tree->head;
+ next = edge_weight_tree.head;
}
}
}
/* Clear visited status on nodes */
- for splay_each(node_t, n, node_tree) {
+ for splay_each(node_t, n, &node_tree) {
n->status.visited = false;
n->status.indirect = true;
n->distance = -1;
abort();
}
- for splay_each(edge_t, e, n->edge_tree) { /* "e" is the edge connected to "from" */
+ for splay_each(edge_t, e, &n->edge_tree) { /* "e" is the edge connected to "from" */
if(!e->reverse || e->to == myself) {
continue;
}
int became_reachable_count = 0;
int became_unreachable_count = 0;
- for splay_each(node_t, n, node_tree) {
+ for splay_each(node_t, n, &node_tree) {
if(n->status.visited != n->status.reachable) {
n->status.reachable = !n->status.reachable;
n->last_state_change = now.tv_sec;
}
void graph(void) {
- subnet_cache_flush();
+ subnet_cache_flush_tables();
sssp_bfs();
check_reachability();
mst_kruskal();