1 |
//####//------------------------------------------------------------ |
2 |
//####//------------------------------------------------------------ |
3 |
//####// MAGiC |
4 |
//####// Jean Christophe Cuilliere et Vincent FRANCOIS |
5 |
//####// Departement de Genie Mecanique - UQTR |
6 |
//####//------------------------------------------------------------ |
7 |
//####// MAGIC est un projet de recherche de l equipe ERICCA |
8 |
//####// du departement de genie mecanique de l Universite du Quebec a Trois Rivieres |
9 |
//####// http://www.uqtr.ca/ericca |
10 |
//####// http://www.uqtr.ca/ |
11 |
//####//------------------------------------------------------------ |
12 |
//####//------------------------------------------------------------ |
13 |
//####// |
14 |
//####// hypergraphlib_dfs.cpp |
15 |
//####// |
16 |
//####//------------------------------------------------------------ |
17 |
//####//------------------------------------------------------------ |
18 |
//####// COPYRIGHT 2000-2024 |
19 |
//####// jeu 13 jun 2024 11:53:59 EDT |
20 |
//####//------------------------------------------------------------ |
21 |
//####//------------------------------------------------------------ |
22 |
#include "hypergraphlib_platform.h" |
23 |
|
24 |
#include "hypergraphlib_dfs.h" |
25 |
#include "hypergraphlib_node.h" |
26 |
#include "hypergraphlib_graph.h" |
27 |
|
28 |
using namespace HypergraphLib; |
29 |
|
30 |
HYPERGRAPHLIB_ITEM void |
31 |
HypergraphLib::dfs(Node *__n, std::set < Node * > & __depthFirstSearchNodes) |
32 |
{ |
33 |
std::set < Node * > adj; |
34 |
__n->AdjacentNodes( adj ); |
35 |
__depthFirstSearchNodes.insert (__n); |
36 |
for ( std::set < Node * >::const_iterator it = adj.begin(); |
37 |
it != adj.end() ; |
38 |
it++) |
39 |
if ( __depthFirstSearchNodes.find(*it) == __depthFirstSearchNodes.end()) |
40 |
HypergraphLib::dfs (*it, __depthFirstSearchNodes); |
41 |
} |
42 |
|