diff -r ee5959aa4410 -r c280de819a73 src/work/peter/edgepathgraph.h --- a/src/work/peter/edgepathgraph.h Sun Apr 17 18:57:22 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,407 +0,0 @@ -// -*- c++ -*- -#ifndef LEMON_NET_GRAPH_H -#define LEMON_NET_GRAPH_H - -///\file -///\brief Declaration of EdgePathGraph. - -#include -#include - -/// The namespace of LEMON -namespace lemon { - - // @defgroup empty_graph The EdgePathGraph class - // @{ - - /// A graph class in that a simple edge can represent a path. - - /// This class provides all the common features of a graph structure - /// that represents a network. You can handle with it layers. This - /// means that an edge in one layer can be a complete path in a nother - /// layer. - - template - class EdgePathGraph - { - - public: - - /// The actual layer - Gact actuallayer; - - - /// The layer on which the edges in this layer can represent paths. - Gsub * sublayer; - - - /// Map of nodes that represent the nodes of this layer in the sublayer - typename Gact::template NodeMap projection; - - - /// Map of routes that are represented by some edges in this layer - typename Gact::template EdgeMap

edgepath; - - - /// Defalult constructor. - /// We don't need any extra lines, because the actuallayer - /// variable has run its constructor, when we have created this class - /// So only the two maps has to be initialised here. - EdgePathGraph() : projection(actuallayer), edgepath(actuallayer) - { - } - - - ///Copy consructor. - EdgePathGraph(const EdgePathGraph & EPG ) : actuallayer(EPG.actuallayer) , edgepath(actuallayer), projection(actuallayer) - { - } - - - /// Map adder - - /// This function gets two edgemaps. One belongs to the actual layer and the - /// other belongs to the sublayer. - /// The function iterates through all of the edges in the edgemap belonging to the actual layer. - /// It gets the value that belongs to the actual edge, and adds it to the value of each edge in the - /// path represented by itself in the edgemap that belongs to the sublayer. - - template void addMap (typename Gact::EdgeMap & actmap, typename Gsub::EdgeMap & submap) - { - for(EdgeIt e(actuallayer);actuallayer.valid(e);actuallayer.next(e)) - { - typedef typename P::EdgeIt PEdgeIt; - PEdgeIt f; - - //dep//cout << "Edge " << id(source(e)) << " - " << id(target(e)) << " in actual layer is"; - T1 incr=actmap[e]; - //cout << incr << endl; - - if(edgepath[e]) - { - //dep//cout << endl << "Path"; - for(edgepath[e]->first(f); edgepath[e]->valid(f); edgepath[e]->next(f)) - { - //dep//cout << " " << sublayer->id(sublayer->source(f)) << "-" << sublayer->id(sublayer->target(f)); - submap[f]+=incr; - } - //dep////cout << EPGr2.id(EPGr2.target(f)) << endl; - //dep//cout << endl; - } - else - { - //dep//cout << " itself." <first(f); edgepath[e]->valid(f); edgepath[e]->next(f)) - { - cout << " " << sublayer->id(sublayer->source(f)) << "-" << sublayer->id(sublayer->target(f)); - } - //cout << EPGr2.id(EPGr2.target(f)) << endl; - cout << endl; - } - else - { - cout << " itself." <) - /// needs extra attention! - - template class NodeMap - { - public: - typedef T Value; - typedef Node Key; - - NodeMap(const EdgePathGraph &) {} - NodeMap(const EdgePathGraph &, T) {} - - template NodeMap(const NodeMap &) {} - - /// Sets the value of a node. - - /// Sets the value associated with node \c i to the value \c t. - /// - void set(Node, T) {} - // Gets the value of a node. - //T get(Node i) const {return *(T*)0;} //FIXME: Is it necessary? - T &operator[](Node) {return *(T*)0;} - const T &operator[](Node) const {return *(T*)0;} - - /// Updates the map if the graph has been changed - - /// \todo Do we need this? - /// - void update() {} - void update(T a) {} //FIXME: Is it necessary - }; - - ///Read/write/reference map of the edges to type \c T. - - ///Read/write/reference map of the edges to type \c T. - ///It behaves exactly in the same way as \ref NodeMap. - /// \sa NodeMap - /// \sa MemoryMap - /// \todo We may need copy constructor - /// \todo We may need conversion from other edgetype - /// \todo We may need operator= - template class EdgeMap - { - public: - typedef T Value; - typedef Edge Key; - - EdgeMap(const EdgePathGraph &) {} - EdgeMap(const EdgePathGraph &, T ) {} - - ///\todo It can copy between different types. - /// - template EdgeMap(const EdgeMap &) {} - - void set(Edge, T) {} - //T get(Edge) const {return *(T*)0;} - T &operator[](Edge) {return *(T*)0;} - const T &operator[](Edge) const {return *(T*)0;} - - void update() {} - void update(T a) {} //FIXME: Is it necessary - }; - }; - - /// An empty erasable graph class. - - /// This class provides all the common features of an \e erasable graph - /// structure, - /// however completely without implementations and real data structures - /// behind the interface. - /// All graph algorithms should compile with this class, but it will not - /// run properly, of course. - /// - /// \todo This blabla could be replaced by a sepatate description about - /// s. - /// - /// It can be used for checking the interface compatibility, - /// or it can serve as a skeleton of a new graph structure. - /// - /// Also, you will find here the full documentation of a certain graph - /// feature, the documentation of a real graph imlementation - /// like @ref ListGraph or - /// @ref SmartGraph will just refer to this structure. - template - class ErasableEdgePathGraph : public EdgePathGraph - { - public: - /// Deletes a node. - void erase(typename Gact::Node n) {actuallayer.erase(n);} - /// Deletes an edge. - void erase(typename Gact::Edge e) {actuallayer.erase(e);} - - /// Defalult constructor. - ErasableEdgePathGraph() {} - ///Copy consructor. - ErasableEdgePathGraph(const EdgePathGraph &EPG) {} - }; - - - // @} - -} //namespace lemon - - -#endif // LEMON_SKELETON_GRAPH_H