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_node.h |
15 |
//####// |
16 |
//####//------------------------------------------------------------ |
17 |
//####//------------------------------------------------------------ |
18 |
//####// COPYRIGHT 2000-2024 |
19 |
//####// jeu 13 jun 2024 11:53:59 EDT |
20 |
//####//------------------------------------------------------------ |
21 |
//####//------------------------------------------------------------ |
22 |
#ifndef NODE_H |
23 |
#define NODE_H |
24 |
|
25 |
|
26 |
#include <map> |
27 |
#include <set> |
28 |
#include "hypergraphlib_graphobject.h" |
29 |
|
30 |
namespace HypergraphLib { |
31 |
|
32 |
class Arc; |
33 |
class Graph; |
34 |
|
35 |
class HYPERGRAPHLIB_ITEM Node : public GraphObject { |
36 |
public: |
37 |
typedef std::multimap < int , Arc * > MultimapArcsById; |
38 |
typedef std::pair < int, Arc* > IntArc_Pair; |
39 |
|
40 |
/** |
41 |
* Constructs an empty node |
42 |
*/ |
43 |
Node (Graph * __owner, int __id); |
44 |
|
45 |
/** |
46 |
* Copy constructor |
47 |
*/ |
48 |
Node (const Node & __from, const Graph * __owner=0); |
49 |
|
50 |
/** |
51 |
* Returns the array of incident arcs |
52 |
*/ |
53 |
MultimapArcsById & IncidentArcs() { |
54 |
return _arcs; |
55 |
}; |
56 |
|
57 |
/** |
58 |
* Add an incident arc to this node |
59 |
*/ |
60 |
void Add(Arc *); |
61 |
|
62 |
/** |
63 |
* Returns the number of ocurences of the specified arc incident |
64 |
* to this node : this function will return "2" for a loop |
65 |
*/ |
66 |
unsigned int ArcCount (int __id); |
67 |
|
68 |
/** |
69 |
* Removes one occurence of the arc ID incident to this node |
70 |
* Return 1 if the arc ID is found in incident arcs |
71 |
*/ |
72 |
int Remove (int __id); |
73 |
|
74 |
/** |
75 |
* Return the list of adjacent nodes |
76 |
*/ |
77 |
void AdjacentNodes ( std::set < int > & __adjacentNodes ); |
78 |
/** |
79 |
* Return the list of adjacent nodes |
80 |
*/ |
81 |
void AdjacentNodes ( std::set < Node * > & __adjacentNodes ); |
82 |
|
83 |
Arc * IsAdjacentToNode ( int __nodeId ); |
84 |
|
85 |
Arc * IsAdjacentToNode ( Node * __n ); |
86 |
|
87 |
/** |
88 |
*/ |
89 |
int GetNbArcsToNode(Node * __other); |
90 |
|
91 |
protected: |
92 |
MultimapArcsById _arcs; |
93 |
}; |
94 |
} // end namespace HypergraphLib |
95 |
|
96 |
#endif |