]>
wirehaze git hosting - graph-theory.git/blob - graph/adj.h
4 /* adjacency list implementation */
10 struct edge
*adj
; /* edges linked list */
13 struct edge
/* probably not a good name for this */
15 struct vertex
*to
; /* other vertex in edge */
21 struct vertex
*v
; /* array of vertices */
22 unsigned int nv
; /* number of vertices */
25 struct graph
*new_graph (unsigned int nv
);
26 void free_graph (struct graph
*g
);
28 int add_arc (struct graph
*g
, unsigned int vi
, unsigned int vj
);
29 void del_arc (struct graph
*g
, unsigned int vi
, unsigned int vj
);
31 int add_edge (struct graph
*g
, unsigned int vi
, unsigned int vj
);
32 void del_edge (struct graph
*g
, unsigned int vi
, unsigned int vj
);
34 static __inline__
unsigned int
35 vertex_id (struct graph
*g
, struct vertex
*v
)
37 return (unsigned int)(v
- g
->v
);