ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/outil/src/hypergraphlib_components.cpp
Revision: 102
Committed: Mon May 26 11:51:43 2008 UTC (16 years, 11 months ago) by francois
Original Path: magic/lib/outil/outil/src/HypergraphLib_Components.cpp
File size: 1241 byte(s)
Error occurred while calculating annotation data.
Log Message:
mise a jour linux des versions lib

File Contents

# Content
1 #ifdef WINDOWS_VERSION
2 #include "HypergraphLib_platform.h"
3
4 #include "HypergraphLib_Components.h"
5 #include "HypergraphLib_dfs.h"
6 #include "HypergraphLib_Graph.h"
7 #include "HypergraphLib_Node.h"
8
9 /**
10 * Find the strongly connected components of a graph
11 // http://en.wikipedia.org/wiki/Strongly_connected_component
12
13
14 STRONGLY-CONNECTED COMPONENTS (G)
15 1 call DFS(G) to compute finishing times f[u] for each vertex u
16 2 compute GT
17 3 call DFS(GT), but in the main loop of DFS, consider the vertices in order of decreasing f[u]
18 4 produce as output the vertices of each tree in the DFS forest formed in point 3 as a separate SCC.
19
20 */
21 namespace HypergraphLib {
22
23 void FindSCC(Graph * __G, std::set < std::set < Node * > > & __components)
24 {
25 std::map < int, Node * > unvisitedNodes = __G->GetNodes();
26
27 while (unvisitedNodes.size())
28 {
29 std::set < Node * > depthFirstSearchNodes;
30 dfs((unvisitedNodes.begin())->second, depthFirstSearchNodes);
31 __components.insert ( depthFirstSearchNodes );
32 for ( std::set < Node * >::const_iterator it = depthFirstSearchNodes.begin();
33 it != depthFirstSearchNodes.end();
34 it++)
35 unvisitedNodes.erase((*it)->Id());
36 }
37 }
38
39 }
40 #endif
41