Exemple #1
0
//'order_buf': record the bfs-order for each vertex.
void DGRAPH::sort_in_bfs_order(SVECTOR<UINT> & order_buf, GRAPH & domtree,
							   VERTEX * root)
{		
	LIST<VERTEX*> worklst;
	worklst.append_tail(root);
	UINT order = 1;
	while (worklst.get_elem_count() > 0) {
		VERTEX * sv = worklst.remove_head();
		order_buf.set(VERTEX_id(sv), order);
		order++;
		EDGE_C * el = VERTEX_out_list(sv);
		while (el != NULL) {
			VERTEX * to = EDGE_to(EC_edge(el));
			worklst.append_tail(to);
			el = EC_next(el);
		}
	}
}