# HG changeset patch # User marci # Date 1083851088 0 # Node ID 405ccc3105e1949485ed2d71e48b0bc142ced512 # Parent fb261e3a9a0faffb06eb33cfa6a7636a5da57401 diff -r fb261e3a9a0f -r 405ccc3105e1 src/work/marci/bipartite_graphs.h --- a/src/work/marci/bipartite_graphs.h Thu May 06 13:21:24 2004 +0000 +++ b/src/work/marci/bipartite_graphs.h Thu May 06 13:44:48 2004 +0000 @@ -35,5 +35,26 @@ } return true; } + + /// experimental topsort, + /// I think the final version will work as an iterator + template + void topSort(Graph& g, std::list& l) { + l.clear(); + typedef typename Graph::template NodeMap ReachedMap; + ReachedMap reached(g/*, false*/); + DfsIterator dfs(g, reached); + FOR_EACH_LOC(typename Graph::NodeIt, n, g) { + if (!reached[n]) { + dfs.pushAndSetReached(n); + while (!bfs.finished()) { + if (bfs.isANodeExamined()) { + l.push_back(bfs.aNode()); + } + ++bfs; + } + } + } + } } #endif //HUGO_BIPARTITE_GRAPHS_H diff -r fb261e3a9a0f -r 405ccc3105e1 src/work/marci/makefile --- a/src/work/marci/makefile Thu May 06 13:21:24 2004 +0000 +++ b/src/work/marci/makefile Thu May 06 13:44:48 2004 +0000 @@ -1,7 +1,7 @@ CXX2 = g++-2.95 CXX3=$(CXX) BOOSTROOT ?= /home/marci/boost -INCLUDEDIRS ?= -I../../include -I.. -I../{marci,jacint,alpar,klao,akos,athos} -I$(BOOSTROOT) +INCLUDEDIRS ?= -I../../hugo -I.. -I../{marci,jacint,alpar,klao,akos,athos} -I$(BOOSTROOT) LEDABINARIES = leda_graph_demo leda_bfs_dfs max_bipartite_matching_demo BINARIES = max_flow_demo iterator_bfs_demo macro_test lg_vs_sg bfsit_vs_byhand bipartite_graph_wrapper_test bipartite_matching_try bipartite_matching_try_2 bipartite_matching_try_3