author | alpar |
Tue, 03 Feb 2004 12:42:54 +0000 | |
changeset 53 | cc5eb73a3a93 |
parent 52 | a4fc9c5dcee5 |
child 54 | acd0dc288149 |
permissions | -rw-r--r-- |
alpar@52 | 1 |
// -*-mode: c++; -*- |
alpar@52 | 2 |
|
alpar@52 | 3 |
class Graph |
alpar@52 | 4 |
{ |
alpar@52 | 5 |
public: |
alpar@52 | 6 |
typedef E EdgeType; |
alpar@52 | 7 |
typedef N NodeType; |
alpar@52 | 8 |
|
alpar@52 | 9 |
class EdgeIt {}; |
alpar@52 | 10 |
|
alpar@52 | 11 |
class InEdgeIt : public EdgeIt |
alpar@52 | 12 |
class OutEdgeIt : public EdgeIt {}; |
alpar@52 | 13 |
class SymEdgeIt : public EdgeIt {}; |
alpar@52 | 14 |
class EachEdgeIt : public EdgeIt {}; |
alpar@52 | 15 |
|
alpar@52 | 16 |
class NodeIt {}; |
alpar@52 | 17 |
|
alpar@52 | 18 |
NodeIt &getFirst(NodeIt &); |
alpar@52 | 19 |
InEdgeIt &getFirst(InEdgeIt &,const NodeIt &); |
alpar@52 | 20 |
OutEdgeIt &getFirst(OutEdgeIt &,const NodeIt &); |
alpar@52 | 21 |
SymEdgeIt &getFirst(SymEdgeIt &,const NodeIt &); |
alpar@52 | 22 |
EachEdgeIt &getFirst(EachEdgeIt &); |
alpar@52 | 23 |
|
alpar@52 | 24 |
NodeIt next(const NodeIt &); |
alpar@52 | 25 |
InEdgeIt next(const InEdgeIt &); |
alpar@52 | 26 |
OutEdgeIt next(const OutEdgeIt &); |
alpar@52 | 27 |
SymEdgeIt next(const SymEdgeIt &); |
alpar@52 | 28 |
EachEdgeIt next(const EachEdgeIt &); |
alpar@52 | 29 |
|
alpar@52 | 30 |
NodeIt &goNext(const NodeIt &); |
alpar@52 | 31 |
InEdgeIt &goNext(const InEdgeIt &); |
alpar@52 | 32 |
OutEdgeIt &goNext(const OutEdgeIt &); |
alpar@52 | 33 |
SymEdgeIt &goNext(const SymEdgeIt &); |
alpar@52 | 34 |
EachEdgeIt &goNext(const EachEdgeIt &); |
alpar@52 | 35 |
|
alpar@52 | 36 |
bool valid(const NodeIt &n); |
alpar@52 | 37 |
bool valid(const EdgeIt &n); |
alpar@52 | 38 |
|
alpar@52 | 39 |
void setInvalid(const NodeIt &n); |
alpar@52 | 40 |
void setInvalid(const EdgeIt &n); |
alpar@52 | 41 |
|
alpar@52 | 42 |
NodeIt addNode(); |
alpar@52 | 43 |
EdgeIt addEdge(const NodeIt from,const NodeIt to); |
alpar@52 | 44 |
|
alpar@52 | 45 |
void delete(NodeIt n); |
alpar@52 | 46 |
void delete(EdgeIt e); |
alpar@52 | 47 |
|
alpar@52 | 48 |
void clean(); |
alpar@52 | 49 |
|
alpar@52 | 50 |
template<class T> class NodeMap |
alpar@52 | 51 |
{ |
alpar@52 | 52 |
public: |
alpar@52 | 53 |
typedef T value_type; |
alpar@52 | 54 |
void set(const NodeIt i, const T &t); |
alpar@52 | 55 |
T get(const NodeIt i) const; |
alpar@53 | 56 |
T &operator[](const NodeIt i); |
alpar@52 | 57 |
|
alpar@52 | 58 |
NodeMap(const Graph &G); |
alpar@52 | 59 |
}; |
alpar@52 | 60 |
|
alpar@52 | 61 |
template<class T> class EdgeMap |
alpar@52 | 62 |
{ |
alpar@52 | 63 |
public: |
alpar@52 | 64 |
typedef T value_type; |
alpar@52 | 65 |
void set(const EdgeIt i, const T &t); |
alpar@52 | 66 |
T get(const EdgeIt i) const; |
alpar@53 | 67 |
T &operator[](const EdgeIt i); |
alpar@52 | 68 |
|
alpar@52 | 69 |
EdgeMap(const Graph &G); |
alpar@52 | 70 |
}; |
alpar@52 | 71 |
}; |