| 2189 | } |
| 2190 | |
| 2191 | static int |
| 2192 | graph_add_indices(int *indices, int n, struct owner_vertex_list *set) |
| 2193 | { |
| 2194 | struct owner_vertex *v; |
| 2195 | int i, j; |
| 2196 | |
| 2197 | TAILQ_FOREACH(v, set, v_link) { |
| 2198 | for (i = n; |
| 2199 | i > 0 && indices[i - 1] > v->v_order; i--) |
| 2200 | ; |
| 2201 | for (j = n - 1; j >= i; j--) |
| 2202 | indices[j + 1] = indices[j]; |
| 2203 | indices[i] = v->v_order; |
| 2204 | n++; |
| 2205 | } |
| 2206 | |
| 2207 | return (n); |
| 2208 | } |
| 2209 | |
| 2210 | static int |
| 2211 | graph_assign_indices(struct owner_graph *g, int *indices, int nextunused, |