Used to loop over the arcs that exit a node. * * for example: * * void show(struct graph *graph, struct node node) { * printf("Showing node %" PRIu32 "\n", node.idx); * for (struct arc arc = node_adjacency_begin(graph, node); * !node_adjacency_end(arc); * arc = node_adjacency_next(graph, arc)) { * printf("arc id: %" PRIu32 ", (%" PRIu32 " -> %" PRIu32 ")\n", * ar
| 120 | * } |
| 121 | * */ |
| 122 | static inline struct arc node_adjacency_begin(const struct graph *graph, |
| 123 | const struct node node) |
| 124 | { |
| 125 | assert(node.idx < graph_max_num_nodes(graph)); |
| 126 | return graph->node_adjacency_first[node.idx]; |
| 127 | } |
| 128 | static inline bool node_adjacency_end(const struct arc arc) |
| 129 | { |
| 130 | return arc.idx == INVALID_INDEX; |