6 #include <ccan/container_of/container_of.h>
8 #include <ccan/aga/aga.h>
10 #include "simple-graph.h"
12 struct aga_node *full_first_edge(const struct aga_graph *g,
13 const struct aga_node *node)
15 struct full_graph *fg = container_of(g, struct full_graph, sg.g);
17 return &fg->sg.nodes[1];
20 struct aga_node *full_next_edge(const struct aga_graph *g,
21 const struct aga_node *node,
22 struct aga_node *edge)
24 struct full_graph *fg = container_of(g, struct full_graph, sg.g);
25 int index = (edge - fg->sg.nodes);
27 if (index < fg->nnodes)
28 return &fg->sg.nodes[index + 1];
33 static int full_edge_info(const struct aga_graph *g,
34 const struct aga_node *node,
35 struct aga_node *edge,
36 struct aga_edge_info *ei)
42 void full_graph_init(struct full_graph *fg, int nnodes)
44 assert(nnodes < MAX_NODES);
47 simple_graph_init(&fg->sg, full_first_edge, full_next_edge,