1 |
francois |
283 |
#ifndef NODE_H |
2 |
|
|
#define NODE_H |
3 |
|
|
|
4 |
|
|
|
5 |
|
|
#include <map> |
6 |
|
|
#include <set> |
7 |
|
|
#include "HypergraphLib_GraphObject.h" |
8 |
|
|
|
9 |
|
|
namespace HypergraphLib { |
10 |
|
|
|
11 |
|
|
class Arc; |
12 |
|
|
class Graph; |
13 |
|
|
|
14 |
|
|
class HYPERGRAPHLIB_ITEM Node : public GraphObject { |
15 |
|
|
public: |
16 |
|
|
typedef std::multimap < int , Arc * > MultimapArcsById; |
17 |
|
|
typedef std::pair < int, Arc* > IntArc_Pair; |
18 |
|
|
|
19 |
|
|
/** |
20 |
|
|
* Constructs an empty node |
21 |
|
|
*/ |
22 |
|
|
Node (Graph * __owner, int __id); |
23 |
|
|
|
24 |
|
|
/** |
25 |
|
|
* Copy constructor |
26 |
|
|
*/ |
27 |
|
|
Node (const Node & __from, const Graph * __owner=0); |
28 |
|
|
|
29 |
|
|
/** |
30 |
|
|
* Returns the array of incident arcs |
31 |
|
|
*/ |
32 |
|
|
MultimapArcsById & IncidentArcs() { |
33 |
|
|
return _arcs; |
34 |
|
|
}; |
35 |
|
|
|
36 |
|
|
/** |
37 |
|
|
* Add an incident arc to this node |
38 |
|
|
*/ |
39 |
|
|
void Add(Arc *); |
40 |
|
|
|
41 |
|
|
/** |
42 |
|
|
* Returns the number of ocurences of the specified arc incident |
43 |
|
|
* to this node : this function will return "2" for a loop |
44 |
|
|
*/ |
45 |
|
|
unsigned int ArcCount (int __id); |
46 |
|
|
|
47 |
|
|
/** |
48 |
|
|
* Removes one occurence of the arc ID incident to this node |
49 |
|
|
* Return 1 if the arc ID is found in incident arcs |
50 |
|
|
*/ |
51 |
|
|
int Remove (int __id); |
52 |
|
|
|
53 |
|
|
/** |
54 |
|
|
* Return the list of adjacent nodes |
55 |
|
|
*/ |
56 |
|
|
void AdjacentNodes ( std::set < int > & __adjacentNodes ); |
57 |
|
|
/** |
58 |
|
|
* Return the list of adjacent nodes |
59 |
|
|
*/ |
60 |
|
|
void AdjacentNodes ( std::set < Node * > & __adjacentNodes ); |
61 |
|
|
|
62 |
|
|
Arc * IsAdjacentToNode ( int __nodeId ); |
63 |
|
|
|
64 |
|
|
Arc * IsAdjacentToNode ( Node * __n ); |
65 |
|
|
|
66 |
|
|
/** |
67 |
|
|
*/ |
68 |
|
|
int GetNbArcsToNode(Node * __other); |
69 |
|
|
|
70 |
|
|
protected: |
71 |
|
|
MultimapArcsById _arcs; |
72 |
|
|
}; |
73 |
|
|
} // end namespace HypergraphLib |
74 |
|
|
|
75 |
|
|
#endif |