1.1 --- a/src/work/marci/experiment/list_graph.h Sun Apr 17 18:57:22 2005 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,570 +0,0 @@
1.4 -// -*- c++ -*-
1.5 -#ifndef LEMON_LIST_GRAPH_H
1.6 -#define LEMON_LIST_GRAPH_H
1.7 -
1.8 -#include <iostream>
1.9 -#include <vector>
1.10 -
1.11 -#include <invalid.h>
1.12 -
1.13 -namespace lemon {
1.14 -
1.15 - template <typename It>
1.16 - int count(It it) {
1.17 - int i=0;
1.18 - for( ; it.valid(); ++it) { ++i; }
1.19 - return i;
1.20 - }
1.21 -
1.22 - class ListGraph {
1.23 - class node_item;
1.24 - class edge_item;
1.25 - public:
1.26 - class Node;
1.27 - class NodeIt;
1.28 - class Edge;
1.29 - class EdgeIt;
1.30 - class OutEdgeIt;
1.31 - class InEdgeIt;
1.32 - class SymEdgeIt;
1.33 - template <typename T> class NodeMap;
1.34 - template <typename T> class EdgeMap;
1.35 - private:
1.36 - template <typename T> friend class NodeMap;
1.37 - template <typename T> friend class EdgeMap;
1.38 -
1.39 - template <typename T>
1.40 - class NodeMap {
1.41 - const ListGraph& G;
1.42 - std::vector<T> container;
1.43 - public:
1.44 - typedef T Value;
1.45 - typedef Node Key;
1.46 - NodeMap(const ListGraph& _G) : G(_G), container(G.node_id) { }
1.47 - NodeMap(const ListGraph& _G, T a) :
1.48 - G(_G), container(G.node_id, a) { }
1.49 - void set(Node n, T a) { container[/*G.id(n)*/n.node->id]=a; }
1.50 - T get(Node n) const { return container[/*G.id(n)*/n.node->id]; }
1.51 - typename std::vector<T>::reference operator[](Node n) {
1.52 - return container[/*G.id(n)*/n.node->id]; }
1.53 - typename std::vector<T>::const_reference operator[](Node n) const {
1.54 - return container[/*G.id(n)*/n.node->id];
1.55 - }
1.56 - void update() { container.resize(G.node_id); }
1.57 - void update(T a) { container.resize(G.node_id, a); }
1.58 - };
1.59 -
1.60 - template <typename T>
1.61 - class EdgeMap {
1.62 - const ListGraph& G;
1.63 - std::vector<T> container;
1.64 - public:
1.65 - typedef T Value;
1.66 - typedef Edge Key;
1.67 - EdgeMap(const ListGraph& _G) : G(_G), container(G.edge_id) { }
1.68 - EdgeMap(const ListGraph& _G, T a) :
1.69 - G(_G), container(G.edge_id, a) { }
1.70 - void set(Edge e, T a) { container[/*G.id(e)*/e.edge->id]=a; }
1.71 - T get(Edge e) const { return container[/*G.id(e)*/e.edge->id]; }
1.72 - typename std::vector<T>::reference operator[](Edge e) {
1.73 - return container[/*G.id(e)*/e.edge->id]; }
1.74 - typename std::vector<T>::const_reference operator[](Edge e) const {
1.75 - return container[/*G.id(e)*/e.edge->id];
1.76 - }
1.77 - void update() { container.resize(G.edge_id); }
1.78 - void update(T a) { container.resize(G.edge_id, a); }
1.79 - };
1.80 -
1.81 - int node_id;
1.82 - int edge_id;
1.83 - int _node_num;
1.84 - int _edge_num;
1.85 -
1.86 - node_item* _first_node;
1.87 - node_item* _last_node;
1.88 -
1.89 - class node_item {
1.90 - friend class ListGraph;
1.91 - template <typename T> friend class NodeMap;
1.92 -
1.93 - friend class Node;
1.94 - friend class NodeIt;
1.95 - friend class Edge;
1.96 - friend class EdgeIt;
1.97 - friend class OutEdgeIt;
1.98 - friend class InEdgeIt;
1.99 - friend class SymEdgeIt;
1.100 - friend std::ostream& operator<<(std::ostream& os, const Node& i);
1.101 - friend std::ostream& operator<<(std::ostream& os, const Edge& i);
1.102 - //ListGraph* G;
1.103 - int id;
1.104 - edge_item* _first_out_edge;
1.105 - edge_item* _last_out_edge;
1.106 - edge_item* _first_in_edge;
1.107 - edge_item* _last_in_edge;
1.108 - node_item* _next_node;
1.109 - node_item* _prev_node;
1.110 - public:
1.111 - node_item() { }
1.112 - };
1.113 -
1.114 - class edge_item {
1.115 - friend class ListGraph;
1.116 - template <typename T> friend class EdgeMap;
1.117 -
1.118 - friend class Node;
1.119 - friend class NodeIt;
1.120 - friend class Edge;
1.121 - friend class EdgeIt;
1.122 - friend class OutEdgeIt;
1.123 - friend class InEdgeIt;
1.124 - friend class SymEdgeIt;
1.125 - friend std::ostream& operator<<(std::ostream& os, const Edge& i);
1.126 - //ListGraph* G;
1.127 - int id;
1.128 - node_item* _source;
1.129 - node_item* _target;
1.130 - edge_item* _next_out;
1.131 - edge_item* _prev_out;
1.132 - edge_item* _next_in;
1.133 - edge_item* _prev_in;
1.134 - public:
1.135 - edge_item() { }
1.136 - };
1.137 -
1.138 - node_item* _add_node() {
1.139 - node_item* p=new node_item;
1.140 - p->id=node_id++;
1.141 - p->_first_out_edge=0;
1.142 - p->_last_out_edge=0;
1.143 - p->_first_in_edge=0;
1.144 - p->_last_in_edge=0;
1.145 - p->_prev_node=_last_node;
1.146 - p->_next_node=0;
1.147 - if (_last_node) _last_node->_next_node=p;
1.148 - _last_node=p;
1.149 - if (!_first_node) _first_node=p;
1.150 -
1.151 - ++_node_num;
1.152 - return p;
1.153 - }
1.154 -
1.155 - edge_item* _add_edge(node_item* _source, node_item* _target) {
1.156 - edge_item* e=new edge_item;
1.157 - e->id=edge_id++;
1.158 - e->_source=_source;
1.159 - e->_target=_target;
1.160 -
1.161 - e->_prev_out=_source->_last_out_edge;
1.162 - if (_source->_last_out_edge) (_source->_last_out_edge)->_next_out=e;
1.163 - _source->_last_out_edge=e;
1.164 - if (!_source->_first_out_edge) _source->_first_out_edge=e;
1.165 - e->_next_out=0;
1.166 -
1.167 - e->_prev_in=_target->_last_in_edge;
1.168 - if (_target->_last_in_edge) (_target->_last_in_edge)->_next_in=e;
1.169 - _target->_last_in_edge=e;
1.170 - if (!_target->_first_in_edge) { _target->_first_in_edge=e; }
1.171 - e->_next_in=0;
1.172 -
1.173 - ++_edge_num;
1.174 - return e;
1.175 - }
1.176 -
1.177 - //deletes a node which has no out edge and no in edge
1.178 - void _delete_node(node_item* v) {
1.179 - if (v->_next_node) (v->_next_node)->_prev_node=v->_prev_node; else
1.180 - _last_node=v->_prev_node;
1.181 - if (v->_prev_node) (v->_prev_node)->_next_node=v->_next_node; else
1.182 - _first_node=v->_next_node;
1.183 -
1.184 - delete v;
1.185 - --_node_num;
1.186 - }
1.187 -
1.188 - void _delete_edge(edge_item* e) {
1.189 - if (e->_next_out) (e->_next_out)->_prev_out=e->_prev_out; else
1.190 - (e->_source)->_last_out_edge=e->_prev_out;
1.191 - if (e->_prev_out) (e->_prev_out)->_next_out=e->_next_out; else
1.192 - (e->_source)->_first_out_edge=e->_next_out;
1.193 - if (e->_next_in) (e->_next_in)->_prev_in=e->_prev_in; else
1.194 - (e->_target)->_last_in_edge=e->_prev_in;
1.195 - if (e->_prev_in) (e->_prev_in)->_next_in=e->_next_in; else
1.196 - (e->_target)->_first_in_edge=e->_next_in;
1.197 -
1.198 - delete e;
1.199 - --_edge_num;
1.200 - }
1.201 -
1.202 - void _set_source(edge_item* e, node_item* _source) {
1.203 - if (e->_next_out) (e->_next_out)->_prev_out=e->_prev_out; else
1.204 - (e->_source)->_last_out_edge=e->_prev_out;
1.205 - if (e->_prev_out) (e->_prev_out)->_next_out=e->_next_out; else
1.206 - (e->_source)->_first_out_edge=e->_next_out;
1.207 -
1.208 - e->_source=_source;
1.209 -
1.210 - e->_prev_out=_source->_last_out_edge;
1.211 - if (_source->_last_out_edge) (_source->_last_out_edge)->_next_out=e;
1.212 - _source->_last_out_edge=e;
1.213 - if (!_source->_first_out_edge) _source->_first_out_edge=e;
1.214 - e->_next_out=0;
1.215 - }
1.216 -
1.217 - void _set_target(edge_item* e, node_item* _target) {
1.218 - if (e->_next_in) (e->_next_in)->_prev_in=e->_prev_in; else
1.219 - (e->_target)->_last_in_edge=e->_prev_in;
1.220 - if (e->_prev_in) (e->_prev_in)->_next_in=e->_next_in; else
1.221 - (e->_target)->_first_in_edge=e->_next_in;
1.222 -
1.223 - e->_target=_target;
1.224 -
1.225 - e->_prev_in=_target->_last_in_edge;
1.226 - if (_target->_last_in_edge) (_target->_last_in_edge)->_next_in=e;
1.227 - _target->_last_in_edge=e;
1.228 - if (!_target->_first_in_edge) { _target->_first_in_edge=e; }
1.229 - e->_next_in=0;
1.230 - }
1.231 -
1.232 - public:
1.233 -
1.234 - /* default constructor */
1.235 -
1.236 - ListGraph() : node_id(0), edge_id(0), _node_num(0), _edge_num(0), _first_node(0), _last_node(0) { }
1.237 -
1.238 - ~ListGraph() {
1.239 - while (first<NodeIt>().valid()) erase(first<NodeIt>());
1.240 - }
1.241 -
1.242 - int nodeNum() const { return _node_num; }
1.243 - int edgeNum() const { return _edge_num; }
1.244 -
1.245 - /* functions to construct iterators from the graph, or from each other */
1.246 -
1.247 - //NodeIt firstNode() const { return NodeIt(*this); }
1.248 - //EdgeIt firstEdge() const { return EdgeIt(*this); }
1.249 -
1.250 - //OutEdgeIt firstOutEdge(const Node v) const { return OutEdgeIt(v); }
1.251 - //InEdgeIt firstInEdge(const Node v) const { return InEdgeIt(v); }
1.252 - //SymEdgeIt firstSymEdge(const Node v) const { return SymEdgeIt(v); }
1.253 - Node source(Edge e) const { return e.sourceNode(); }
1.254 - Node target(Edge e) const { return e.targetNode(); }
1.255 -
1.256 - Node aNode(const OutEdgeIt& e) const { return e.aNode(); }
1.257 - Node aNode(const InEdgeIt& e) const { return e.aNode(); }
1.258 - Node aNode(const SymEdgeIt& e) const { return e.aNode(); }
1.259 -
1.260 - Node bNode(const OutEdgeIt& e) const { return e.bNode(); }
1.261 - Node bNode(const InEdgeIt& e) const { return e.bNode(); }
1.262 - Node bNode(const SymEdgeIt& e) const { return e.bNode(); }
1.263 -
1.264 - //Node invalid_node() { return Node(); }
1.265 - //Edge invalid_edge() { return Edge(); }
1.266 - //OutEdgeIt invalid_out_edge() { return OutEdgeIt(); }
1.267 - //InEdgeIt invalid_in_edge() { return InEdgeIt(); }
1.268 - //SymEdgeIt invalid_sym_edge() { return SymEdgeIt(); }
1.269 -
1.270 - /* same methods in other style */
1.271 - /* for experimental purpose */
1.272 -
1.273 - NodeIt& /*getF*/first(NodeIt& v) const {
1.274 - v=NodeIt(*this); return v; }
1.275 - EdgeIt& /*getF*/first(EdgeIt& e) const {
1.276 - e=EdgeIt(*this); return e; }
1.277 - OutEdgeIt& /*getF*/first(OutEdgeIt& e, Node v) const {
1.278 - e=OutEdgeIt(*this, v); return e; }
1.279 - InEdgeIt& /*getF*/first(InEdgeIt& e, Node v) const {
1.280 - e=InEdgeIt(*this, v); return e; }
1.281 - SymEdgeIt& /*getF*/first(SymEdgeIt& e, Node v) const {
1.282 - e=SymEdgeIt(*this, v); return e; }
1.283 - //void getSource(Node& n, const Edge& e) const { n=source(e); }
1.284 - //void getTarget(Node& n, const Edge& e) const { n=target(e); }
1.285 -
1.286 - //void getANode(Node& n, const OutEdgeIt& e) const { n=e.aNode(); }
1.287 - //void getANode(Node& n, const InEdgeIt& e) const { n=e.aNode(); }
1.288 - //void getANode(Node& n, const SymEdgeIt& e) const { n=e.aNode(); }
1.289 - //void getBNode(Node& n, const OutEdgeIt& e) const { n=e.bNode(); }
1.290 - //void getBNode(Node& n, const InEdgeIt& e) const { n=e.bNode(); }
1.291 - //void getBNode(Node& n, const SymEdgeIt& e) const { n=e.bNode(); }
1.292 - //void get_invalid(Node& n) { n=Node(); }
1.293 - //void get_invalid(Edge& e) { e=Edge(); }
1.294 - //void get_invalid(OutEdgeIt& e) { e=OutEdgeIt(); }
1.295 - //void get_invalid(InEdgeIt& e) { e=InEdgeIt(); }
1.296 - //void get_invalid(SymEdgeIt& e) { e=SymEdgeIt(); }
1.297 -
1.298 - template< typename It >
1.299 - It first() const {
1.300 - It e;
1.301 - /*getF*/first(e);
1.302 - return e;
1.303 - }
1.304 -
1.305 - template< typename It >
1.306 - It first(Node v) const {
1.307 - It e;
1.308 - /*getF*/first(e, v);
1.309 - return e;
1.310 - }
1.311 -
1.312 - bool valid(Node n) const { return n.valid(); }
1.313 - bool valid(Edge e) const { return e.valid(); }
1.314 -
1.315 -// template <typename It> It getNext(It it) const {
1.316 -// It tmp(it); next(tmp); return tmp; }
1.317 -// NodeIt& next(NodeIt& it) const { return ++it; }
1.318 -// EdgeIt& next(EdgeIt& it) const { return ++it; }
1.319 -// OutEdgeIt& next(OutEdgeIt& it) const { return ++it; }
1.320 -// InEdgeIt& next(InEdgeIt& it) const { return ++it; }
1.321 -// SymEdgeIt& next(SymEdgeIt& it) const { return ++it; }
1.322 -// template <typename It> It& next(It& it) const { return ++it; }
1.323 - template <typename It> It& next(It& it) const { ++it; return it; }
1.324 -
1.325 -
1.326 - /* for getting id's of graph objects */
1.327 - /* these are important for the implementation of property vectors */
1.328 -
1.329 - int id(Node v) const { return v.node->id; }
1.330 - int id(Edge e) const { return e.edge->id; }
1.331 -
1.332 - /* adding nodes and edges */
1.333 -
1.334 - Node addNode() { return Node(_add_node()); }
1.335 - Edge addEdge(Node u, Node v) {
1.336 - return Edge(_add_edge(u.node, v.node));
1.337 - }
1.338 -
1.339 - void erase(Node i) {
1.340 - while (first<OutEdgeIt>(i).valid()) erase(first<OutEdgeIt>(i));
1.341 - while (first<InEdgeIt>(i).valid()) erase(first<InEdgeIt>(i));
1.342 - _delete_node(i.node);
1.343 - }
1.344 -
1.345 - void erase(Edge e) { _delete_edge(e.edge); }
1.346 -
1.347 - void clear() {
1.348 - while (first<NodeIt>().valid()) erase(first<NodeIt>());
1.349 - }
1.350 -
1.351 - void setSource(Edge e, Node source) {
1.352 - _set_source(e.edge, source.node);
1.353 - }
1.354 -
1.355 - void setTarget(Edge e, Node target) {
1.356 - _set_target(e.edge, target.node);
1.357 - }
1.358 -
1.359 - /* stream operations, for testing purpose */
1.360 -
1.361 - friend std::ostream& operator<<(std::ostream& os, const Node& i) {
1.362 - os << i.node->id; return os;
1.363 - }
1.364 - friend std::ostream& operator<<(std::ostream& os, const Edge& i) {
1.365 - os << "(" << i.edge->_source->id << "--" << i.edge->id << "->" << i.edge->_target->id << ")";
1.366 - return os;
1.367 - }
1.368 -
1.369 - class Node {
1.370 - friend class ListGraph;
1.371 - template <typename T> friend class NodeMap;
1.372 -
1.373 - friend class Edge;
1.374 - friend class OutEdgeIt;
1.375 - friend class InEdgeIt;
1.376 - friend class SymEdgeIt;
1.377 - //public: //FIXME: It is required by op= of NodeIt
1.378 - protected:
1.379 - node_item* node;
1.380 - protected:
1.381 - friend int ListGraph::id(Node v) const;
1.382 - public:
1.383 - Node() /*: node(0)*/ { }
1.384 - Node(const Invalid&) : node(0) { }
1.385 - protected:
1.386 - Node(node_item* _node) : node(_node) { }
1.387 - bool valid() const { return (node); }
1.388 - public:
1.389 - //void makeInvalid() { node=0; }
1.390 - friend bool operator==(Node u, Node v) { return v.node==u.node; }
1.391 - friend bool operator!=(Node u, Node v) { return v.node!=u.node; }
1.392 - friend std::ostream& operator<<(std::ostream& os, const Node& i);
1.393 - };
1.394 -
1.395 - class NodeIt : public Node {
1.396 - friend class ListGraph;
1.397 - //protected:
1.398 - public: //for everybody but marci
1.399 - NodeIt(const ListGraph& G) : Node(G._first_node) { }
1.400 - public:
1.401 - NodeIt() : Node() { }
1.402 - NodeIt(const Invalid& i) : Node(i) { }
1.403 - protected:
1.404 - NodeIt(node_item* v) : Node(v) { }
1.405 - NodeIt& operator++() { node=node->_next_node; return *this; }
1.406 - //FIXME::
1.407 - // NodeIt& operator=(const Node& e)
1.408 - // { node=e.node; return *this; }
1.409 - };
1.410 -
1.411 - class Edge {
1.412 - friend class ListGraph;
1.413 - template <typename T> friend class EdgeMap;
1.414 -
1.415 - friend class Node;
1.416 - friend class NodeIt;
1.417 - protected:
1.418 - edge_item* edge;
1.419 - friend int ListGraph::id(Edge e) const;
1.420 - public:
1.421 - Edge() /*: edge(0)*/ { }
1.422 - Edge(const Invalid&) : edge(0) { }
1.423 - //Edge() { }
1.424 - protected:
1.425 - Edge(edge_item* _edge) : edge(_edge) { }
1.426 - bool valid() const { return (edge); }
1.427 - public:
1.428 - //void makeInvalid() { edge=0; }
1.429 - friend bool operator==(Edge u, Edge v) { return v.edge==u.edge; }
1.430 - friend bool operator!=(Edge u, Edge v) { return v.edge!=u.edge; }
1.431 - protected:
1.432 - Node sourceNode() const { return Node(edge->_source); }
1.433 - Node targetNode() const { return Node(edge->_target); }
1.434 - public:
1.435 - friend std::ostream& operator<<(std::ostream& os, const Edge& i);
1.436 - };
1.437 -
1.438 - class EdgeIt : public Edge {
1.439 - friend class ListGraph;
1.440 - //protected:
1.441 - public: //for alpar
1.442 - EdgeIt(const ListGraph& G) {
1.443 - node_item* v=G._first_node;
1.444 - if (v) edge=v->_first_out_edge; else edge=0;
1.445 - while (v && !edge) { v=v->_next_node; if (v) edge=v->_first_out_edge; }
1.446 - }
1.447 - public:
1.448 - EdgeIt() : Edge() { }
1.449 - EdgeIt(const Invalid& i) : Edge(i) { }
1.450 - protected:
1.451 - EdgeIt(edge_item* _e) : Edge(_e) { }
1.452 - EdgeIt& operator++() {
1.453 - node_item* v=edge->_source;
1.454 - edge=edge->_next_out;
1.455 - while (v && !edge) { v=v->_next_node; if (v) edge=v->_first_out_edge; }
1.456 - return *this;
1.457 - }
1.458 - };
1.459 -
1.460 - class OutEdgeIt : public Edge {
1.461 - friend class ListGraph;
1.462 - //node_item* v;
1.463 - //protected:
1.464 - protected: //for alpar
1.465 - OutEdgeIt(const Node& _v) /*: v(_v.node)*/ { edge=_v.node->_first_out_edge; }
1.466 - public:
1.467 - OutEdgeIt() : Edge()/*, v(0)*/ { }
1.468 - OutEdgeIt(const Invalid& i) : Edge(i) { }
1.469 - OutEdgeIt(const ListGraph&, Node _v) /*: v(_v.node)*/ { edge=_v.node->_first_out_edge; }
1.470 - protected:
1.471 - OutEdgeIt& operator++() { edge=edge->_next_out; return *this; }
1.472 - protected:
1.473 - Node aNode() const { return Node(edge->_source); }
1.474 - Node bNode() const { return Node(edge->_target); }
1.475 - };
1.476 -
1.477 - class InEdgeIt : public Edge {
1.478 - friend class ListGraph;
1.479 - //node_item* v;
1.480 - //protected:
1.481 - protected: //for alpar
1.482 - InEdgeIt(const Node& _v) /*: v(_v.node)*/ { edge=_v.node->_first_in_edge; }
1.483 - public:
1.484 - InEdgeIt() : Edge()/*, v(0)*/ { }
1.485 - InEdgeIt(const Invalid& i) : Edge(i) { }
1.486 - InEdgeIt(const ListGraph&, Node _v) /*: v(_v.node)*/ { edge=_v.node->_first_in_edge; }
1.487 - protected:
1.488 - InEdgeIt& operator++() { edge=edge->_next_in; return *this; }
1.489 - protected:
1.490 - Node aNode() const { return Node(edge->_target); }
1.491 - Node bNode() const { return Node(edge->_source); }
1.492 - };
1.493 -
1.494 - class SymEdgeIt : public Edge {
1.495 - friend class ListGraph;
1.496 - bool out_or_in; //1 iff out, 0 iff in
1.497 - //node_item* v;
1.498 - //protected:
1.499 - public: //for alpar
1.500 - SymEdgeIt(const Node& _v) /*: v(_v.node)*/ {
1.501 - out_or_in=1;
1.502 - edge=_v.node->_first_out_edge;
1.503 - if (!edge) { edge=_v.node->_first_in_edge; out_or_in=0; }
1.504 - }
1.505 - public:
1.506 - SymEdgeIt() : Edge() /*, v(0)*/ { }
1.507 - SymEdgeIt(const Invalid& i) : Edge(i) { }
1.508 - SymEdgeIt(const ListGraph&, Node _v) /*: v(_v.node)*/ {
1.509 - out_or_in=1;
1.510 - edge=_v.node->_first_out_edge;
1.511 - if (!edge) { edge=_v.node->_first_in_edge; out_or_in=0; }
1.512 - }
1.513 - protected:
1.514 - SymEdgeIt& operator++() {
1.515 - if (out_or_in) {
1.516 - node_item* v=edge->_source;
1.517 - edge=edge->_next_out;
1.518 - if (!edge) { out_or_in=0; edge=v->_first_in_edge; }
1.519 - } else {
1.520 - edge=edge->_next_in;
1.521 - }
1.522 - return *this;
1.523 - }
1.524 - protected:
1.525 - Node aNode() const {
1.526 - return (out_or_in) ? Node(edge->_source) : Node(edge->_target); }
1.527 - Node bNode() const {
1.528 - return (out_or_in) ? Node(edge->_target) : Node(edge->_source); }
1.529 - };
1.530 -
1.531 - };
1.532 -
1.533 -// template< typename T >
1.534 -// T ListGraph::first() const {
1.535 -// std::cerr << "Invalid use of template<typemane T> T ListGraph::first<T>();" << std::endl;
1.536 -// return T();
1.537 -// }
1.538 -
1.539 -// template<>
1.540 -// ListGraph::NodeIt ListGraph::first<ListGraph::NodeIt>() const {
1.541 -// return firstNode();
1.542 -// }
1.543 -
1.544 -// template<>
1.545 -// ListGraph::EdgeIt ListGraph::first<ListGraph::EdgeIt>() const {
1.546 -// return firstEdge();
1.547 -// }
1.548 -
1.549 -// template< typename T >
1.550 -// T ListGraph::first(ListGraph::Node v) const {
1.551 -// std::cerr << "Invalid use of template<typemane T> T ListGraph::first<T>(ListGRaph::Node);" << std::endl;
1.552 -// return T();
1.553 -// }
1.554 -
1.555 -// template<>
1.556 -// ListGraph::OutEdgeIt ListGraph::first<ListGraph::OutEdgeIt>(const ListGraph::Node v) const {
1.557 -// return firstOutEdge(v);
1.558 -// }
1.559 -
1.560 -// template<>
1.561 -// ListGraph::InEdgeIt ListGraph::first<ListGraph::InEdgeIt>(const ListGraph::Node v) const {
1.562 -// return firstInEdge(v);
1.563 -// }
1.564 -
1.565 -// template<>
1.566 -// ListGraph::SymEdgeIt ListGraph::first<ListGraph::SymEdgeIt>(const ListGraph::Node v) const {
1.567 -// return firstSymEdge(v);
1.568 -// }
1.569 -
1.570 -
1.571 -} //namespace lemon
1.572 -
1.573 -#endif //LEMON_LIST_GRAPH_H