# HG changeset patch # User alpar # Date 1075812089 0 # Node ID a4fc9c5dcee5de030367e54dd88e163fae0345c2 # Parent 41133bd4ed941b34a18dda22352f288b7b1b0136 An empty Graph class. diff -r 41133bd4ed94 -r a4fc9c5dcee5 src/work/alpar/emptygraph.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/work/alpar/emptygraph.h Tue Feb 03 12:41:29 2004 +0000 @@ -0,0 +1,72 @@ +// -*-mode: c++; -*- + +template +class Graph +{ +public: + typedef E EdgeType; + typedef N NodeType; + + class EdgeIt {}; + + class InEdgeIt : public EdgeIt + class OutEdgeIt : public EdgeIt {}; + class SymEdgeIt : public EdgeIt {}; + class EachEdgeIt : public EdgeIt {}; + + class NodeIt {}; + + NodeIt &getFirst(NodeIt &); + InEdgeIt &getFirst(InEdgeIt &,const NodeIt &); + OutEdgeIt &getFirst(OutEdgeIt &,const NodeIt &); + SymEdgeIt &getFirst(SymEdgeIt &,const NodeIt &); + EachEdgeIt &getFirst(EachEdgeIt &); + + NodeIt next(const NodeIt &); + InEdgeIt next(const InEdgeIt &); + OutEdgeIt next(const OutEdgeIt &); + SymEdgeIt next(const SymEdgeIt &); + EachEdgeIt next(const EachEdgeIt &); + + NodeIt &goNext(const NodeIt &); + InEdgeIt &goNext(const InEdgeIt &); + OutEdgeIt &goNext(const OutEdgeIt &); + SymEdgeIt &goNext(const SymEdgeIt &); + EachEdgeIt &goNext(const EachEdgeIt &); + + bool valid(const NodeIt &n); + bool valid(const EdgeIt &n); + + void setInvalid(const NodeIt &n); + void setInvalid(const EdgeIt &n); + + NodeIt addNode(); + EdgeIt addEdge(const NodeIt from,const NodeIt to); + + void delete(NodeIt n); + void delete(EdgeIt e); + + void clean(); + + template class NodeMap + { + public: + typedef T value_type; + void set(const NodeIt i, const T &t); + T get(const NodeIt i) const; + T operator[](const NodeIt i); + + NodeMap(const Graph &G); + }; + + template class EdgeMap + { + public: + typedef T value_type; + void set(const EdgeIt i, const T &t); + T get(const EdgeIt i) const; + T operator[](const EdgeIt i); + + EdgeMap(const Graph &G); + }; +};