| 2208 | } |
| 2209 | |
| 2210 | static int |
| 2211 | graph_assign_indices(struct owner_graph *g, int *indices, int nextunused, |
| 2212 | struct owner_vertex_list *set) |
| 2213 | { |
| 2214 | struct owner_vertex *v, *vlowest; |
| 2215 | |
| 2216 | while (!TAILQ_EMPTY(set)) { |
| 2217 | vlowest = NULL; |
| 2218 | TAILQ_FOREACH(v, set, v_link) { |
| 2219 | if (!vlowest || v->v_order < vlowest->v_order) |
| 2220 | vlowest = v; |
| 2221 | } |
| 2222 | TAILQ_REMOVE(set, vlowest, v_link); |
| 2223 | vlowest->v_order = indices[nextunused]; |
| 2224 | g->g_vertices[vlowest->v_order] = vlowest; |
| 2225 | nextunused++; |
| 2226 | } |
| 2227 | |
| 2228 | return (nextunused); |
| 2229 | } |
| 2230 | |
| 2231 | static int |
| 2232 | graph_add_edge(struct owner_graph *g, struct owner_vertex *x, |