MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
hypergraphlib_graph.h
Aller à la documentation de ce fichier.
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_graph.h
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2024
19 //####// jeu 13 jun 2024 11:54:00 EDT
20 //####//------------------------------------------------------------
21 //####//------------------------------------------------------------
22 #ifndef GRAPHH
23 #define GRAPHH
24 
25 #include <map>
26 #include <set>
27 #include <vector>
28 
30 
31 #define GRAPH_FOR_EACH_ARC_CONST(G,A) \
32  for (HypergraphLib::Graph::MapArcsById::const_iterator A = G->GetArcs().begin(); \
33  A != G->GetArcs().end(); \
34  A++)
35 
36 #define GRAPH_FOR_EACH_ARC(G,A) \
37  for (HypergraphLib::Graph::MapArcsById::iterator A = G->GetArcs().begin(); \
38  A != G->GetArcs().end(); \
39  A++)
40 
41 #define GRAPH_FOR_EACH_NODE_CONST(G,N) \
42  for (HypergraphLib::Graph::MapNodesById::const_iterator N = G->GetNodes().begin(); \
43  N != G->GetNodes().end(); \
44  N++)
45 
46 #define GRAPH_FOR_EACH_NODE(G,N) \
47  for (HypergraphLib::Graph::MapNodesById::iterator N = G->GetNodes().begin(); \
48  N != G->GetNodes().end(); \
49  N++)
50 
51 
52 
53 namespace HypergraphLib {
54 
55 class Node;
56 class Arc;
57 
59 public:
60  typedef std::map < int, Arc * > MapArcsById;
61  typedef std::map < int, Node * > MapNodesById;
62 
63  ~Graph();
64 
68  Graph(int __id=0);
69 
73  Graph(const Graph &__G, int __clone=1, int __reverse=0);
74 
78  Graph(const Graph &__G, const std::set <Node *> & );
79  Graph(const Graph &__G, const std::vector <Node*> & __nodes);
80 
84  Node * GetNode (int) const;
85 
86 
91  Node* MergeNodes(Node *__A, Node *__B, int __id, bool __keepNodes=false);
92  Node* MergeNodes(int __A,int __B, int __id, bool __keepNodes=false);
93 
97  Arc * GetArc (int) const;
98 
102  int RemoveNode (int __id);
103 
107  int RemoveNode (Node *);
108 
112  int RemoveArc (int __id);
113 
117  int RemoveArc (Arc *);
118 
122  Node * AddNode (int __id=0);
123 
128  Arc * AddArc (const std::vector<int> &, int __id);
129 
136  Arc * AddArc(const int __id, int __rank, ...);
137 
138  Arc * AddArc(const int __id, const std::multimap<int, Node*> & __nodes);
139 
147  int CheckFreeNodeId(int __id) const;
148 
156  int CheckFreeArcId(int __id) const;
157 
161  int GetMaxArcId();
162 
166  int GetMaxNodeId();
167 
171  const MapArcsById & GetArcs()const {
172  return _arcs;
173  } ;
174 
178  const MapNodesById & GetNodes()const {
179  return _nodes;
180  } ;
181 
190  void CheckIntegrity()const;
191 
195  void Filaments ( std::vector < std::vector < int > > & __filaments );
196 
200  bool IsCycle () const;
201  bool IsCycle (const std::vector < Node * > & __nodes) const;
202 
207  Arc * DuplicateArc(int __id, int __dupId);
208  Arc * DuplicateArc(Arc * __arc, int __dupId);
209 
210 protected:
213 };
214 
215 } // end namespace HypergraphLib
216 
217 
218 #endif // GRAPH_H
HypergraphLib::Graph::_arcs
MapArcsById _arcs
Definition: hypergraphlib_graph.h:211
HypergraphLib::Graph::MapNodesById
std::map< int, Node * > MapNodesById
Definition: hypergraphlib_graph.h:61
HypergraphLib::Graph::GetNodes
const MapNodesById & GetNodes() const
Definition: hypergraphlib_graph.h:178
hypergraphlib_graphobject.h
HypergraphLib::Arc
Definition: hypergraphlib_arc.h:37
HypergraphLib
Definition: hypergraphlib_arc.cpp:32
HypergraphLib::Graph::_nodes
MapNodesById _nodes
Definition: hypergraphlib_graph.h:212
HYPERGRAPHLIB_ITEM
#define HYPERGRAPHLIB_ITEM
Definition: hypergraphlib_platform.h:36
HypergraphLib::GraphObject
Definition: hypergraphlib_graphobject.h:31
HypergraphLib::Graph::GetArcs
const MapArcsById & GetArcs() const
Definition: hypergraphlib_graph.h:171
HypergraphLib::Node
Definition: hypergraphlib_node.h:35
HypergraphLib::Filaments
HYPERGRAPHLIB_ITEM void Filaments(Graph *G, std::vector< std::vector< int > > &__filaments)
Definition: hypergraphlib_filaments.cpp:41
HypergraphLib::Graph::MapArcsById
std::map< int, Arc * > MapArcsById
Definition: hypergraphlib_graph.h:60