1 |
foucault |
27 |
#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(){return _arcs;};
|
33 |
|
|
|
34 |
|
|
/**
|
35 |
|
|
* Add an incident arc to this node
|
36 |
|
|
*/
|
37 |
|
|
void Add(Arc *);
|
38 |
|
|
|
39 |
|
|
/**
|
40 |
|
|
* Returns the number of ocurences of the specified arc incident
|
41 |
|
|
* to this node : this function will return "2" for a loop
|
42 |
|
|
*/
|
43 |
|
|
unsigned int ArcCount (int __id);
|
44 |
|
|
|
45 |
|
|
/**
|
46 |
|
|
* Removes one occurence of the arc ID incident to this node
|
47 |
|
|
* Return 1 if the arc ID is found in incident arcs
|
48 |
|
|
*/
|
49 |
|
|
int Remove (int __id);
|
50 |
|
|
|
51 |
|
|
/**
|
52 |
|
|
* Return the list of adjacent nodes
|
53 |
|
|
*/
|
54 |
|
|
void AdjacentNodes ( std::set < int > & __adjacentNodes );
|
55 |
|
|
/**
|
56 |
|
|
* Return the list of adjacent nodes
|
57 |
|
|
*/
|
58 |
|
|
void AdjacentNodes ( std::set < Node * > & __adjacentNodes );
|
59 |
|
|
|
60 |
|
|
Arc * IsAdjacentToNode ( int __nodeId );
|
61 |
|
|
|
62 |
|
|
Arc * Node::IsAdjacentToNode ( Node * __n );
|
63 |
|
|
|
64 |
|
|
/**
|
65 |
|
|
*/
|
66 |
|
|
int GetNbArcsToNode(Node * __other);
|
67 |
|
|
|
68 |
|
|
protected:
|
69 |
|
|
MultimapArcsById _arcs;
|
70 |
|
|
};
|
71 |
|
|
} // end namespace HypergraphLib
|
72 |
|
|
|
73 |
|
|
#endif
|