5 #include <ccan/container_of/container_of.h>
6 #include <ccan/ptrint/ptrint.h>
8 #include <ccan/aga/aga.h>
10 #include "simple-graph.h"
12 static ptrint_t *negacycle_first_edge(const struct aga_graph *g,
13 const struct aga_node *n)
18 static ptrint_t *negacycle_next_edge(const struct aga_graph *g,
19 const struct aga_node *n,
22 assert(ptr2int(e) == 1);
26 static int negacycle_edge_info(const struct aga_graph *g,
27 const struct aga_node *n,
28 ptrint_t *e, struct aga_edge_info *ei)
30 struct negacycle_graph *ng = container_of(g, struct negacycle_graph,
32 int ni = n - ng->sg.nodes;
34 assert(ptr2int(e) == 1);
35 ei->to = &ng->sg.nodes[(ni % 3) + 1];
41 void negacycle_graph_init(struct negacycle_graph *ng)
43 simple_graph_init(&ng->sg, negacycle_first_edge,