# HG changeset patch # User klao # Date 1138290133 0 # Node ID 2d806130e7008e9cfba7e7e6f05e645214529b6d # Parent e225719bde6b5631ea2c1e90268a4c42107e2bab Undir -> U transition diff -r e225719bde6b -r 2d806130e700 demo/coloring.cc --- a/demo/coloring.cc Thu Jan 26 06:44:22 2006 +0000 +++ b/demo/coloring.cc Thu Jan 26 15:42:13 2006 +0000 @@ -40,10 +40,10 @@ int main() { - typedef UndirSmartGraph Graph; + typedef SmartUGraph Graph; typedef Graph::Node Node; typedef Graph::NodeIt NodeIt; - typedef Graph::UndirEdge UndirEdge; + typedef Graph::UEdge UEdge; typedef Graph::IncEdgeIt IncEdgeIt; std::cout << "Six coloring of a plan graph" << std::endl; @@ -52,7 +52,7 @@ Graph graph; - UndirGraphReader reader("coloring.lgf", graph); + UGraphReader reader("coloring.lgf", graph); Graph::NodeMap > coords(graph); reader.readNodeMap("coords", coords); diff -r e225719bde6b -r 2d806130e700 demo/coloring.lgf --- a/demo/coloring.lgf Thu Jan 26 06:44:22 2006 +0000 +++ b/demo/coloring.lgf Thu Jan 26 15:42:13 2006 +0000 @@ -11,7 +11,7 @@ (-327, 46) 2 (157, -150) 1 (-282, -149) 0 -@undiredgeset +@uedgeset label 9 10 17 1 9 15 diff -r e225719bde6b -r 2d806130e700 demo/partitions.lgf --- a/demo/partitions.lgf Thu Jan 26 06:44:22 2006 +0000 +++ b/demo/partitions.lgf Thu Jan 26 15:42:13 2006 +0000 @@ -23,7 +23,7 @@ -484.494 328.869 3 -607.82 -246.651 2 -274 -131 1 -@undiredgeset +@uedgeset label 12 23 15 13 23 14 diff -r e225719bde6b -r 2d806130e700 demo/topology_demo.cc --- a/demo/topology_demo.cc Thu Jan 26 06:44:22 2006 +0000 +++ b/demo/topology_demo.cc Thu Jan 26 15:42:13 2006 +0000 @@ -43,13 +43,13 @@ void drawConnectedComponents() { - typedef UndirListGraph Graph; + typedef ListUGraph Graph; typedef Graph::Node Node; Graph graph; Graph::NodeMap > coords(graph); - UndirGraphReader("undir_components.lgf", graph). + UGraphReader("u_components.lgf", graph). readNodeMap("coordinates_x", xMap(coords)). readNodeMap("coordinates_y", yMap(coords)). run(); @@ -59,7 +59,7 @@ Graph::NodeMap compMap(graph); connectedComponents(graph, compMap); - graphToEps(graph, "connected_components.eps").undir(). + graphToEps(graph, "connected_components.eps").u(). coords(coords).scaleToA4().enableParallel(). parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0). nodeColors(composeMap(colorSet, compMap)).run(); @@ -97,25 +97,25 @@ } void drawNodeBiconnectedComponents() { - typedef UndirListGraph Graph; + typedef ListUGraph Graph; typedef Graph::Node Node; - typedef Graph::UndirEdge UndirEdge; + typedef Graph::UEdge UEdge; Graph graph; Graph::NodeMap > coords(graph); - UndirGraphReader("undir_components.lgf", graph). + UGraphReader("u_components.lgf", graph). readNodeMap("coordinates_x", xMap(coords)). readNodeMap("coordinates_y", yMap(coords)). run(); ColorSet colorSet; - Graph::UndirEdgeMap compMap(graph); + Graph::UEdgeMap compMap(graph); Graph::NodeMap cutMap(graph); biNodeConnectedComponents(graph, compMap); biNodeConnectedCutNodes(graph, cutMap); - graphToEps(graph, "bi_node_connected_components.eps").undir(). + graphToEps(graph, "bi_node_connected_components.eps").u(). coords(coords).scaleToA4().enableParallel(). parEdgeDist(20.0).edgeWidthScale(5.0).nodeScale(20.0). edgeColors(composeMap(colorSet, compMap)). @@ -126,14 +126,14 @@ } void drawEdgeBiconnectedComponents() { - typedef UndirListGraph Graph; + typedef ListUGraph Graph; typedef Graph::Node Node; - typedef Graph::UndirEdge UndirEdge; + typedef Graph::UEdge UEdge; Graph graph; Graph::NodeMap > coords(graph); - UndirGraphReader("undir_components.lgf", graph). + UGraphReader("u_components.lgf", graph). readNodeMap("coordinates_x", xMap(coords)). readNodeMap("coordinates_y", yMap(coords)). run(); @@ -141,11 +141,11 @@ ColorSet colorSet; Graph::NodeMap compMap(graph); - Graph::UndirEdgeMap cutMap(graph); + Graph::UEdgeMap cutMap(graph); biEdgeConnectedComponents(graph, compMap); biEdgeConnectedCutEdges(graph, cutMap); - graphToEps(graph, "bi_edge_connected_components.eps").undir(). + graphToEps(graph, "bi_edge_connected_components.eps").u(). coords(coords).scaleToA4().enableParallel(). parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0). nodeColors(composeMap(colorSet, compMap)). @@ -155,14 +155,14 @@ } void drawBipartitePartitions() { - typedef UndirListGraph Graph; + typedef ListUGraph Graph; typedef Graph::Node Node; - typedef Graph::UndirEdge UndirEdge; + typedef Graph::UEdge UEdge; Graph graph; Graph::NodeMap > coords(graph); - UndirGraphReader("partitions.lgf", graph). + UGraphReader("partitions.lgf", graph). readNodeMap("coordinates_x", xMap(coords)). readNodeMap("coordinates_y", yMap(coords)). run(); @@ -172,7 +172,7 @@ Graph::NodeMap partMap(graph); bipartitePartitions(graph, partMap); - graphToEps(graph, "bipartite_partitions.eps").undir(). + graphToEps(graph, "bipartite_partitions.eps").u(). coords(coords).scaleToA4().enableParallel(). parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0). nodeColors(composeMap(functorMap(&color), partMap)).run(); diff -r e225719bde6b -r 2d806130e700 demo/undir_components.lgf --- a/demo/undir_components.lgf Thu Jan 26 06:44:22 2006 +0000 +++ b/demo/undir_components.lgf Thu Jan 26 15:42:13 2006 +0000 @@ -43,7 +43,7 @@ 924.667 409.347 31 -689.204 -237.261 32 -567.302 43.6423 33 -@undiredgeset +@uedgeset label 41 42 44 40 42 43 diff -r e225719bde6b -r 2d806130e700 doc/Makefile.am --- a/doc/Makefile.am Thu Jan 26 06:44:22 2006 +0000 +++ b/doc/Makefile.am Thu Jan 26 15:42:13 2006 +0000 @@ -19,7 +19,7 @@ named-param.dox \ namespaces.dox \ quicktour.dox \ - undir_graphs.dox + ugraphs.dox html/index.html: if test ${doxygen_found} = yes; then \ diff -r e225719bde6b -r 2d806130e700 doc/graph_io.dox --- a/doc/graph_io.dox Thu Jan 26 06:44:22 2006 +0000 +++ b/doc/graph_io.dox Thu Jan 26 15:42:13 2006 +0000 @@ -317,10 +317,10 @@ The specialization of writing is very similar to that of reading. -\section undir Undirected graphs +\section u Undirected graphs -In a file describing an undirected graph (undir graph, for short) you find an -\c undiredgeset section instead of the \c edgeset section. The first line of +In a file describing an undirected graph (ugraph, for short) you find an +\c uedgeset section instead of the \c edgeset section. The first line of the section describes the names of the maps on the undirected egdes and all next lines describe one undirected edge with the the incident nodes and the values of the map. @@ -330,21 +330,21 @@ then this will be read as a directed map. \code -@undiredgeset +@uedgeset label capacity +flow -flow 32 2 1 4.3 2.0 0.0 21 21 5 2.6 0.0 2.6 21 12 8 3.4 0.0 0.0 \endcode -The \c edges section is changed to \c undiredges section. This section +The \c edges section is changed to \c uedges section. This section describes labeled edges and undirected edges. The directed edge label should start with a \c '+' or a \c '-' prefix to decide the direction of the edge. \code -@undiredges -undiredge 1 +@uedges +uedge 1 +edge 5 -back 5 \endcode @@ -352,19 +352,19 @@ There are similar classes to the \ref lemon::GraphReader "GraphReader" and \ref lemon::GraphWriter "GraphWriter" which handle the undirected graphs. These classes are -the \ref lemon::UndirGraphReader "UndirGraphReader" -and \ref lemon::UndirGraphWriter "UndirGraphWriter". +the \ref lemon::UGraphReader "UGraphReader" +and \ref lemon::UGraphWriter "UGraphWriter". -The \ref lemon::UndirGraphReader::readUndirEdgeMap() "readUndirEdgeMap()" +The \ref lemon::UGraphReader::readUEdgeMap() "readUEdgeMap()" function reads an undirected map and the -\ref lemon::UndirGraphReader::readUndirEdge() "readUndirEdge()" +\ref lemon::UGraphReader::readUEdge() "readUEdge()" reads an undirected edge from the file, \code -reader.readUndirEdgeMap("capacity", capacityMap); +reader.readUEdgeMap("capacity", capacityMap); reader.readEdgeMap("flow", flowMap); ... -reader.readUndirEdge("undir_edge", undir_edge); +reader.readUEdge("u_edge", u_edge); reader.readEdge("edge", edge); \endcode @@ -439,17 +439,17 @@ shows the input with the \ref lemon::LemonReader "LemonReader" class: \code -UndirListGraph network; -UndirListGraph::UndirEdgeMap capacity; -ListEdgeSet traffic(network); -ListEdgeSet::EdgeMap request(network); +ListUGraph network; +ListUGraph::UEdgeMap capacity; +ListEdgeSet traffic(network); +ListEdgeSet::EdgeMap request(network); LemonReader reader(std::cin); -NodeSetReader nodesetReader(reader, network); -UndirEdgeSetReader - undirEdgesetReader(reader, network, nodesetReader); -undirEdgesetReader.readEdgeMap("capacity", capacity); -EdgeSetReader > +NodeSetReader nodesetReader(reader, network); +UEdgeSetReader + uEdgesetReader(reader, network, nodesetReader); +uEdgesetReader.readEdgeMap("capacity", capacity); +EdgeSetReader > edgesetReader(reader, traffic, nodesetReader, "traffic"); edgesetReader.readEdgeMap("request", request); @@ -457,22 +457,22 @@ \endcode Because both the \ref lemon::GraphReader "GraphReader" -and the \ref lemon::UndirGraphReader "UndirGraphReader" can be converted +and the \ref lemon::UGraphReader "UGraphReader" can be converted to \ref lemon::LemonReader "LemonReader" and it can resolve the label's of the items, the previous -result can be achived with the \ref lemon::UndirGraphReader "UndirGraphReader" +result can be achived with the \ref lemon::UGraphReader "UGraphReader" class, too. \code -UndirListGraph network; -UndirListGraph::UndirEdgeSet capacity; -ListEdgeSet traffic(network); -ListEdgeSet::EdgeMap request(network); +ListUGraph network; +ListUGraph::UEdgeSet capacity; +ListEdgeSet traffic(network); +ListEdgeSet::EdgeMap request(network); -UndirGraphReader reader(std::cin, network); +UGraphReader reader(std::cin, network); reader.readEdgeMap("capacity", capacity); -EdgeSetReader > +EdgeSetReader > edgesetReader(reader, traffic, reader, "traffic"); edgesetReader.readEdgeMap("request", request); diff -r e225719bde6b -r 2d806130e700 doc/undir_graphs.dox --- a/doc/undir_graphs.dox Thu Jan 26 06:44:22 2006 +0000 +++ b/doc/undir_graphs.dox Thu Jan 26 15:42:13 2006 +0000 @@ -1,6 +1,6 @@ /*! -\page undir_graphs Undirected graph structures +\page ugraphs Undirected graph structures The primary data structures of LEMON are the graph classes. diff -r e225719bde6b -r 2d806130e700 lemon/Makefile.am --- a/lemon/Makefile.am Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/Makefile.am Thu Jan 26 15:42:13 2006 +0000 @@ -90,7 +90,7 @@ bits/item_writer.h \ concept/graph.h \ concept/graph_component.h \ - concept/undir_graph.h \ + concept/ugraph.h \ concept/matrix_maps.h \ concept/maps.h \ concept/heap.h \ diff -r e225719bde6b -r 2d806130e700 lemon/bits/alteration_notifier.h --- a/lemon/bits/alteration_notifier.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/bits/alteration_notifier.h Thu Jan 26 15:42:13 2006 +0000 @@ -442,83 +442,83 @@ /// enable_if boost technique? template - class AlterableUndirGraphExtender + class AlterableUGraphExtender : public AlterableGraphExtender<_Base> { public: - typedef AlterableUndirGraphExtender Graph; + typedef AlterableUGraphExtender Graph; typedef AlterableGraphExtender<_Base> Parent; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; /// The edge observer registry. - typedef AlterationNotifier UndirEdgeNotifier; + typedef AlterationNotifier UEdgeNotifier; protected: - mutable UndirEdgeNotifier undir_edge_notifier; + mutable UEdgeNotifier u_edge_notifier; public: using Parent::getNotifier; - UndirEdgeNotifier& getNotifier(UndirEdge) const { - return undir_edge_notifier; + UEdgeNotifier& getNotifier(UEdge) const { + return u_edge_notifier; } - ~AlterableUndirGraphExtender() { - undir_edge_notifier.clear(); + ~AlterableUGraphExtender() { + u_edge_notifier.clear(); } }; template - class AlterableUndirEdgeSetExtender + class AlterableUEdgeSetExtender : public AlterableEdgeSetExtender<_Base> { public: - typedef AlterableUndirEdgeSetExtender Graph; + typedef AlterableUEdgeSetExtender Graph; typedef AlterableEdgeSetExtender<_Base> Parent; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; - typedef AlterationNotifier UndirEdgeNotifier; + typedef AlterationNotifier UEdgeNotifier; protected: - mutable UndirEdgeNotifier undir_edge_notifier; + mutable UEdgeNotifier u_edge_notifier; public: using Parent::getNotifier; - UndirEdgeNotifier& getNotifier(UndirEdge) const { - return undir_edge_notifier; + UEdgeNotifier& getNotifier(UEdge) const { + return u_edge_notifier; } - ~AlterableUndirEdgeSetExtender() { - undir_edge_notifier.clear(); + ~AlterableUEdgeSetExtender() { + u_edge_notifier.clear(); } }; template - class AlterableUndirBipartiteGraphExtender : public _Base { + class AlterableUBipartiteGraphExtender : public _Base { public: typedef _Base Parent; - typedef AlterableUndirBipartiteGraphExtender Graph; + typedef AlterableUBipartiteGraphExtender Graph; typedef typename Parent::Node Node; typedef typename Parent::LowerNode LowerNode; typedef typename Parent::UpperNode UpperNode; typedef typename Parent::Edge Edge; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; typedef AlterationNotifier NodeNotifier; typedef AlterationNotifier LowerNodeNotifier; typedef AlterationNotifier UpperNodeNotifier; typedef AlterationNotifier EdgeNotifier; - typedef AlterationNotifier UndirEdgeNotifier; + typedef AlterationNotifier UEdgeNotifier; protected: @@ -526,7 +526,7 @@ mutable LowerNodeNotifier lowerNodeNotifier; mutable UpperNodeNotifier upperNodeNotifier; mutable EdgeNotifier edgeNotifier; - mutable UndirEdgeNotifier undirEdgeNotifier; + mutable UEdgeNotifier uEdgeNotifier; public: @@ -546,16 +546,16 @@ return edgeNotifier; } - UndirEdgeNotifier& getNotifier(UndirEdge) const { - return undirEdgeNotifier; + UEdgeNotifier& getNotifier(UEdge) const { + return uEdgeNotifier; } - ~AlterableUndirBipartiteGraphExtender() { + ~AlterableUBipartiteGraphExtender() { nodeNotifier.clear(); lowerNodeNotifier.clear(); upperNodeNotifier.clear(); edgeNotifier.clear(); - undirEdgeNotifier.clear(); + uEdgeNotifier.clear(); } }; diff -r e225719bde6b -r 2d806130e700 lemon/bits/clearable_graph_extender.h --- a/lemon/bits/clearable_graph_extender.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/bits/clearable_graph_extender.h Thu Jan 26 15:42:13 2006 +0000 @@ -42,35 +42,35 @@ }; template - class ClearableUndirGraphExtender : public _Base { + class ClearableUGraphExtender : public _Base { public: - typedef ClearableUndirGraphExtender Graph; + typedef ClearableUGraphExtender Graph; typedef _Base Parent; typedef typename Parent::Node Node; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; typedef typename Parent::Edge Edge; void clear() { Parent::getNotifier(Node()).clear(); - Parent::getNotifier(UndirEdge()).clear(); + Parent::getNotifier(UEdge()).clear(); Parent::getNotifier(Edge()).clear(); Parent::clear(); } }; template - class ClearableUndirEdgeSetExtender : public _Base { + class ClearableUEdgeSetExtender : public _Base { public: - typedef ClearableUndirEdgeSetExtender Graph; + typedef ClearableUEdgeSetExtender Graph; typedef _Base Parent; typedef typename Parent::Node Node; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; typedef typename Parent::Edge Edge; void clear() { - Parent::getNotifier(UndirEdge()).clear(); + Parent::getNotifier(UEdge()).clear(); Parent::getNotifier(Edge()).clear(); Parent::clear(); } @@ -79,21 +79,21 @@ template - class ClearableUndirBipartiteGraphExtender : public _Base { + class ClearableUBipartiteGraphExtender : public _Base { public: typedef _Base Parent; - typedef ClearableUndirBipartiteGraphExtender Graph; + typedef ClearableUBipartiteGraphExtender Graph; typedef typename Parent::Node Node; typedef typename Parent::LowerNode LowerNode; typedef typename Parent::UpperNode UpperNode; typedef typename Parent::Edge Edge; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; void clear() { Parent::getNotifier(Edge()).clear(); - Parent::getNotifier(UndirEdge()).clear(); + Parent::getNotifier(UEdge()).clear(); Parent::getNotifier(Node()).clear(); Parent::getNotifier(LowerNode()).clear(); Parent::getNotifier(UpperNode()).clear(); diff -r e225719bde6b -r 2d806130e700 lemon/bits/default_map.h --- a/lemon/bits/default_map.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/bits/default_map.h Thu Jan 26 15:42:13 2006 +0000 @@ -266,37 +266,37 @@ /// \e template - class MappableUndirGraphExtender : + class MappableUGraphExtender : public MappableGraphExtender<_Base> { public: - typedef MappableUndirGraphExtender Graph; + typedef MappableUGraphExtender Graph; typedef MappableGraphExtender<_Base> Parent; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; template - class UndirEdgeMap - : public IterableMapExtender > { + class UEdgeMap + : public IterableMapExtender > { public: - typedef MappableUndirGraphExtender Graph; + typedef MappableUGraphExtender Graph; typedef IterableMapExtender< - DefaultMap > Parent; + DefaultMap > Parent; - UndirEdgeMap(const Graph& _g) + UEdgeMap(const Graph& _g) : Parent(_g) {} - UndirEdgeMap(const Graph& _g, const _Value& _v) + UEdgeMap(const Graph& _g, const _Value& _v) : Parent(_g, _v) {} - UndirEdgeMap& operator=(const UndirEdgeMap& cmap) { - return operator=(cmap); + UEdgeMap& operator=(const UEdgeMap& cmap) { + return operator=(cmap); } template - UndirEdgeMap& operator=(const CMap& cmap) { - checkConcept, CMap>(); + UEdgeMap& operator=(const CMap& cmap) { + checkConcept, CMap>(); const typename Parent::Graph* graph = Parent::getGraph(); - UndirEdge it; + UEdge it; for (graph->first(it); it != INVALID; graph->next(it)) { Parent::set(it, cmap[it]); } @@ -309,37 +309,37 @@ /// \e template - class MappableUndirEdgeSetExtender : + class MappableUEdgeSetExtender : public MappableEdgeSetExtender<_Base> { public: - typedef MappableUndirEdgeSetExtender Graph; + typedef MappableUEdgeSetExtender Graph; typedef MappableEdgeSetExtender<_Base> Parent; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; template - class UndirEdgeMap - : public IterableMapExtender > { + class UEdgeMap + : public IterableMapExtender > { public: - typedef MappableUndirEdgeSetExtender Graph; + typedef MappableUEdgeSetExtender Graph; typedef IterableMapExtender< - DefaultMap > Parent; + DefaultMap > Parent; - UndirEdgeMap(const Graph& _g) + UEdgeMap(const Graph& _g) : Parent(_g) {} - UndirEdgeMap(const Graph& _g, const _Value& _v) + UEdgeMap(const Graph& _g, const _Value& _v) : Parent(_g, _v) {} - UndirEdgeMap& operator=(const UndirEdgeMap& cmap) { - return operator=(cmap); + UEdgeMap& operator=(const UEdgeMap& cmap) { + return operator=(cmap); } template - UndirEdgeMap& operator=(const CMap& cmap) { - checkConcept, CMap>(); + UEdgeMap& operator=(const CMap& cmap) { + checkConcept, CMap>(); const typename Parent::Graph* graph = Parent::getGraph(); - UndirEdge it; + UEdge it; for (graph->first(it); it != INVALID; graph->next(it)) { Parent::set(it, cmap[it]); } @@ -352,23 +352,23 @@ template - class MappableUndirBipartiteGraphExtender : public _Base { + class MappableUBipartiteGraphExtender : public _Base { public: typedef _Base Parent; - typedef MappableUndirBipartiteGraphExtender Graph; + typedef MappableUBipartiteGraphExtender Graph; typedef typename Parent::Node Node; typedef typename Parent::UpperNode UpperNode; typedef typename Parent::LowerNode LowerNode; typedef typename Parent::Edge Edge; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; template class UpperNodeMap : public IterableMapExtender > { public: - typedef MappableUndirBipartiteGraphExtender Graph; + typedef MappableUBipartiteGraphExtender Graph; typedef IterableMapExtender > Parent; @@ -405,7 +405,7 @@ class LowerNodeMap : public IterableMapExtender > { public: - typedef MappableUndirBipartiteGraphExtender Graph; + typedef MappableUBipartiteGraphExtender Graph; typedef IterableMapExtender > Parent; @@ -443,7 +443,7 @@ template class NodeMapBase : public Parent::NodeNotifier::ObserverBase { public: - typedef MappableUndirBipartiteGraphExtender Graph; + typedef MappableUBipartiteGraphExtender Graph; typedef Node Key; typedef _Value Value; @@ -523,7 +523,7 @@ class NodeMap : public IterableMapExtender > { public: - typedef MappableUndirBipartiteGraphExtender Graph; + typedef MappableUBipartiteGraphExtender Graph; typedef IterableMapExtender< NodeMapBase<_Value> > Parent; NodeMap(const Graph& _g) @@ -561,7 +561,7 @@ class EdgeMap : public IterableMapExtender > { public: - typedef MappableUndirBipartiteGraphExtender Graph; + typedef MappableUBipartiteGraphExtender Graph; typedef IterableMapExtender > Parent; EdgeMap(const Graph& _g) @@ -586,27 +586,27 @@ }; template - class UndirEdgeMap - : public IterableMapExtender > { + class UEdgeMap + : public IterableMapExtender > { public: - typedef MappableUndirBipartiteGraphExtender Graph; - typedef IterableMapExtender > + typedef MappableUBipartiteGraphExtender Graph; + typedef IterableMapExtender > Parent; - UndirEdgeMap(const Graph& _g) + UEdgeMap(const Graph& _g) : Parent(_g) {} - UndirEdgeMap(const Graph& _g, const _Value& _v) + UEdgeMap(const Graph& _g, const _Value& _v) : Parent(_g, _v) {} - UndirEdgeMap& operator=(const UndirEdgeMap& cmap) { - return operator=(cmap); + UEdgeMap& operator=(const UEdgeMap& cmap) { + return operator=(cmap); } template - UndirEdgeMap& operator=(const CMap& cmap) { - checkConcept, CMap>(); + UEdgeMap& operator=(const CMap& cmap) { + checkConcept, CMap>(); const typename Parent::Graph* graph = Parent::getGraph(); - UndirEdge it; + UEdge it; for (graph->first(it); it != INVALID; graph->next(it)) { Parent::set(it, cmap[it]); } diff -r e225719bde6b -r 2d806130e700 lemon/bits/erasable_graph_extender.h --- a/lemon/bits/erasable_graph_extender.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/bits/erasable_graph_extender.h Thu Jan 26 15:42:13 2006 +0000 @@ -62,14 +62,14 @@ }; template - class ErasableUndirGraphExtender : public _Base { + class ErasableUGraphExtender : public _Base { public: - typedef ErasableUndirGraphExtender Graph; + typedef ErasableUGraphExtender Graph; typedef _Base Parent; typedef typename Parent::Node Node; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; typedef typename Parent::Edge Edge; void erase(const Node& node) { @@ -84,34 +84,34 @@ Parent::erase(node); } - void erase(const UndirEdge& uedge) { + void erase(const UEdge& uedge) { std::vector edges; edges.push_back(Parent::direct(uedge,true)); edges.push_back(Parent::direct(uedge,false)); Parent::getNotifier(Edge()).erase(edges); - Parent::getNotifier(UndirEdge()).erase(uedge); + Parent::getNotifier(UEdge()).erase(uedge); Parent::erase(uedge); } }; template - class ErasableUndirEdgeSetExtender : public _Base { + class ErasableUEdgeSetExtender : public _Base { public: - typedef ErasableUndirEdgeSetExtender Graph; + typedef ErasableUEdgeSetExtender Graph; typedef _Base Parent; typedef typename Parent::Node Node; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; typedef typename Parent::Edge Edge; - void erase(const UndirEdge& uedge) { + void erase(const UEdge& uedge) { std::vector edges; edges.push_back(Parent::direct(uedge,true)); edges.push_back(Parent::direct(uedge,false)); Parent::getNotifier(Edge()).erase(edges); - Parent::getNotifier(UndirEdge()).erase(uedge); + Parent::getNotifier(UEdge()).erase(uedge); Parent::erase(uedge); } diff -r e225719bde6b -r 2d806130e700 lemon/bits/extendable_graph_extender.h --- a/lemon/bits/extendable_graph_extender.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/bits/extendable_graph_extender.h Thu Jan 26 15:42:13 2006 +0000 @@ -48,15 +48,15 @@ }; template - class ExtendableUndirGraphExtender : public _Base { + class ExtendableUGraphExtender : public _Base { public: - typedef ExtendableUndirGraphExtender Graph; + typedef ExtendableUGraphExtender Graph; typedef _Base Parent; typedef typename Parent::Node Node; typedef typename Parent::Edge Edge; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; Node addNode() { Node node = Parent::addNode(); @@ -64,9 +64,9 @@ return node; } - UndirEdge addEdge(const Node& from, const Node& to) { - UndirEdge uedge = Parent::addEdge(from, to); - Parent::getNotifier(UndirEdge()).add(uedge); + UEdge addEdge(const Node& from, const Node& to) { + UEdge uedge = Parent::addEdge(from, to); + Parent::getNotifier(UEdge()).add(uedge); std::vector edges; edges.push_back(Parent::direct(uedge, true)); @@ -79,19 +79,19 @@ }; template - class ExtendableUndirEdgeSetExtender : public _Base { + class ExtendableUEdgeSetExtender : public _Base { public: - typedef ExtendableUndirEdgeSetExtender Graph; + typedef ExtendableUEdgeSetExtender Graph; typedef _Base Parent; typedef typename Parent::Node Node; typedef typename Parent::Edge Edge; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; - UndirEdge addEdge(const Node& from, const Node& to) { - UndirEdge uedge = Parent::addEdge(from, to); - Parent::getNotifier(UndirEdge()).add(uedge); + UEdge addEdge(const Node& from, const Node& to) { + UEdge uedge = Parent::addEdge(from, to); + Parent::getNotifier(UEdge()).add(uedge); std::vector edges; edges.push_back(Parent::direct(uedge, true)); @@ -105,17 +105,17 @@ template - class ExtendableUndirBipartiteGraphExtender : public _Base { + class ExtendableUBipartiteGraphExtender : public _Base { public: typedef _Base Parent; - typedef ExtendableUndirBipartiteGraphExtender Graph; + typedef ExtendableUBipartiteGraphExtender Graph; typedef typename Parent::Node Node; typedef typename Parent::LowerNode LowerNode; typedef typename Parent::UpperNode UpperNode; typedef typename Parent::Edge Edge; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; Node addUpperNode() { Node node = Parent::addUpperNode(); @@ -131,16 +131,16 @@ return node; } - UndirEdge addEdge(const Node& source, const Node& target) { - UndirEdge undiredge = Parent::addEdge(source, target); - Parent::getNotifier(UndirEdge()).add(undiredge); + UEdge addEdge(const Node& source, const Node& target) { + UEdge uedge = Parent::addEdge(source, target); + Parent::getNotifier(UEdge()).add(uedge); std::vector edges; - edges.push_back(Parent::direct(undiredge, true)); - edges.push_back(Parent::direct(undiredge, false)); + edges.push_back(Parent::direct(uedge, true)); + edges.push_back(Parent::direct(uedge, false)); Parent::getNotifier(Edge()).add(edges); - return undiredge; + return uedge; } }; diff -r e225719bde6b -r 2d806130e700 lemon/bits/graph_extender.h --- a/lemon/bits/graph_extender.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/bits/graph_extender.h Thu Jan 26 15:42:13 2006 +0000 @@ -61,41 +61,41 @@ }; template - class UndirGraphExtender : public _Base { + class UGraphExtender : public _Base { typedef _Base Parent; - typedef UndirGraphExtender Graph; + typedef UGraphExtender Graph; public: - typedef typename Parent::Edge UndirEdge; + typedef typename Parent::Edge UEdge; typedef typename Parent::Node Node; - class Edge : public UndirEdge { - friend class UndirGraphExtender; + class Edge : public UEdge { + friend class UGraphExtender; protected: // FIXME: Marci use opposite logic in his graph adaptors. It would // be reasonable to syncronize... bool forward; - Edge(const UndirEdge &ue, bool _forward) : - UndirEdge(ue), forward(_forward) {} + Edge(const UEdge &ue, bool _forward) : + UEdge(ue), forward(_forward) {} public: Edge() {} /// Invalid edge constructor - Edge(Invalid i) : UndirEdge(i), forward(true) {} + Edge(Invalid i) : UEdge(i), forward(true) {} bool operator==(const Edge &that) const { - return forward==that.forward && UndirEdge(*this)==UndirEdge(that); + return forward==that.forward && UEdge(*this)==UEdge(that); } bool operator!=(const Edge &that) const { - return forward!=that.forward || UndirEdge(*this)!=UndirEdge(that); + return forward!=that.forward || UEdge(*this)!=UEdge(that); } bool operator<(const Edge &that) const { return forward> 1), bool(id & 1)); } - UndirEdge undirEdgeFromId(int id) const { + UEdge uEdgeFromId(int id) const { return Parent::edgeFromId(id >> 1); } @@ -334,42 +334,42 @@ return edgeFromId(id); } - UndirEdge fromId(int id, UndirEdge) const { - return undirEdgeFromId(id); + UEdge fromId(int id, UEdge) const { + return uEdgeFromId(id); } Edge findEdge(Node source, Node target, Edge prev) const { if (prev == INVALID) { - UndirEdge edge = Parent::findEdge(source, target); + UEdge edge = Parent::findEdge(source, target); if (edge != INVALID) return direct(edge, true); edge = Parent::findEdge(target, source); if (edge != INVALID) return direct(edge, false); } else if (direction(prev)) { - UndirEdge edge = Parent::findEdge(source, target, prev); + UEdge edge = Parent::findEdge(source, target, prev); if (edge != INVALID) return direct(edge, true); edge = Parent::findEdge(target, source); if (edge != INVALID) return direct(edge, false); } else { - UndirEdge edge = Parent::findEdge(target, source, prev); + UEdge edge = Parent::findEdge(target, source, prev); if (edge != INVALID) return direct(edge, false); } return INVALID; } - UndirEdge findUndirEdge(Node source, Node target, UndirEdge prev) const { + UEdge findUEdge(Node source, Node target, UEdge prev) const { if (prev == INVALID) { - UndirEdge edge = Parent::findEdge(source, target); + UEdge edge = Parent::findEdge(source, target); if (edge != INVALID) return edge; edge = Parent::findEdge(target, source); if (edge != INVALID) return edge; } else if (Parent::source(prev) == source) { - UndirEdge edge = Parent::findEdge(source, target, prev); + UEdge edge = Parent::findEdge(source, target, prev); if (edge != INVALID) return edge; edge = Parent::findEdge(target, source); if (edge != INVALID) return edge; } else { - UndirEdge edge = Parent::findEdge(target, source, prev); + UEdge edge = Parent::findEdge(target, source, prev); if (edge != INVALID) return edge; } return INVALID; @@ -379,36 +379,36 @@ template - class UndirBipartiteGraphExtender : public _Base { + class UBipartiteGraphExtender : public _Base { public: typedef _Base Parent; - typedef UndirBipartiteGraphExtender Graph; + typedef UBipartiteGraphExtender Graph; typedef typename Parent::Node Node; - typedef typename Parent::Edge UndirEdge; + typedef typename Parent::Edge UEdge; using Parent::first; using Parent::next; using Parent::id; - Node source(const UndirEdge& edge) const { + Node source(const UEdge& edge) const { return upperNode(edge); } - Node target(const UndirEdge& edge) const { + Node target(const UEdge& edge) const { return lowerNode(edge); } - void firstInc(UndirEdge& edge, bool& direction, const Node& node) const { + void firstInc(UEdge& edge, bool& direction, const Node& node) const { if (Parent::upper(node)) { Parent::firstDown(edge, node); direction = true; } else { Parent::firstUp(edge, node); - direction = static_cast(edge) == INVALID; + direction = static_cast(edge) == INVALID; } } - void nextInc(UndirEdge& edge, bool& direction) const { + void nextInc(UEdge& edge, bool& direction) const { if (direction) { Parent::nextDown(edge); } else { @@ -417,45 +417,45 @@ } } - int maxUndirEdgeId() const { + int maxUEdgeId() const { return Parent::maxEdgeId(); } - UndirEdge undirEdgeFromId(int id) const { + UEdge uEdgeFromId(int id) const { return Parent::edgeFromId(id); } - class Edge : public UndirEdge { - friend class UndirBipartiteGraphExtender; + class Edge : public UEdge { + friend class UBipartiteGraphExtender; protected: bool forward; - Edge(const UndirEdge& edge, bool _forward) - : UndirEdge(edge), forward(_forward) {} + Edge(const UEdge& edge, bool _forward) + : UEdge(edge), forward(_forward) {} public: Edge() {} - Edge (Invalid) : UndirEdge(INVALID), forward(true) {} + Edge (Invalid) : UEdge(INVALID), forward(true) {} bool operator==(const Edge& i) const { - return UndirEdge::operator==(i) && forward == i.forward; + return UEdge::operator==(i) && forward == i.forward; } bool operator!=(const Edge& i) const { - return UndirEdge::operator!=(i) || forward != i.forward; + return UEdge::operator!=(i) || forward != i.forward; } bool operator<(const Edge& i) const { - return UndirEdge::operator<(i) || - (!(i.forward(edge)); + Parent::first(static_cast(edge)); edge.forward = true; } void next(Edge& edge) const { if (!edge.forward) { - Parent::next(static_cast(edge)); + Parent::next(static_cast(edge)); } edge.forward = !edge.forward; } @@ -466,7 +466,7 @@ edge.forward = true; } else { Parent::firstUp(edge, node); - edge.forward = static_cast(edge) == INVALID; + edge.forward = static_cast(edge) == INVALID; } } void nextOut(Edge& edge) const { @@ -474,7 +474,7 @@ Parent::nextDown(edge); } else { Parent::nextUp(edge); - edge.forward = static_cast(edge) == INVALID; + edge.forward = static_cast(edge) == INVALID; } } @@ -484,7 +484,7 @@ edge.forward = true; } else { Parent::firstDown(edge, node); - edge.forward = static_cast(edge) == INVALID; + edge.forward = static_cast(edge) == INVALID; } } void nextIn(Edge& edge) const { @@ -492,7 +492,7 @@ Parent::nextUp(edge); } else { Parent::nextDown(edge); - edge.forward = static_cast(edge) == INVALID; + edge.forward = static_cast(edge) == INVALID; } } @@ -507,15 +507,15 @@ return edge.forward; } - Edge direct(const UndirEdge& edge, const Node& node) const { + Edge direct(const UEdge& edge, const Node& node) const { return Edge(edge, node == Parent::source(edge)); } - Edge direct(const UndirEdge& edge, bool direction) const { + Edge direct(const UEdge& edge, bool direction) const { return Edge(edge, direction); } - Node oppositeNode(const UndirEdge& edge, const Node& node) const { + Node oppositeNode(const UEdge& edge, const Node& node) const { return source(edge) == node ? target(edge) : source(edge); } @@ -528,14 +528,14 @@ return (Parent::id(edge) << 1) + (edge.forward ? 0 : 1); } Edge edgeFromId(int id) const { - return Edge(Parent::fromId(id >> 1, UndirEdge()), (id & 1) == 0); + return Edge(Parent::fromId(id >> 1, UEdge()), (id & 1) == 0); } int maxEdgeId() const { - return (Parent::maxId(UndirEdge()) << 1) + 1; + return (Parent::maxId(UEdge()) << 1) + 1; } class UpperNode : public Node { - friend class UndirBipartiteGraphExtender; + friend class UBipartiteGraphExtender; public: UpperNode() {} UpperNode(const Node& node) : Node(node) { @@ -557,7 +557,7 @@ } class LowerNode : public Node { - friend class UndirBipartiteGraphExtender; + friend class UBipartiteGraphExtender; public: LowerNode() {} LowerNode(const Node& node) : Node(node) { @@ -592,8 +592,8 @@ int maxId(Edge) const { return maxEdgeId(); } - int maxId(UndirEdge) const { - return maxUndirEdgeId(); + int maxId(UEdge) const { + return maxUEdgeId(); } @@ -609,8 +609,8 @@ Edge fromId(int id, Edge) const { return edgeFromId(id); } - UndirEdge fromId(int id, UndirEdge) const { - return undirEdgeFromId(id); + UEdge fromId(int id, UEdge) const { + return uEdgeFromId(id); } }; diff -r e225719bde6b -r 2d806130e700 lemon/bits/iterable_graph_extender.h --- a/lemon/bits/iterable_graph_extender.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/bits/iterable_graph_extender.h Thu Jan 26 15:42:13 2006 +0000 @@ -16,7 +16,7 @@ ///\todo Better name? /// ///\bug Should it be here? - typedef False UndirTag; + typedef False UTag; typedef _Base Parent; typedef IterableGraphExtender<_Base> Graph; @@ -174,7 +174,7 @@ template - class IterableUndirGraphExtender : public IterableGraphExtender<_Base> { + class IterableUGraphExtender : public IterableGraphExtender<_Base> { public: /// Indicates that the graph is undirected. @@ -184,52 +184,52 @@ ///\bug Should it be here? ///\bug Should be tested in the concept checker whether it is defined ///correctly. - typedef True UndirTag; + typedef True UTag; typedef IterableGraphExtender<_Base> Parent; - typedef IterableUndirGraphExtender<_Base> Graph; + typedef IterableUGraphExtender<_Base> Graph; typedef typename Parent::Node Node; typedef typename Parent::Edge Edge; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; - class UndirEdgeIt : public Parent::UndirEdge { + class UEdgeIt : public Parent::UEdge { const Graph* graph; public: - UndirEdgeIt() { } + UEdgeIt() { } - UndirEdgeIt(Invalid i) : UndirEdge(i) { } + UEdgeIt(Invalid i) : UEdge(i) { } - explicit UndirEdgeIt(const Graph& _graph) : graph(&_graph) { - _graph.first(*static_cast(this)); + explicit UEdgeIt(const Graph& _graph) : graph(&_graph) { + _graph.first(*static_cast(this)); } - UndirEdgeIt(const Graph& _graph, const UndirEdge& e) : - UndirEdge(e), graph(&_graph) { } + UEdgeIt(const Graph& _graph, const UEdge& e) : + UEdge(e), graph(&_graph) { } - UndirEdgeIt& operator++() { + UEdgeIt& operator++() { graph->next(*this); return *this; } }; - class IncEdgeIt : public Parent::UndirEdge { + class IncEdgeIt : public Parent::UEdge { const Graph* graph; bool direction; - friend class IterableUndirGraphExtender; + friend class IterableUGraphExtender; public: IncEdgeIt() { } - IncEdgeIt(Invalid i) : UndirEdge(i), direction(false) { } + IncEdgeIt(Invalid i) : UEdge(i), direction(false) { } IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) { _graph.firstInc(*this, direction, n); } - IncEdgeIt(const Graph& _graph, const UndirEdge &ue, const Node &n) - : graph(&_graph), UndirEdge(ue) { + IncEdgeIt(const Graph& _graph, const UEdge &ue, const Node &n) + : graph(&_graph), UEdge(ue) { direction = (_graph.source(ue) == n); } @@ -258,7 +258,7 @@ /// \brief The opposite node on the given undirected edge. /// /// Gives back the opposite on the given undirected edge. - Node oppositeNode(const Node& n, const UndirEdge& e) const { + Node oppositeNode(const Node& n, const UEdge& e) const { if (Parent::source(e) == n) { return Parent::target(e); } else { @@ -270,16 +270,16 @@ template - class IterableUndirBipartiteGraphExtender : public _Base { + class IterableUBipartiteGraphExtender : public _Base { public: typedef _Base Parent; - typedef IterableUndirBipartiteGraphExtender Graph; + typedef IterableUBipartiteGraphExtender Graph; typedef typename Parent::Node Node; typedef typename Parent::UpperNode UpperNode; typedef typename Parent::LowerNode LowerNode; typedef typename Parent::Edge Edge; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; class NodeIt : public Node { const Graph* graph; @@ -304,7 +304,7 @@ }; class UpperNodeIt : public Node { - friend class IterableUndirBipartiteGraphExtender; + friend class IterableUBipartiteGraphExtender; const Graph* graph; public: @@ -326,7 +326,7 @@ }; class LowerNodeIt : public Node { - friend class IterableUndirBipartiteGraphExtender; + friend class IterableUBipartiteGraphExtender; const Graph* graph; public: @@ -348,7 +348,7 @@ }; class EdgeIt : public Edge { - friend class IterableUndirBipartiteGraphExtender; + friend class IterableUBipartiteGraphExtender; const Graph* graph; public: @@ -370,30 +370,30 @@ }; - class UndirEdgeIt : public UndirEdge { - friend class IterableUndirBipartiteGraphExtender; + class UEdgeIt : public UEdge { + friend class IterableUBipartiteGraphExtender; const Graph* graph; public: - UndirEdgeIt() { } + UEdgeIt() { } - UndirEdgeIt(Invalid i) : UndirEdge(INVALID) { } + UEdgeIt(Invalid i) : UEdge(INVALID) { } - explicit UndirEdgeIt(const Graph& _graph) : graph(&_graph) { - graph->first(static_cast(*this)); + explicit UEdgeIt(const Graph& _graph) : graph(&_graph) { + graph->first(static_cast(*this)); } - UndirEdgeIt(const Graph& _graph, const UndirEdge& edge) - : UndirEdge(edge), graph(&_graph) { } + UEdgeIt(const Graph& _graph, const UEdge& edge) + : UEdge(edge), graph(&_graph) { } - UndirEdgeIt& operator++() { + UEdgeIt& operator++() { graph->next(*this); return *this; } }; class OutEdgeIt : public Edge { - friend class IterableUndirBipartiteGraphExtender; + friend class IterableUBipartiteGraphExtender; const Graph* graph; public: @@ -418,7 +418,7 @@ class InEdgeIt : public Edge { - friend class IterableUndirBipartiteGraphExtender; + friend class IterableUBipartiteGraphExtender; const Graph* graph; public: @@ -469,22 +469,22 @@ return Parent::source((Edge&)e); } - class IncEdgeIt : public Parent::UndirEdge { - friend class IterableUndirBipartiteGraphExtender; + class IncEdgeIt : public Parent::UEdge { + friend class IterableUBipartiteGraphExtender; const Graph* graph; bool direction; public: IncEdgeIt() { } - IncEdgeIt(Invalid i) : UndirEdge(i), direction(true) { } + IncEdgeIt(Invalid i) : UEdge(i), direction(true) { } IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) { graph->firstInc(*this, direction, n); } - IncEdgeIt(const Graph& _graph, const UndirEdge &ue, const Node &n) - : graph(&_graph), UndirEdge(ue) { + IncEdgeIt(const Graph& _graph, const UEdge &ue, const Node &n) + : graph(&_graph), UEdge(ue) { direction = (graph->source(ue) == n); } diff -r e225719bde6b -r 2d806130e700 lemon/bits/static_map.h --- a/lemon/bits/static_map.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/bits/static_map.h Thu Jan 26 15:42:13 2006 +0000 @@ -305,37 +305,37 @@ /// \e template - class StaticMappableUndirGraphExtender : + class StaticMappableUGraphExtender : public StaticMappableGraphExtender<_Base> { public: - typedef StaticMappableUndirGraphExtender Graph; + typedef StaticMappableUGraphExtender Graph; typedef StaticMappableGraphExtender<_Base> Parent; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; template - class UndirEdgeMap - : public IterableMapExtender > { + class UEdgeMap + : public IterableMapExtender > { public: - typedef StaticMappableUndirGraphExtender Graph; + typedef StaticMappableUGraphExtender Graph; typedef IterableMapExtender< - StaticMap > Parent; + StaticMap > Parent; - UndirEdgeMap(const Graph& _g) + UEdgeMap(const Graph& _g) : Parent(_g) {} - UndirEdgeMap(const Graph& _g, const _Value& _v) + UEdgeMap(const Graph& _g, const _Value& _v) : Parent(_g, _v) {} - UndirEdgeMap& operator=(const UndirEdgeMap& cmap) { - return operator=(cmap); + UEdgeMap& operator=(const UEdgeMap& cmap) { + return operator=(cmap); } template - UndirEdgeMap& operator=(const CMap& cmap) { - checkConcept, CMap>(); + UEdgeMap& operator=(const CMap& cmap) { + checkConcept, CMap>(); const typename Parent::Graph* graph = Parent::getGraph(); - UndirEdge it; + UEdge it; for (graph->first(it); it != INVALID; graph->next(it)) { Parent::set(it, cmap[it]); } @@ -346,23 +346,23 @@ }; template - class StaticMappableUndirBipartiteGraphExtender : public _Base { + class StaticMappableUBipartiteGraphExtender : public _Base { public: typedef _Base Parent; - typedef StaticMappableUndirBipartiteGraphExtender Graph; + typedef StaticMappableUBipartiteGraphExtender Graph; typedef typename Parent::Node Node; typedef typename Parent::UpperNode UpperNode; typedef typename Parent::LowerNode LowerNode; typedef typename Parent::Edge Edge; - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; template class UpperNodeMap : public IterableMapExtender > { public: - typedef StaticMappableUndirBipartiteGraphExtender Graph; + typedef StaticMappableUBipartiteGraphExtender Graph; typedef IterableMapExtender > Parent; @@ -399,7 +399,7 @@ class LowerNodeMap : public IterableMapExtender > { public: - typedef StaticMappableUndirBipartiteGraphExtender Graph; + typedef StaticMappableUBipartiteGraphExtender Graph; typedef IterableMapExtender > Parent; @@ -437,7 +437,7 @@ template class NodeMapBase : public Parent::NodeNotifier::ObserverBase { public: - typedef StaticMappableUndirBipartiteGraphExtender Graph; + typedef StaticMappableUBipartiteGraphExtender Graph; typedef Node Key; typedef _Value Value; @@ -517,7 +517,7 @@ class NodeMap : public IterableMapExtender > { public: - typedef StaticMappableUndirBipartiteGraphExtender Graph; + typedef StaticMappableUBipartiteGraphExtender Graph; typedef IterableMapExtender< NodeMapBase<_Value> > Parent; NodeMap(const Graph& _g) @@ -555,7 +555,7 @@ class EdgeMap : public IterableMapExtender > { public: - typedef StaticMappableUndirBipartiteGraphExtender Graph; + typedef StaticMappableUBipartiteGraphExtender Graph; typedef IterableMapExtender > Parent; EdgeMap(const Graph& _g) @@ -580,27 +580,27 @@ }; template - class UndirEdgeMap - : public IterableMapExtender > { + class UEdgeMap + : public IterableMapExtender > { public: - typedef StaticMappableUndirBipartiteGraphExtender Graph; - typedef IterableMapExtender > + typedef StaticMappableUBipartiteGraphExtender Graph; + typedef IterableMapExtender > Parent; - UndirEdgeMap(const Graph& _g) + UEdgeMap(const Graph& _g) : Parent(_g) {} - UndirEdgeMap(const Graph& _g, const _Value& _v) + UEdgeMap(const Graph& _g, const _Value& _v) : Parent(_g, _v) {} - UndirEdgeMap& operator=(const UndirEdgeMap& cmap) { - return operator=(cmap); + UEdgeMap& operator=(const UEdgeMap& cmap) { + return operator=(cmap); } template - UndirEdgeMap& operator=(const CMap& cmap) { - checkConcept, CMap>(); + UEdgeMap& operator=(const CMap& cmap) { + checkConcept, CMap>(); const typename Parent::Graph* graph = Parent::getGraph(); - UndirEdge it; + UEdge it; for (graph->first(it); it != INVALID; graph->next(it)) { Parent::set(it, cmap[it]); } diff -r e225719bde6b -r 2d806130e700 lemon/concept/graph.h --- a/lemon/concept/graph.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/concept/graph.h Thu Jan 26 15:42:13 2006 +0000 @@ -42,7 +42,7 @@ public IterableGraphComponent, public MappableGraphComponent { public: - typedef False UndirTag; + typedef False UTag; typedef BaseGraphComponent::Node Node; typedef BaseGraphComponent::Edge Edge; @@ -123,7 +123,7 @@ ///\todo undocumented /// - typedef False UndirTag; + typedef False UTag; /// Defalult constructor. diff -r e225719bde6b -r 2d806130e700 lemon/concept/graph_component.h --- a/lemon/concept/graph_component.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/concept/graph_component.h Thu Jan 26 15:42:13 2006 +0000 @@ -34,7 +34,7 @@ /// Skeleton class for graph Node and Edge types - /// This class describes the interface of Node and Edge (and UndirEdge + /// This class describes the interface of Node and Edge (and UEdge /// in undirected graphs) subtypes of graph types. /// /// \note This class is a template class so that we can use it to diff -r e225719bde6b -r 2d806130e700 lemon/concept/ugraph.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lemon/concept/ugraph.h Thu Jan 26 15:42:13 2006 +0000 @@ -0,0 +1,995 @@ +/* -*- C++ -*- + * + * lemon/concept/ugraph_component.h - Part of LEMON, a generic + * C++ optimization library + * + * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi + * Kutatocsoport (Egervary Research Group on Combinatorial Optimization, + * EGRES). + * + * Permission to use, modify and distribute this software is granted + * provided that this copyright notice appears in all copies. For + * precise terms see the accompanying LICENSE file. + * + * This software is provided "AS IS" with no warranty of any kind, + * express or implied, and with no claim as to its suitability for any + * purpose. + * + */ + +///\ingroup graph_concepts +///\file +///\brief Undirected graphs and components of. + + +#ifndef LEMON_CONCEPT_UNDIR_GRAPH_H +#define LEMON_CONCEPT_UNDIR_GRAPH_H + +#include +#include +#include + +namespace lemon { + namespace concept { + +// /// Skeleton class which describes an edge with direction in \ref +// /// UGraph "undirected graph". + template + class UGraphEdge : public UGraph::UEdge { + typedef typename UGraph::UEdge UEdge; + typedef typename UGraph::Node Node; + public: + + /// \e + UGraphEdge() {} + + /// \e + UGraphEdge(const UGraphEdge& e) : UGraph::UEdge(e) {} + + /// \e + UGraphEdge(Invalid) {} + + /// \brief Directed edge from undirected edge and a source node. + /// + /// Constructs a directed edge from undirected edge and a source node. + /// + /// \note You have to specify the graph for this constructor. + UGraphEdge(const UGraph &g, + UEdge u_edge, Node n) { + ignore_unused_variable_warning(u_edge); + ignore_unused_variable_warning(g); + ignore_unused_variable_warning(n); + } + + /// \e + UGraphEdge& operator=(UGraphEdge) { return *this; } + + /// \e + bool operator==(UGraphEdge) const { return true; } + /// \e + bool operator!=(UGraphEdge) const { return false; } + + /// \e + bool operator<(UGraphEdge) const { return false; } + + template + struct Constraints { + void constraints() { + const_constraints(); + } + void const_constraints() const { + /// \bug This should be is_base_and_derived ... + UEdge ue = e; + ue = e; + + Edge e_with_source(graph,ue,n); + ignore_unused_variable_warning(e_with_source); + } + Edge e; + UEdge ue; + UGraph graph; + Node n; + }; + }; + + + struct BaseIterableUGraphConcept { + + template + struct Constraints { + + typedef typename Graph::UEdge UEdge; + typedef typename Graph::Edge Edge; + typedef typename Graph::Node Node; + + void constraints() { + checkConcept(); + checkConcept, UEdge>(); + //checkConcept, Edge>(); + + graph.first(ue); + graph.next(ue); + + const_constraints(); + } + void const_constraints() { + Node n; + n = graph.target(ue); + n = graph.source(ue); + n = graph.oppositeNode(n0, ue); + + bool b; + b = graph.direction(e); + Edge e = graph.direct(UEdge(), true); + e = graph.direct(UEdge(), n); + + ignore_unused_variable_warning(b); + } + + Graph graph; + Edge e; + Node n0; + UEdge ue; + }; + + }; + + + struct IterableUGraphConcept { + + template + struct Constraints { + void constraints() { + /// \todo we don't need the iterable component to be base iterable + /// Don't we really??? + //checkConcept< BaseIterableUGraphConcept, Graph > (); + + checkConcept (); + + typedef typename Graph::UEdge UEdge; + typedef typename Graph::UEdgeIt UEdgeIt; + typedef typename Graph::IncEdgeIt IncEdgeIt; + + checkConcept, UEdgeIt>(); + checkConcept, IncEdgeIt>(); + } + }; + + }; + + struct MappableUGraphConcept { + + template + struct Constraints { + + struct Dummy { + int value; + Dummy() : value(0) {} + Dummy(int _v) : value(_v) {} + }; + + void constraints() { + checkConcept(); + + typedef typename Graph::template UEdgeMap IntMap; + checkConcept, + IntMap >(); + + typedef typename Graph::template UEdgeMap BoolMap; + checkConcept, + BoolMap >(); + + typedef typename Graph::template UEdgeMap DummyMap; + checkConcept, + DummyMap >(); + } + }; + + }; + + struct ExtendableUGraphConcept { + + template + struct Constraints { + void constraints() { + node_a = graph.addNode(); + uedge = graph.addEdge(node_a, node_b); + } + typename Graph::Node node_a, node_b; + typename Graph::UEdge uedge; + Graph graph; + }; + + }; + + struct ErasableUGraphConcept { + + template + struct Constraints { + void constraints() { + graph.erase(n); + graph.erase(e); + } + Graph graph; + typename Graph::Node n; + typename Graph::UEdge e; + }; + + }; + + /// \addtogroup graph_concepts + /// @{ + + + /// Class describing the concept of Undirected Graphs. + + /// This class describes the common interface of all Undirected + /// Graphs. + /// + /// As all concept describing classes it provides only interface + /// without any sensible implementation. So any algorithm for + /// undirected graph should compile with this class, but it will not + /// run properly, of couse. + /// + /// In LEMON undirected graphs also fulfill the concept of directed + /// graphs (\ref lemon::concept::StaticGraph "Graph Concept"). For + /// explanation of this and more see also the page \ref ugraphs, + /// a tutorial about undirected graphs. + /// + /// You can assume that all undirected graph can be handled + /// as a static directed graph. This way it is fully conform + /// to the StaticGraph concept. + + class UGraph { + public: + ///\e + + ///\todo undocumented + /// + typedef True UTag; + + /// \brief The base type of node iterators, + /// or in other words, the trivial node iterator. + /// + /// This is the base type of each node iterator, + /// thus each kind of node iterator converts to this. + /// More precisely each kind of node iterator should be inherited + /// from the trivial node iterator. + class Node { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + Node() { } + /// Copy constructor. + + /// Copy constructor. + /// + Node(const Node&) { } + + /// Invalid constructor \& conversion. + + /// This constructor initializes the iterator to be invalid. + /// \sa Invalid for more details. + Node(Invalid) { } + /// Equality operator + + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(Node) const { return true; } + + /// Inequality operator + + /// \sa operator==(Node n) + /// + bool operator!=(Node) const { return true; } + + /// Artificial ordering operator. + + /// To allow the use of graph descriptors as key type in std::map or + /// similar associative container we require this. + /// + /// \note This operator only have to define some strict ordering of + /// the items; this order has nothing to do with the iteration + /// ordering of the items. + /// + /// \bug This is a technical requirement. Do we really need this? + bool operator<(Node) const { return false; } + + }; + + /// This iterator goes through each node. + + /// This iterator goes through each node. + /// Its usage is quite simple, for example you can count the number + /// of nodes in graph \c g of type \c Graph like this: + /// \code + /// int count=0; + /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count; + /// \endcode + class NodeIt : public Node { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + NodeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + NodeIt(const NodeIt& n) : Node(n) { } + /// Invalid constructor \& conversion. + + /// Initialize the iterator to be invalid. + /// \sa Invalid for more details. + NodeIt(Invalid) { } + /// Sets the iterator to the first node. + + /// Sets the iterator to the first node of \c g. + /// + NodeIt(const UGraph&) { } + /// Node -> NodeIt conversion. + + /// Sets the iterator to the node of \c the graph pointed by + /// the trivial iterator. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + NodeIt(const UGraph&, const Node&) { } + /// Next node. + + /// Assign the iterator to the next node. + /// + NodeIt& operator++() { return *this; } + }; + + + /// The base type of the undirected edge iterators. + + /// The base type of the undirected edge iterators. + /// + class UEdge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + UEdge() { } + /// Copy constructor. + + /// Copy constructor. + /// + UEdge(const UEdge&) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + UEdge(Invalid) { } + /// Equality operator + + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(UEdge) const { return true; } + /// Inequality operator + + /// \sa operator==(UEdge n) + /// + bool operator!=(UEdge) const { return true; } + + /// Artificial ordering operator. + + /// To allow the use of graph descriptors as key type in std::map or + /// similar associative container we require this. + /// + /// \note This operator only have to define some strict ordering of + /// the items; this order has nothing to do with the iteration + /// ordering of the items. + /// + /// \bug This is a technical requirement. Do we really need this? + bool operator<(UEdge) const { return false; } + }; + + /// This iterator goes through each undirected edge. + + /// This iterator goes through each undirected edge of a graph. + /// Its usage is quite simple, for example you can count the number + /// of undirected edges in a graph \c g of type \c Graph as follows: + /// \code + /// int count=0; + /// for(Graph::UEdgeIt e(g); e!=INVALID; ++e) ++count; + /// \endcode + class UEdgeIt : public UEdge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + UEdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + UEdgeIt(const UEdgeIt& e) : UEdge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + UEdgeIt(Invalid) { } + /// This constructor sets the iterator to the first undirected edge. + + /// This constructor sets the iterator to the first undirected edge. + UEdgeIt(const UGraph&) { } + /// UEdge -> UEdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator. + /// This feature necessitates that each time we + /// iterate the undirected edge-set, the iteration order is the + /// same. + UEdgeIt(const UGraph&, const UEdge&) { } + /// Next undirected edge + + /// Assign the iterator to the next undirected edge. + UEdgeIt& operator++() { return *this; } + }; + + /// \brief This iterator goes trough the incident undirected + /// edges of a node. + /// + /// This iterator goes trough the incident undirected edges + /// of a certain node + /// of a graph. + /// Its usage is quite simple, for example you can compute the + /// degree (i.e. count the number + /// of incident edges of a node \c n + /// in graph \c g of type \c Graph as follows. + /// \code + /// int count=0; + /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count; + /// \endcode + class IncEdgeIt : public UEdge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + IncEdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + IncEdgeIt(Invalid) { } + /// This constructor sets the iterator to first incident edge. + + /// This constructor set the iterator to the first incident edge of + /// the node. + IncEdgeIt(const UGraph&, const Node&) { } + /// UEdge -> IncEdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator \c e. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + IncEdgeIt(const UGraph&, const UEdge&) { } + /// Next incident edge + + /// Assign the iterator to the next incident edge + /// of the corresponding node. + IncEdgeIt& operator++() { return *this; } + }; + + /// The directed edge type. + + /// The directed edge type. It can be converted to the + /// undirected edge. + class Edge : public UEdge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + Edge() { } + /// Copy constructor. + + /// Copy constructor. + /// + Edge(const Edge& e) : UEdge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + Edge(Invalid) { } + /// Equality operator + + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(Edge) const { return true; } + /// Inequality operator + + /// \sa operator==(Edge n) + /// + bool operator!=(Edge) const { return true; } + + /// Artificial ordering operator. + + /// To allow the use of graph descriptors as key type in std::map or + /// similar associative container we require this. + /// + /// \note This operator only have to define some strict ordering of + /// the items; this order has nothing to do with the iteration + /// ordering of the items. + /// + /// \bug This is a technical requirement. Do we really need this? + bool operator<(Edge) const { return false; } + + }; + /// This iterator goes through each directed edge. + + /// This iterator goes through each edge of a graph. + /// Its usage is quite simple, for example you can count the number + /// of edges in a graph \c g of type \c Graph as follows: + /// \code + /// int count=0; + /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count; + /// \endcode + class EdgeIt : public Edge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + EdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + EdgeIt(const EdgeIt& e) : Edge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + EdgeIt(Invalid) { } + /// This constructor sets the iterator to the first edge. + + /// This constructor sets the iterator to the first edge of \c g. + ///@param g the graph + EdgeIt(const UGraph &g) { ignore_unused_variable_warning(g); } + /// Edge -> EdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator \c e. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + EdgeIt(const UGraph&, const Edge&) { } + ///Next edge + + /// Assign the iterator to the next edge. + EdgeIt& operator++() { return *this; } + }; + + /// This iterator goes trough the outgoing directed edges of a node. + + /// This iterator goes trough the \e outgoing edges of a certain node + /// of a graph. + /// Its usage is quite simple, for example you can count the number + /// of outgoing edges of a node \c n + /// in graph \c g of type \c Graph as follows. + /// \code + /// int count=0; + /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count; + /// \endcode + + class OutEdgeIt : public Edge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + OutEdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + OutEdgeIt(const OutEdgeIt& e) : Edge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + OutEdgeIt(Invalid) { } + /// This constructor sets the iterator to the first outgoing edge. + + /// This constructor sets the iterator to the first outgoing edge of + /// the node. + ///@param n the node + ///@param g the graph + OutEdgeIt(const UGraph& n, const Node& g) { + ignore_unused_variable_warning(n); + ignore_unused_variable_warning(g); + } + /// Edge -> OutEdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + OutEdgeIt(const UGraph&, const Edge&) { } + ///Next outgoing edge + + /// Assign the iterator to the next + /// outgoing edge of the corresponding node. + OutEdgeIt& operator++() { return *this; } + }; + + /// This iterator goes trough the incoming directed edges of a node. + + /// This iterator goes trough the \e incoming edges of a certain node + /// of a graph. + /// Its usage is quite simple, for example you can count the number + /// of outgoing edges of a node \c n + /// in graph \c g of type \c Graph as follows. + /// \code + /// int count=0; + /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count; + /// \endcode + + class InEdgeIt : public Edge { + public: + /// Default constructor + + /// @warning The default constructor sets the iterator + /// to an undefined value. + InEdgeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + InEdgeIt(const InEdgeIt& e) : Edge(e) { } + /// Initialize the iterator to be invalid. + + /// Initialize the iterator to be invalid. + /// + InEdgeIt(Invalid) { } + /// This constructor sets the iterator to first incoming edge. + + /// This constructor set the iterator to the first incoming edge of + /// the node. + ///@param n the node + ///@param g the graph + InEdgeIt(const UGraph& g, const Node& n) { + ignore_unused_variable_warning(n); + ignore_unused_variable_warning(g); + } + /// Edge -> InEdgeIt conversion + + /// Sets the iterator to the value of the trivial iterator \c e. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + InEdgeIt(const UGraph&, const Edge&) { } + /// Next incoming edge + + /// Assign the iterator to the next inedge of the corresponding node. + /// + InEdgeIt& operator++() { return *this; } + }; + + /// \brief Read write map of the nodes to type \c T. + /// + /// ReadWrite map of the nodes to type \c T. + /// \sa Reference + /// \warning Making maps that can handle bool type (NodeMap) + /// needs some extra attention! + /// \todo Wrong documentation + template + class NodeMap : public ReadWriteMap< Node, T > + { + public: + + ///\e + NodeMap(const UGraph&) { } + ///\e + NodeMap(const UGraph&, T) { } + + ///Copy constructor + NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } + ///Assignment operator + NodeMap& operator=(const NodeMap&) { return *this; } + // \todo fix this concept + }; + + /// \brief Read write map of the directed edges to type \c T. + /// + /// Reference map of the directed edges to type \c T. + /// \sa Reference + /// \warning Making maps that can handle bool type (EdgeMap) + /// needs some extra attention! + /// \todo Wrong documentation + template + class EdgeMap : public ReadWriteMap + { + public: + + ///\e + EdgeMap(const UGraph&) { } + ///\e + EdgeMap(const UGraph&, T) { } + ///Copy constructor + EdgeMap(const EdgeMap& em) : ReadWriteMap(em) { } + ///Assignment operator + EdgeMap& operator=(const EdgeMap&) { return *this; } + // \todo fix this concept + }; + + /// Read write map of the undirected edges to type \c T. + + /// Reference map of the edges to type \c T. + /// \sa Reference + /// \warning Making maps that can handle bool type (UEdgeMap) + /// needs some extra attention! + /// \todo Wrong documentation + template + class UEdgeMap : public ReadWriteMap + { + public: + + ///\e + UEdgeMap(const UGraph&) { } + ///\e + UEdgeMap(const UGraph&, T) { } + ///Copy constructor + UEdgeMap(const UEdgeMap& em) : ReadWriteMap(em) {} + ///Assignment operator + UEdgeMap &operator=(const UEdgeMap&) { return *this; } + // \todo fix this concept + }; + + /// \brief Direct the given undirected edge. + /// + /// Direct the given undirected edge. The returned edge source + /// will be the given edge. + Edge direct(const UEdge&, const Node&) const { + return INVALID; + } + + /// \brief Direct the given undirected edge. + /// + /// Direct the given undirected edge. The returned edge source + /// will be the source of the undirected edge if the given bool + /// is true. + Edge direct(const UEdge&, bool) const { + return INVALID; + } + + /// \brief Returns true if the edge has default orientation. + /// + /// Returns whether the given directed edge is same orientation as + /// the corresponding undirected edge. + bool direction(Edge) const { return true; } + + /// \brief Returns the opposite directed edge. + /// + /// Returns the opposite directed edge. + Edge oppositeEdge(Edge) const { return INVALID; } + + /// \brief Opposite node on an edge + /// + /// \return the opposite of the given Node on the given Edge + Node oppositeNode(Node, UEdge) const { return INVALID; } + + /// \brief First node of the undirected edge. + /// + /// \return the first node of the given UEdge. + /// + /// Naturally uectected edges don't have direction and thus + /// don't have source and target node. But we use these two methods + /// to query the two endnodes of the edge. The direction of the edge + /// which arises this way is called the inherent direction of the + /// undirected edge, and is used to define the "default" direction + /// of the directed versions of the edges. + /// \sa direction + Node source(UEdge) const { return INVALID; } + + /// \brief Second node of the undirected edge. + Node target(UEdge) const { return INVALID; } + + /// \brief Source node of the directed edge. + Node source(Edge) const { return INVALID; } + + /// \brief Target node of the directed edge. + Node target(Edge) const { return INVALID; } + +// /// \brief First node of the graph +// /// +// /// \note This method is part of so called \ref +// /// developpers_interface "Developpers' interface", so it shouldn't +// /// be used in an end-user program. + void first(Node&) const {} +// /// \brief Next node of the graph +// /// +// /// \note This method is part of so called \ref +// /// developpers_interface "Developpers' interface", so it shouldn't +// /// be used in an end-user program. + void next(Node&) const {} + +// /// \brief First undirected edge of the graph +// /// +// /// \note This method is part of so called \ref +// /// developpers_interface "Developpers' interface", so it shouldn't +// /// be used in an end-user program. + void first(UEdge&) const {} +// /// \brief Next undirected edge of the graph +// /// +// /// \note This method is part of so called \ref +// /// developpers_interface "Developpers' interface", so it shouldn't +// /// be used in an end-user program. + void next(UEdge&) const {} + +// /// \brief First directed edge of the graph +// /// +// /// \note This method is part of so called \ref +// /// developpers_interface "Developpers' interface", so it shouldn't +// /// be used in an end-user program. + void first(Edge&) const {} +// /// \brief Next directed edge of the graph +// /// +// /// \note This method is part of so called \ref +// /// developpers_interface "Developpers' interface", so it shouldn't +// /// be used in an end-user program. + void next(Edge&) const {} + +// /// \brief First outgoing edge from a given node +// /// +// /// \note This method is part of so called \ref +// /// developpers_interface "Developpers' interface", so it shouldn't +// /// be used in an end-user program. + void firstOut(Edge&, Node) const {} +// /// \brief Next outgoing edge to a node +// /// +// /// \note This method is part of so called \ref +// /// developpers_interface "Developpers' interface", so it shouldn't +// /// be used in an end-user program. + void nextOut(Edge&) const {} + +// /// \brief First incoming edge to a given node +// /// +// /// \note This method is part of so called \ref +// /// developpers_interface "Developpers' interface", so it shouldn't +// /// be used in an end-user program. + void firstIn(Edge&, Node) const {} +// /// \brief Next incoming edge to a node +// /// +// /// \note This method is part of so called \ref +// /// developpers_interface "Developpers' interface", so it shouldn't +// /// be used in an end-user program. + void nextIn(Edge&) const {} + + + /// \brief Base node of the iterator + /// + /// Returns the base node (the source in this case) of the iterator + Node baseNode(OutEdgeIt e) const { + return source(e); + } + /// \brief Running node of the iterator + /// + /// Returns the running node (the target in this case) of the + /// iterator + Node runningNode(OutEdgeIt e) const { + return target(e); + } + + /// \brief Base node of the iterator + /// + /// Returns the base node (the target in this case) of the iterator + Node baseNode(InEdgeIt e) const { + return target(e); + } + /// \brief Running node of the iterator + /// + /// Returns the running node (the source in this case) of the + /// iterator + Node runningNode(InEdgeIt e) const { + return source(e); + } + + /// \brief Base node of the iterator + /// + /// Returns the base node of the iterator + Node baseNode(IncEdgeIt) const { + return INVALID; + } + + /// \brief Running node of the iterator + /// + /// Returns the running node of the iterator + Node runningNode(IncEdgeIt) const { + return INVALID; + } + + template + struct Constraints { + void constraints() { + checkConcept(); + checkConcept(); + checkConcept(); + } + }; + + }; + + /// \brief An empty non-static undirected graph class. + /// + /// This class provides everything that \ref UGraph does. + /// Additionally it enables building graphs from scratch. + class ExtendableUGraph : public UGraph { + public: + + /// \brief Add a new node to the graph. + /// + /// Add a new node to the graph. + /// \return the new node. + Node addNode(); + + /// \brief Add a new undirected edge to the graph. + /// + /// Add a new undirected edge to the graph. + /// \return the new edge. + UEdge addEdge(const Node& from, const Node& to); + + /// \brief Resets the graph. + /// + /// This function deletes all undirected edges and nodes of the graph. + /// It also frees the memory allocated to store them. + void clear() { } + + template + struct Constraints { + void constraints() { + checkConcept(); + checkConcept(); + checkConcept(); + + checkConcept(); + checkConcept(); + checkConcept(); + } + }; + + }; + + /// \brief An empty erasable undirected graph class. + /// + /// This class is an extension of \ref ExtendableUGraph. It makes it + /// possible to erase undirected edges or nodes. + class ErasableUGraph : public ExtendableUGraph { + public: + + /// \brief Deletes a node. + /// + /// Deletes a node. + /// + void erase(Node) { } + /// \brief Deletes an undirected edge. + /// + /// Deletes an undirected edge. + /// + void erase(UEdge) { } + + template + struct Constraints { + void constraints() { + checkConcept(); + checkConcept(); + } + }; + + }; + + /// @} + + } + +} + +#endif diff -r e225719bde6b -r 2d806130e700 lemon/concept/undir_graph.h --- a/lemon/concept/undir_graph.h Thu Jan 26 06:44:22 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,995 +0,0 @@ -/* -*- C++ -*- - * - * lemon/concept/undir_graph_component.h - Part of LEMON, a generic - * C++ optimization library - * - * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi - * Kutatocsoport (Egervary Research Group on Combinatorial Optimization, - * EGRES). - * - * Permission to use, modify and distribute this software is granted - * provided that this copyright notice appears in all copies. For - * precise terms see the accompanying LICENSE file. - * - * This software is provided "AS IS" with no warranty of any kind, - * express or implied, and with no claim as to its suitability for any - * purpose. - * - */ - -///\ingroup graph_concepts -///\file -///\brief Undirected graphs and components of. - - -#ifndef LEMON_CONCEPT_UNDIR_GRAPH_H -#define LEMON_CONCEPT_UNDIR_GRAPH_H - -#include -#include -#include - -namespace lemon { - namespace concept { - -// /// Skeleton class which describes an edge with direction in \ref -// /// UndirGraph "undirected graph". - template - class UndirGraphEdge : public UndirGraph::UndirEdge { - typedef typename UndirGraph::UndirEdge UndirEdge; - typedef typename UndirGraph::Node Node; - public: - - /// \e - UndirGraphEdge() {} - - /// \e - UndirGraphEdge(const UndirGraphEdge& e) : UndirGraph::UndirEdge(e) {} - - /// \e - UndirGraphEdge(Invalid) {} - - /// \brief Directed edge from undirected edge and a source node. - /// - /// Constructs a directed edge from undirected edge and a source node. - /// - /// \note You have to specify the graph for this constructor. - UndirGraphEdge(const UndirGraph &g, - UndirEdge undir_edge, Node n) { - ignore_unused_variable_warning(undir_edge); - ignore_unused_variable_warning(g); - ignore_unused_variable_warning(n); - } - - /// \e - UndirGraphEdge& operator=(UndirGraphEdge) { return *this; } - - /// \e - bool operator==(UndirGraphEdge) const { return true; } - /// \e - bool operator!=(UndirGraphEdge) const { return false; } - - /// \e - bool operator<(UndirGraphEdge) const { return false; } - - template - struct Constraints { - void constraints() { - const_constraints(); - } - void const_constraints() const { - /// \bug This should be is_base_and_derived ... - UndirEdge ue = e; - ue = e; - - Edge e_with_source(graph,ue,n); - ignore_unused_variable_warning(e_with_source); - } - Edge e; - UndirEdge ue; - UndirGraph graph; - Node n; - }; - }; - - - struct BaseIterableUndirGraphConcept { - - template - struct Constraints { - - typedef typename Graph::UndirEdge UndirEdge; - typedef typename Graph::Edge Edge; - typedef typename Graph::Node Node; - - void constraints() { - checkConcept(); - checkConcept, UndirEdge>(); - //checkConcept, Edge>(); - - graph.first(ue); - graph.next(ue); - - const_constraints(); - } - void const_constraints() { - Node n; - n = graph.target(ue); - n = graph.source(ue); - n = graph.oppositeNode(n0, ue); - - bool b; - b = graph.direction(e); - Edge e = graph.direct(UndirEdge(), true); - e = graph.direct(UndirEdge(), n); - - ignore_unused_variable_warning(b); - } - - Graph graph; - Edge e; - Node n0; - UndirEdge ue; - }; - - }; - - - struct IterableUndirGraphConcept { - - template - struct Constraints { - void constraints() { - /// \todo we don't need the iterable component to be base iterable - /// Don't we really??? - //checkConcept< BaseIterableUndirGraphConcept, Graph > (); - - checkConcept (); - - typedef typename Graph::UndirEdge UndirEdge; - typedef typename Graph::UndirEdgeIt UndirEdgeIt; - typedef typename Graph::IncEdgeIt IncEdgeIt; - - checkConcept, UndirEdgeIt>(); - checkConcept, IncEdgeIt>(); - } - }; - - }; - - struct MappableUndirGraphConcept { - - template - struct Constraints { - - struct Dummy { - int value; - Dummy() : value(0) {} - Dummy(int _v) : value(_v) {} - }; - - void constraints() { - checkConcept(); - - typedef typename Graph::template UndirEdgeMap IntMap; - checkConcept, - IntMap >(); - - typedef typename Graph::template UndirEdgeMap BoolMap; - checkConcept, - BoolMap >(); - - typedef typename Graph::template UndirEdgeMap DummyMap; - checkConcept, - DummyMap >(); - } - }; - - }; - - struct ExtendableUndirGraphConcept { - - template - struct Constraints { - void constraints() { - node_a = graph.addNode(); - uedge = graph.addEdge(node_a, node_b); - } - typename Graph::Node node_a, node_b; - typename Graph::UndirEdge uedge; - Graph graph; - }; - - }; - - struct ErasableUndirGraphConcept { - - template - struct Constraints { - void constraints() { - graph.erase(n); - graph.erase(e); - } - Graph graph; - typename Graph::Node n; - typename Graph::UndirEdge e; - }; - - }; - - /// \addtogroup graph_concepts - /// @{ - - - /// Class describing the concept of Undirected Graphs. - - /// This class describes the common interface of all Undirected - /// Graphs. - /// - /// As all concept describing classes it provides only interface - /// without any sensible implementation. So any algorithm for - /// undirected graph should compile with this class, but it will not - /// run properly, of couse. - /// - /// In LEMON undirected graphs also fulfill the concept of directed - /// graphs (\ref lemon::concept::StaticGraph "Graph Concept"). For - /// explanation of this and more see also the page \ref undir_graphs, - /// a tutorial about undirected graphs. - /// - /// You can assume that all undirected graph can be handled - /// as a static directed graph. This way it is fully conform - /// to the StaticGraph concept. - - class UndirGraph { - public: - ///\e - - ///\todo undocumented - /// - typedef True UndirTag; - - /// \brief The base type of node iterators, - /// or in other words, the trivial node iterator. - /// - /// This is the base type of each node iterator, - /// thus each kind of node iterator converts to this. - /// More precisely each kind of node iterator should be inherited - /// from the trivial node iterator. - class Node { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - Node() { } - /// Copy constructor. - - /// Copy constructor. - /// - Node(const Node&) { } - - /// Invalid constructor \& conversion. - - /// This constructor initializes the iterator to be invalid. - /// \sa Invalid for more details. - Node(Invalid) { } - /// Equality operator - - /// Two iterators are equal if and only if they point to the - /// same object or both are invalid. - bool operator==(Node) const { return true; } - - /// Inequality operator - - /// \sa operator==(Node n) - /// - bool operator!=(Node) const { return true; } - - /// Artificial ordering operator. - - /// To allow the use of graph descriptors as key type in std::map or - /// similar associative container we require this. - /// - /// \note This operator only have to define some strict ordering of - /// the items; this order has nothing to do with the iteration - /// ordering of the items. - /// - /// \bug This is a technical requirement. Do we really need this? - bool operator<(Node) const { return false; } - - }; - - /// This iterator goes through each node. - - /// This iterator goes through each node. - /// Its usage is quite simple, for example you can count the number - /// of nodes in graph \c g of type \c Graph like this: - /// \code - /// int count=0; - /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count; - /// \endcode - class NodeIt : public Node { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - NodeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - NodeIt(const NodeIt& n) : Node(n) { } - /// Invalid constructor \& conversion. - - /// Initialize the iterator to be invalid. - /// \sa Invalid for more details. - NodeIt(Invalid) { } - /// Sets the iterator to the first node. - - /// Sets the iterator to the first node of \c g. - /// - NodeIt(const UndirGraph&) { } - /// Node -> NodeIt conversion. - - /// Sets the iterator to the node of \c the graph pointed by - /// the trivial iterator. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - NodeIt(const UndirGraph&, const Node&) { } - /// Next node. - - /// Assign the iterator to the next node. - /// - NodeIt& operator++() { return *this; } - }; - - - /// The base type of the undirected edge iterators. - - /// The base type of the undirected edge iterators. - /// - class UndirEdge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - UndirEdge() { } - /// Copy constructor. - - /// Copy constructor. - /// - UndirEdge(const UndirEdge&) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - UndirEdge(Invalid) { } - /// Equality operator - - /// Two iterators are equal if and only if they point to the - /// same object or both are invalid. - bool operator==(UndirEdge) const { return true; } - /// Inequality operator - - /// \sa operator==(UndirEdge n) - /// - bool operator!=(UndirEdge) const { return true; } - - /// Artificial ordering operator. - - /// To allow the use of graph descriptors as key type in std::map or - /// similar associative container we require this. - /// - /// \note This operator only have to define some strict ordering of - /// the items; this order has nothing to do with the iteration - /// ordering of the items. - /// - /// \bug This is a technical requirement. Do we really need this? - bool operator<(UndirEdge) const { return false; } - }; - - /// This iterator goes through each undirected edge. - - /// This iterator goes through each undirected edge of a graph. - /// Its usage is quite simple, for example you can count the number - /// of undirected edges in a graph \c g of type \c Graph as follows: - /// \code - /// int count=0; - /// for(Graph::UndirEdgeIt e(g); e!=INVALID; ++e) ++count; - /// \endcode - class UndirEdgeIt : public UndirEdge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - UndirEdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - UndirEdgeIt(const UndirEdgeIt& e) : UndirEdge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - UndirEdgeIt(Invalid) { } - /// This constructor sets the iterator to the first undirected edge. - - /// This constructor sets the iterator to the first undirected edge. - UndirEdgeIt(const UndirGraph&) { } - /// UndirEdge -> UndirEdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator. - /// This feature necessitates that each time we - /// iterate the undirected edge-set, the iteration order is the - /// same. - UndirEdgeIt(const UndirGraph&, const UndirEdge&) { } - /// Next undirected edge - - /// Assign the iterator to the next undirected edge. - UndirEdgeIt& operator++() { return *this; } - }; - - /// \brief This iterator goes trough the incident undirected - /// edges of a node. - /// - /// This iterator goes trough the incident undirected edges - /// of a certain node - /// of a graph. - /// Its usage is quite simple, for example you can compute the - /// degree (i.e. count the number - /// of incident edges of a node \c n - /// in graph \c g of type \c Graph as follows. - /// \code - /// int count=0; - /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count; - /// \endcode - class IncEdgeIt : public UndirEdge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - IncEdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - IncEdgeIt(const IncEdgeIt& e) : UndirEdge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - IncEdgeIt(Invalid) { } - /// This constructor sets the iterator to first incident edge. - - /// This constructor set the iterator to the first incident edge of - /// the node. - IncEdgeIt(const UndirGraph&, const Node&) { } - /// UndirEdge -> IncEdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator \c e. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - IncEdgeIt(const UndirGraph&, const UndirEdge&) { } - /// Next incident edge - - /// Assign the iterator to the next incident edge - /// of the corresponding node. - IncEdgeIt& operator++() { return *this; } - }; - - /// The directed edge type. - - /// The directed edge type. It can be converted to the - /// undirected edge. - class Edge : public UndirEdge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - Edge() { } - /// Copy constructor. - - /// Copy constructor. - /// - Edge(const Edge& e) : UndirEdge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - Edge(Invalid) { } - /// Equality operator - - /// Two iterators are equal if and only if they point to the - /// same object or both are invalid. - bool operator==(Edge) const { return true; } - /// Inequality operator - - /// \sa operator==(Edge n) - /// - bool operator!=(Edge) const { return true; } - - /// Artificial ordering operator. - - /// To allow the use of graph descriptors as key type in std::map or - /// similar associative container we require this. - /// - /// \note This operator only have to define some strict ordering of - /// the items; this order has nothing to do with the iteration - /// ordering of the items. - /// - /// \bug This is a technical requirement. Do we really need this? - bool operator<(Edge) const { return false; } - - }; - /// This iterator goes through each directed edge. - - /// This iterator goes through each edge of a graph. - /// Its usage is quite simple, for example you can count the number - /// of edges in a graph \c g of type \c Graph as follows: - /// \code - /// int count=0; - /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count; - /// \endcode - class EdgeIt : public Edge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - EdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - EdgeIt(const EdgeIt& e) : Edge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - EdgeIt(Invalid) { } - /// This constructor sets the iterator to the first edge. - - /// This constructor sets the iterator to the first edge of \c g. - ///@param g the graph - EdgeIt(const UndirGraph &g) { ignore_unused_variable_warning(g); } - /// Edge -> EdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator \c e. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - EdgeIt(const UndirGraph&, const Edge&) { } - ///Next edge - - /// Assign the iterator to the next edge. - EdgeIt& operator++() { return *this; } - }; - - /// This iterator goes trough the outgoing directed edges of a node. - - /// This iterator goes trough the \e outgoing edges of a certain node - /// of a graph. - /// Its usage is quite simple, for example you can count the number - /// of outgoing edges of a node \c n - /// in graph \c g of type \c Graph as follows. - /// \code - /// int count=0; - /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count; - /// \endcode - - class OutEdgeIt : public Edge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - OutEdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - OutEdgeIt(const OutEdgeIt& e) : Edge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - OutEdgeIt(Invalid) { } - /// This constructor sets the iterator to the first outgoing edge. - - /// This constructor sets the iterator to the first outgoing edge of - /// the node. - ///@param n the node - ///@param g the graph - OutEdgeIt(const UndirGraph& n, const Node& g) { - ignore_unused_variable_warning(n); - ignore_unused_variable_warning(g); - } - /// Edge -> OutEdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - OutEdgeIt(const UndirGraph&, const Edge&) { } - ///Next outgoing edge - - /// Assign the iterator to the next - /// outgoing edge of the corresponding node. - OutEdgeIt& operator++() { return *this; } - }; - - /// This iterator goes trough the incoming directed edges of a node. - - /// This iterator goes trough the \e incoming edges of a certain node - /// of a graph. - /// Its usage is quite simple, for example you can count the number - /// of outgoing edges of a node \c n - /// in graph \c g of type \c Graph as follows. - /// \code - /// int count=0; - /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count; - /// \endcode - - class InEdgeIt : public Edge { - public: - /// Default constructor - - /// @warning The default constructor sets the iterator - /// to an undefined value. - InEdgeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - InEdgeIt(const InEdgeIt& e) : Edge(e) { } - /// Initialize the iterator to be invalid. - - /// Initialize the iterator to be invalid. - /// - InEdgeIt(Invalid) { } - /// This constructor sets the iterator to first incoming edge. - - /// This constructor set the iterator to the first incoming edge of - /// the node. - ///@param n the node - ///@param g the graph - InEdgeIt(const UndirGraph& g, const Node& n) { - ignore_unused_variable_warning(n); - ignore_unused_variable_warning(g); - } - /// Edge -> InEdgeIt conversion - - /// Sets the iterator to the value of the trivial iterator \c e. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - InEdgeIt(const UndirGraph&, const Edge&) { } - /// Next incoming edge - - /// Assign the iterator to the next inedge of the corresponding node. - /// - InEdgeIt& operator++() { return *this; } - }; - - /// \brief Read write map of the nodes to type \c T. - /// - /// ReadWrite map of the nodes to type \c T. - /// \sa Reference - /// \warning Making maps that can handle bool type (NodeMap) - /// needs some extra attention! - /// \todo Wrong documentation - template - class NodeMap : public ReadWriteMap< Node, T > - { - public: - - ///\e - NodeMap(const UndirGraph&) { } - ///\e - NodeMap(const UndirGraph&, T) { } - - ///Copy constructor - NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } - ///Assignment operator - NodeMap& operator=(const NodeMap&) { return *this; } - // \todo fix this concept - }; - - /// \brief Read write map of the directed edges to type \c T. - /// - /// Reference map of the directed edges to type \c T. - /// \sa Reference - /// \warning Making maps that can handle bool type (EdgeMap) - /// needs some extra attention! - /// \todo Wrong documentation - template - class EdgeMap : public ReadWriteMap - { - public: - - ///\e - EdgeMap(const UndirGraph&) { } - ///\e - EdgeMap(const UndirGraph&, T) { } - ///Copy constructor - EdgeMap(const EdgeMap& em) : ReadWriteMap(em) { } - ///Assignment operator - EdgeMap& operator=(const EdgeMap&) { return *this; } - // \todo fix this concept - }; - - /// Read write map of the undirected edges to type \c T. - - /// Reference map of the edges to type \c T. - /// \sa Reference - /// \warning Making maps that can handle bool type (UndirEdgeMap) - /// needs some extra attention! - /// \todo Wrong documentation - template - class UndirEdgeMap : public ReadWriteMap - { - public: - - ///\e - UndirEdgeMap(const UndirGraph&) { } - ///\e - UndirEdgeMap(const UndirGraph&, T) { } - ///Copy constructor - UndirEdgeMap(const UndirEdgeMap& em) : ReadWriteMap(em) {} - ///Assignment operator - UndirEdgeMap &operator=(const UndirEdgeMap&) { return *this; } - // \todo fix this concept - }; - - /// \brief Direct the given undirected edge. - /// - /// Direct the given undirected edge. The returned edge source - /// will be the given edge. - Edge direct(const UndirEdge&, const Node&) const { - return INVALID; - } - - /// \brief Direct the given undirected edge. - /// - /// Direct the given undirected edge. The returned edge source - /// will be the source of the undirected edge if the given bool - /// is true. - Edge direct(const UndirEdge&, bool) const { - return INVALID; - } - - /// \brief Returns true if the edge has default orientation. - /// - /// Returns whether the given directed edge is same orientation as - /// the corresponding undirected edge. - bool direction(Edge) const { return true; } - - /// \brief Returns the opposite directed edge. - /// - /// Returns the opposite directed edge. - Edge oppositeEdge(Edge) const { return INVALID; } - - /// \brief Opposite node on an edge - /// - /// \return the opposite of the given Node on the given Edge - Node oppositeNode(Node, UndirEdge) const { return INVALID; } - - /// \brief First node of the undirected edge. - /// - /// \return the first node of the given UndirEdge. - /// - /// Naturally undirectected edges don't have direction and thus - /// don't have source and target node. But we use these two methods - /// to query the two endnodes of the edge. The direction of the edge - /// which arises this way is called the inherent direction of the - /// undirected edge, and is used to define the "default" direction - /// of the directed versions of the edges. - /// \sa direction - Node source(UndirEdge) const { return INVALID; } - - /// \brief Second node of the undirected edge. - Node target(UndirEdge) const { return INVALID; } - - /// \brief Source node of the directed edge. - Node source(Edge) const { return INVALID; } - - /// \brief Target node of the directed edge. - Node target(Edge) const { return INVALID; } - -// /// \brief First node of the graph -// /// -// /// \note This method is part of so called \ref -// /// developpers_interface "Developpers' interface", so it shouldn't -// /// be used in an end-user program. - void first(Node&) const {} -// /// \brief Next node of the graph -// /// -// /// \note This method is part of so called \ref -// /// developpers_interface "Developpers' interface", so it shouldn't -// /// be used in an end-user program. - void next(Node&) const {} - -// /// \brief First undirected edge of the graph -// /// -// /// \note This method is part of so called \ref -// /// developpers_interface "Developpers' interface", so it shouldn't -// /// be used in an end-user program. - void first(UndirEdge&) const {} -// /// \brief Next undirected edge of the graph -// /// -// /// \note This method is part of so called \ref -// /// developpers_interface "Developpers' interface", so it shouldn't -// /// be used in an end-user program. - void next(UndirEdge&) const {} - -// /// \brief First directed edge of the graph -// /// -// /// \note This method is part of so called \ref -// /// developpers_interface "Developpers' interface", so it shouldn't -// /// be used in an end-user program. - void first(Edge&) const {} -// /// \brief Next directed edge of the graph -// /// -// /// \note This method is part of so called \ref -// /// developpers_interface "Developpers' interface", so it shouldn't -// /// be used in an end-user program. - void next(Edge&) const {} - -// /// \brief First outgoing edge from a given node -// /// -// /// \note This method is part of so called \ref -// /// developpers_interface "Developpers' interface", so it shouldn't -// /// be used in an end-user program. - void firstOut(Edge&, Node) const {} -// /// \brief Next outgoing edge to a node -// /// -// /// \note This method is part of so called \ref -// /// developpers_interface "Developpers' interface", so it shouldn't -// /// be used in an end-user program. - void nextOut(Edge&) const {} - -// /// \brief First incoming edge to a given node -// /// -// /// \note This method is part of so called \ref -// /// developpers_interface "Developpers' interface", so it shouldn't -// /// be used in an end-user program. - void firstIn(Edge&, Node) const {} -// /// \brief Next incoming edge to a node -// /// -// /// \note This method is part of so called \ref -// /// developpers_interface "Developpers' interface", so it shouldn't -// /// be used in an end-user program. - void nextIn(Edge&) const {} - - - /// \brief Base node of the iterator - /// - /// Returns the base node (the source in this case) of the iterator - Node baseNode(OutEdgeIt e) const { - return source(e); - } - /// \brief Running node of the iterator - /// - /// Returns the running node (the target in this case) of the - /// iterator - Node runningNode(OutEdgeIt e) const { - return target(e); - } - - /// \brief Base node of the iterator - /// - /// Returns the base node (the target in this case) of the iterator - Node baseNode(InEdgeIt e) const { - return target(e); - } - /// \brief Running node of the iterator - /// - /// Returns the running node (the source in this case) of the - /// iterator - Node runningNode(InEdgeIt e) const { - return source(e); - } - - /// \brief Base node of the iterator - /// - /// Returns the base node of the iterator - Node baseNode(IncEdgeIt) const { - return INVALID; - } - - /// \brief Running node of the iterator - /// - /// Returns the running node of the iterator - Node runningNode(IncEdgeIt) const { - return INVALID; - } - - template - struct Constraints { - void constraints() { - checkConcept(); - checkConcept(); - checkConcept(); - } - }; - - }; - - /// \brief An empty non-static undirected graph class. - /// - /// This class provides everything that \ref UndirGraph does. - /// Additionally it enables building graphs from scratch. - class ExtendableUndirGraph : public UndirGraph { - public: - - /// \brief Add a new node to the graph. - /// - /// Add a new node to the graph. - /// \return the new node. - Node addNode(); - - /// \brief Add a new undirected edge to the graph. - /// - /// Add a new undirected edge to the graph. - /// \return the new edge. - UndirEdge addEdge(const Node& from, const Node& to); - - /// \brief Resets the graph. - /// - /// This function deletes all undirected edges and nodes of the graph. - /// It also frees the memory allocated to store them. - void clear() { } - - template - struct Constraints { - void constraints() { - checkConcept(); - checkConcept(); - checkConcept(); - - checkConcept(); - checkConcept(); - checkConcept(); - } - }; - - }; - - /// \brief An empty erasable undirected graph class. - /// - /// This class is an extension of \ref ExtendableUndirGraph. It makes it - /// possible to erase undirected edges or nodes. - class ErasableUndirGraph : public ExtendableUndirGraph { - public: - - /// \brief Deletes a node. - /// - /// Deletes a node. - /// - void erase(Node) { } - /// \brief Deletes an undirected edge. - /// - /// Deletes an undirected edge. - /// - void erase(UndirEdge) { } - - template - struct Constraints { - void constraints() { - checkConcept(); - checkConcept(); - } - }; - - }; - - /// @} - - } - -} - -#endif diff -r e225719bde6b -r 2d806130e700 lemon/edge_set.h --- a/lemon/edge_set.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/edge_set.h Thu Jan 26 15:42:13 2006 +0000 @@ -294,7 +294,7 @@ /// \ingroup semi_adaptors /// /// \brief Graph using a node set of another graph and an - /// own undir edge set. + /// own uedge set. /// /// This structure can be used to establish another graph over a node set /// of an existing one. The node iterator will go through the nodes of the @@ -307,25 +307,25 @@ /// In the edge extension and removing it conforms to the /// \ref concept::ExtendableGraph "ExtendableGraph" concept. template - class ListUndirEdgeSet : - public ErasableUndirEdgeSetExtender< - ClearableUndirEdgeSetExtender< - ExtendableUndirEdgeSetExtender< - MappableUndirEdgeSetExtender< - IterableUndirGraphExtender< - AlterableUndirEdgeSetExtender< - UndirGraphExtender< + class ListUEdgeSet : + public ErasableUEdgeSetExtender< + ClearableUEdgeSetExtender< + ExtendableUEdgeSetExtender< + MappableUEdgeSetExtender< + IterableUGraphExtender< + AlterableUEdgeSetExtender< + UGraphExtender< ListEdgeSetBase<_Graph> > > > > > > > { public: - typedef ErasableUndirEdgeSetExtender< - ClearableUndirEdgeSetExtender< - ExtendableUndirEdgeSetExtender< - MappableUndirEdgeSetExtender< - IterableUndirGraphExtender< - AlterableUndirEdgeSetExtender< - UndirGraphExtender< + typedef ErasableUEdgeSetExtender< + ClearableUEdgeSetExtender< + ExtendableUEdgeSetExtender< + MappableUEdgeSetExtender< + IterableUGraphExtender< + AlterableUEdgeSetExtender< + UGraphExtender< ListEdgeSetBase<_Graph> > > > > > > > Parent; typedef typename Parent::Node Node; @@ -354,7 +354,7 @@ public: typedef NodesImplBase Parent; - NodesImpl(const Graph& graph, ListUndirEdgeSet& edgeset) + NodesImpl(const Graph& graph, ListUEdgeSet& edgeset) : Parent(graph), _edgeset(edgeset) {} protected: @@ -375,7 +375,7 @@ } private: - ListUndirEdgeSet& _edgeset; + ListUEdgeSet& _edgeset; }; NodesImpl nodes; @@ -385,7 +385,7 @@ /// \brief Constructor of the adaptor. /// /// Constructor of the adaptor. - ListUndirEdgeSet(const Graph& graph) : nodes(graph, *this) { + ListUEdgeSet(const Graph& graph) : nodes(graph, *this) { Parent::initalize(graph, nodes); } diff -r e225719bde6b -r 2d806130e700 lemon/euler.h --- a/lemon/euler.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/euler.h Thu Jan 26 15:42:13 2006 +0000 @@ -124,18 +124,18 @@ ///the following code will print the edge IDs according to an ///Euler tour of \c g. ///\code - /// for(UndirEulerIt e(g),e!=INVALID;++e) { - /// std::cout << g.id(UndirEdge(e)) << std::eol; + /// for(UEulerIt e(g),e!=INVALID;++e) { + /// std::cout << g.id(UEdge(e)) << std::eol; /// } ///\endcode ///Although the iterator provides an Euler tour of an undirected graph, - ///in order to indicate the direction of the tour, UndirEulerIt + ///in order to indicate the direction of the tour, UEulerIt ///returns directed edges (that convert to the undirected ones, of course). /// ///If \c g is not Euler then the resulted tour will not be full or closed. ///\todo Test required template - class UndirEulerIt + class UEulerIt { typedef typename Graph::Node Node; typedef typename Graph::NodeIt NodeIt; @@ -146,7 +146,7 @@ const Graph &g; typename Graph::NodeMap nedge; - typename Graph::UndirEdgeMap visited; + typename Graph::UEdgeMap visited; std::list euler; public: @@ -156,7 +156,7 @@ ///\param _g An undirected graph. ///\param start The starting point of the tour. If it is not given /// the tour will start from the first node. - UndirEulerIt(const Graph &_g,typename Graph::Node start=INVALID) + UEulerIt(const Graph &_g,typename Graph::Node start=INVALID) : g(_g), nedge(g), visited(g,false) { if(start==INVALID) start=NodeIt(g); @@ -175,7 +175,7 @@ bool operator!=(Invalid) { return !euler.empty(); } ///Next edge of the tour - UndirEulerIt &operator++() { + UEulerIt &operator++() { Node s=g.target(euler.front()); euler.pop_front(); typename std::list::iterator next=euler.begin(); @@ -196,7 +196,7 @@ ///Postfix incrementation ///\warning This incrementation - ///returns an \c Edge, not an \ref UndirEulerIt, as one may + ///returns an \c Edge, not an \ref UEulerIt, as one may ///expect. Edge operator++(int) { @@ -224,7 +224,7 @@ #ifdef DOXYGEN bool #else - typename enable_if::type + typename enable_if::type euler(const Graph &g) { for(typename Graph::NodeIt n(g);n!=INVALID;++n) @@ -232,7 +232,7 @@ return connected(g); } template - typename disable_if::type + typename disable_if::type #endif euler(const Graph &g) { diff -r e225719bde6b -r 2d806130e700 lemon/full_graph.h --- a/lemon/full_graph.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/full_graph.h Thu Jan 26 15:42:13 2006 +0000 @@ -31,7 +31,7 @@ ///\ingroup graphs ///\file -///\brief FullGraph and UndirFullGraph classes. +///\brief FullGraph and FullUGraph classes. namespace lemon { @@ -213,19 +213,19 @@ }; - class UndirFullGraphBase { + class FullUGraphBase { int _nodeNum; int _edgeNum; public: - typedef UndirFullGraphBase Graph; + typedef FullUGraphBase Graph; class Node; class Edge; public: - UndirFullGraphBase() {} + FullUGraphBase() {} ///Creates a full graph with \c n nodes. @@ -301,7 +301,7 @@ class Node { - friend class UndirFullGraphBase; + friend class FullUGraphBase; protected: int id; @@ -317,7 +317,7 @@ class Edge { - friend class UndirFullGraphBase; + friend class FullUGraphBase; protected: int id; // _nodeNum * target + source; @@ -377,10 +377,10 @@ }; - typedef StaticMappableUndirGraphExtender< - IterableUndirGraphExtender< - AlterableUndirGraphExtender< - UndirGraphExtender > > > ExtendedUndirFullGraphBase; + typedef StaticMappableUGraphExtender< + IterableUGraphExtender< + AlterableUGraphExtender< + UGraphExtender > > > ExtendedFullUGraphBase; /// \ingroup graphs /// @@ -390,20 +390,20 @@ /// It is completely static, so you can neither add nor delete either /// edges or nodes. /// - /// The main difference beetween the \e FullGraph and \e UndirFullGraph class + /// The main difference beetween the \e FullGraph and \e FullUGraph class /// is that this class conforms to the undirected graph concept and /// it does not contain the loop edges. /// /// \sa FullGraph /// /// \author Balazs Dezso - class UndirFullGraph : public ExtendedUndirFullGraphBase { + class FullUGraph : public ExtendedFullUGraphBase { public: - UndirFullGraph(int n) { construct(n); } + FullUGraph(int n) { construct(n); } }; - class FullUndirBipartiteGraphBase { + class FullUBipartiteGraphBase { protected: int _upperNodeNum; @@ -415,12 +415,12 @@ class NodeSetError : public LogicError { virtual const char* exceptionName() const { - return "lemon::FullUndirBipartiteGraph::NodeSetError"; + return "lemon::FullUBipartiteGraph::NodeSetError"; } }; class Node { - friend class FullUndirBipartiteGraphBase; + friend class FullUBipartiteGraphBase; protected: int id; @@ -434,7 +434,7 @@ }; class Edge { - friend class FullUndirBipartiteGraphBase; + friend class FullUBipartiteGraphBase; protected: int id; @@ -575,19 +575,19 @@ }; - typedef StaticMappableUndirBipartiteGraphExtender< - IterableUndirBipartiteGraphExtender< - AlterableUndirBipartiteGraphExtender< - UndirBipartiteGraphExtender < - FullUndirBipartiteGraphBase> > > > - ExtendedFullUndirBipartiteGraphBase; + typedef StaticMappableUBipartiteGraphExtender< + IterableUBipartiteGraphExtender< + AlterableUBipartiteGraphExtender< + UBipartiteGraphExtender < + FullUBipartiteGraphBase> > > > + ExtendedFullUBipartiteGraphBase; - class FullUndirBipartiteGraph : - public ExtendedFullUndirBipartiteGraphBase { + class FullUBipartiteGraph : + public ExtendedFullUBipartiteGraphBase { public: - typedef ExtendedFullUndirBipartiteGraphBase Parent; - FullUndirBipartiteGraph(int upperNodeNum, int lowerNodeNum) { + typedef ExtendedFullUBipartiteGraphBase Parent; + FullUBipartiteGraph(int upperNodeNum, int lowerNodeNum) { Parent::construct(upperNodeNum, lowerNodeNum); } }; diff -r e225719bde6b -r 2d806130e700 lemon/graph_adaptor.h --- a/lemon/graph_adaptor.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/graph_adaptor.h Thu Jan 26 15:42:13 2006 +0000 @@ -672,31 +672,31 @@ }; template - class UndirGraphAdaptorBase : - public UndirGraphExtender > { + class UGraphAdaptorBase : + public UGraphExtender > { public: typedef _Graph Graph; - typedef UndirGraphExtender > Parent; + typedef UGraphExtender > Parent; protected: - UndirGraphAdaptorBase() : Parent() { } + UGraphAdaptorBase() : Parent() { } public: - typedef typename Parent::UndirEdge UndirEdge; + typedef typename Parent::UEdge UEdge; typedef typename Parent::Edge Edge; template class EdgeMap { protected: - const UndirGraphAdaptorBase<_Graph>* g; + const UGraphAdaptorBase<_Graph>* g; template friend class EdgeMap; typename _Graph::template EdgeMap forward_map, backward_map; public: typedef T Value; typedef Edge Key; - EdgeMap(const UndirGraphAdaptorBase<_Graph>& _g) : g(&_g), + EdgeMap(const UGraphAdaptorBase<_Graph>& _g) : g(&_g), forward_map(*(g->graph)), backward_map(*(g->graph)) { } - EdgeMap(const UndirGraphAdaptorBase<_Graph>& _g, T a) : g(&_g), + EdgeMap(const UGraphAdaptorBase<_Graph>& _g, T a) : g(&_g), forward_map(*(g->graph), a), backward_map(*(g->graph), a) { } void set(Edge e, T a) { @@ -715,24 +715,24 @@ }; template - class UndirEdgeMap { - template friend class UndirEdgeMap; + class UEdgeMap { + template friend class UEdgeMap; typename _Graph::template EdgeMap map; public: typedef T Value; - typedef UndirEdge Key; + typedef UEdge Key; - UndirEdgeMap(const UndirGraphAdaptorBase<_Graph>& g) : + UEdgeMap(const UGraphAdaptorBase<_Graph>& g) : map(*(g.graph)) { } - UndirEdgeMap(const UndirGraphAdaptorBase<_Graph>& g, T a) : + UEdgeMap(const UGraphAdaptorBase<_Graph>& g, T a) : map(*(g.graph), a) { } - void set(UndirEdge e, T a) { + void set(UEdge e, T a) { map.set(e, a); } - T operator[](UndirEdge e) const { + T operator[](UEdge e) const { return map[e]; } }; @@ -746,17 +746,17 @@ /// /// \author Marton Makai template - class UndirGraphAdaptor : - public IterableUndirGraphExtender< - UndirGraphAdaptorBase<_Graph> > { + class UGraphAdaptor : + public IterableUGraphExtender< + UGraphAdaptorBase<_Graph> > { public: typedef _Graph Graph; - typedef IterableUndirGraphExtender< - UndirGraphAdaptorBase<_Graph> > Parent; + typedef IterableUGraphExtender< + UGraphAdaptorBase<_Graph> > Parent; protected: - UndirGraphAdaptor() { } + UGraphAdaptor() { } public: - UndirGraphAdaptor(_Graph& _graph) { + UGraphAdaptor(_Graph& _graph) { setGraph(_graph); } }; diff -r e225719bde6b -r 2d806130e700 lemon/graph_reader.h --- a/lemon/graph_reader.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/graph_reader.h Thu Jan 26 15:42:13 2006 +0000 @@ -378,7 +378,7 @@ /// \brief The undirected graph reader class. /// - /// The \c UndirGraphReader class provides the graph input. + /// The \c UGraphReader class provides the graph input. /// Before you read this documentation it might be useful to read the general /// description of \ref graph-io-page "Graph Input-Output". /// @@ -390,8 +390,8 @@ /// edges. /// /// If you read a graph you need not read all the maps and items just those - /// that you need. The interface of the \c UndirGraphReader is very similar - /// to the UndirGraphWriter but the reading method does not depend on the + /// that you need. The interface of the \c UGraphReader is very similar + /// to the UGraphWriter but the reading method does not depend on the /// order of the given commands. /// /// The reader object suppose that each not readed value does not contain @@ -399,7 +399,7 @@ /// it should skip the values when the string representation contains spaces. /// /// \code - /// UndirGraphReader reader(std::cin, graph); + /// UGraphReader reader(std::cin, graph); /// \endcode /// /// The \c readNodeMap() function reads a map from the \c \@nodeset section. @@ -416,11 +416,11 @@ /// reader.readNodeMap("color", colorMap); /// \endcode /// - /// With the \c readUndirEdgeMap() member function you can give an - /// undir edge map reading command similar to the NodeMaps. + /// With the \c readUEdgeMap() member function you can give an + /// uedge map reading command similar to the NodeMaps. /// /// \code - /// reader.readUndirEdgeMap("capacity", capacityMap); + /// reader.readUEdgeMap("capacity", capacityMap); /// \endcode /// /// The reading of the directed edge maps is just a syntactical sugar. @@ -432,14 +432,14 @@ /// reader.readEdgeMap("flow", flowMap); /// \endcode /// - /// With \c readNode() and \c readUndirEdge() functions you can read - /// labeled Nodes and UndirEdges. + /// With \c readNode() and \c readUEdge() functions you can read + /// labeled Nodes and UEdges. /// /// \code /// reader.readNode("source", sourceNode); /// reader.readNode("target", targetNode); /// - /// reader.readUndirEdge("observed", undirEdge); + /// reader.readUEdge("observed", uEdge); /// \endcode /// /// With the \c readAttribute() functions you can read an attribute @@ -455,69 +455,69 @@ /// /// \see GraphReader /// \see DefaultReaderTraits - /// \see \ref UndirGraphWriter + /// \see \ref UGraphWriter /// \see \ref graph-io-page /// /// \author Balazs Dezso template - class UndirGraphReader { + class UGraphReader { public: typedef _Graph Graph; typedef typename Graph::Node Node; typedef typename Graph::Edge Edge; - typedef typename Graph::UndirEdge UndirEdge; + typedef typename Graph::UEdge UEdge; typedef _ReaderTraits ReaderTraits; typedef typename ReaderTraits::Skipper DefaultSkipper; - /// \brief Construct a new UndirGraphReader. + /// \brief Construct a new UGraphReader. /// - /// Construct a new UndirGraphReader. It reads into the given graph + /// Construct a new UGraphReader. It reads into the given graph /// and it use the given reader as the default skipper. - UndirGraphReader(std::istream& _is, Graph& _graph, + UGraphReader(std::istream& _is, Graph& _graph, const DefaultSkipper& _skipper = DefaultSkipper()) : reader(new LemonReader(_is)), own_reader(true), skipper(_skipper), nodeset_reader(*reader, _graph, std::string(), skipper), - undir_edgeset_reader(*reader, _graph, nodeset_reader, + u_edgeset_reader(*reader, _graph, nodeset_reader, std::string(), skipper), node_reader(*reader, nodeset_reader, std::string()), - undir_edge_reader(*reader, undir_edgeset_reader, std::string()), + u_edge_reader(*reader, u_edgeset_reader, std::string()), attribute_reader(*reader, std::string()) {} - /// \brief Construct a new UndirGraphReader. + /// \brief Construct a new UGraphReader. /// - /// Construct a new UndirGraphReader. It reads into the given graph + /// Construct a new UGraphReader. It reads into the given graph /// and it use the given reader as the default skipper. - UndirGraphReader(const std::string& _filename, Graph& _graph, + UGraphReader(const std::string& _filename, Graph& _graph, const DefaultSkipper& _skipper = DefaultSkipper()) : reader(new LemonReader(_filename)), own_reader(true), skipper(_skipper), nodeset_reader(*reader, _graph, std::string(), skipper), - undir_edgeset_reader(*reader, _graph, nodeset_reader, + u_edgeset_reader(*reader, _graph, nodeset_reader, std::string(), skipper), node_reader(*reader, nodeset_reader, std::string()), - undir_edge_reader(*reader, undir_edgeset_reader, std::string()), + u_edge_reader(*reader, u_edgeset_reader, std::string()), attribute_reader(*reader, std::string()) {} - /// \brief Construct a new UndirGraphReader. + /// \brief Construct a new UGraphReader. /// - /// Construct a new UndirGraphReader. It reads into the given graph + /// Construct a new UGraphReader. It reads into the given graph /// and it use the given reader as the default skipper. - UndirGraphReader(LemonReader& _reader, Graph& _graph, + UGraphReader(LemonReader& _reader, Graph& _graph, const DefaultSkipper& _skipper = DefaultSkipper()) : reader(_reader), own_reader(false), skipper(_skipper), nodeset_reader(*reader, _graph, std::string(), skipper), - undir_edgeset_reader(*reader, _graph, nodeset_reader, + u_edgeset_reader(*reader, _graph, nodeset_reader, std::string(), skipper), node_reader(*reader, nodeset_reader, std::string()), - undir_edge_reader(*reader, undir_edgeset_reader, std::string()), + u_edge_reader(*reader, u_edgeset_reader, std::string()), attribute_reader(*reader, std::string()) {} /// \brief Destruct the graph reader. /// /// Destruct the graph reader. - ~UndirGraphReader() { + ~UGraphReader() { if (own_reader) delete reader; } @@ -526,13 +526,13 @@ /// /// Give a new node map reading command to the reader. template - UndirGraphReader& readNodeMap(std::string name, Map& map) { + UGraphReader& readNodeMap(std::string name, Map& map) { nodeset_reader.readNodeMap(name, map); return *this; } template - UndirGraphReader& readNodeMap(std::string name, const Map& map) { + UGraphReader& readNodeMap(std::string name, const Map& map) { nodeset_reader.readNodeMap(name, map); return *this; } @@ -541,14 +541,14 @@ /// /// Give a new node map reading command to the reader. template - UndirGraphReader& readNodeMap(std::string name, Map& map, + UGraphReader& readNodeMap(std::string name, Map& map, const Reader& reader = Reader()) { nodeset_reader.readNodeMap(name, map, reader); return *this; } template - UndirGraphReader& readNodeMap(std::string name, const Map& map, + UGraphReader& readNodeMap(std::string name, const Map& map, const Reader& reader = Reader()) { nodeset_reader.readNodeMap(name, map, reader); return *this; @@ -558,7 +558,7 @@ /// /// Give a new node map skipping command to the reader. template - UndirGraphReader& skipNodeMap(std::string name, + UGraphReader& skipNodeMap(std::string name, const Reader& reader = Reader()) { nodeset_reader.skipNodeMap(name, reader); return *this; @@ -568,14 +568,14 @@ /// /// Give a new undirected edge map reading command to the reader. template - UndirGraphReader& readUndirEdgeMap(std::string name, Map& map) { - undir_edgeset_reader.readUndirEdgeMap(name, map); + UGraphReader& readUEdgeMap(std::string name, Map& map) { + u_edgeset_reader.readUEdgeMap(name, map); return *this; } template - UndirGraphReader& readUndirEdgeMap(std::string name, const Map& map) { - undir_edgeset_reader.readUndirEdgeMap(name, map); + UGraphReader& readUEdgeMap(std::string name, const Map& map) { + u_edgeset_reader.readUEdgeMap(name, map); return *this; } @@ -584,16 +584,16 @@ /// /// Give a new undirected edge map reading command to the reader. template - UndirGraphReader& readUndirEdgeMap(std::string name, Map& map, + UGraphReader& readUEdgeMap(std::string name, Map& map, const Reader& reader = Reader()) { - undir_edgeset_reader.readUndirEdgeMap(name, map, reader); + u_edgeset_reader.readUEdgeMap(name, map, reader); return *this; } template - UndirGraphReader& readUndirEdgeMap(std::string name, const Map& map, + UGraphReader& readUEdgeMap(std::string name, const Map& map, const Reader& reader = Reader()) { - undir_edgeset_reader.readUndirEdgeMap(name, map, reader); + u_edgeset_reader.readUEdgeMap(name, map, reader); return *this; } @@ -601,9 +601,9 @@ /// /// Give a new undirected edge map skipping command to the reader. template - UndirGraphReader& skipUndirEdgeMap(std::string name, + UGraphReader& skipUEdgeMap(std::string name, const Reader& reader = Reader()) { - undir_edgeset_reader.skipUndirMap(name, reader); + u_edgeset_reader.skipUMap(name, reader); return *this; } @@ -612,14 +612,14 @@ /// /// Give a new edge map reading command to the reader. template - UndirGraphReader& readEdgeMap(std::string name, Map& map) { - undir_edgeset_reader.readEdgeMap(name, map); + UGraphReader& readEdgeMap(std::string name, Map& map) { + u_edgeset_reader.readEdgeMap(name, map); return *this; } template - UndirGraphReader& readEdgeMap(std::string name, const Map& map) { - undir_edgeset_reader.readEdgeMap(name, map); + UGraphReader& readEdgeMap(std::string name, const Map& map) { + u_edgeset_reader.readEdgeMap(name, map); return *this; } @@ -628,16 +628,16 @@ /// /// Give a new edge map reading command to the reader. template - UndirGraphReader& readEdgeMap(std::string name, Map& map, + UGraphReader& readEdgeMap(std::string name, Map& map, const Reader& reader = Reader()) { - undir_edgeset_reader.readEdgeMap(name, map, reader); + u_edgeset_reader.readEdgeMap(name, map, reader); return *this; } template - UndirGraphReader& readEdgeMap(std::string name, const Map& map, + UGraphReader& readEdgeMap(std::string name, const Map& map, const Reader& reader = Reader()) { - undir_edgeset_reader.readEdgeMap(name, map, reader); + u_edgeset_reader.readEdgeMap(name, map, reader); return *this; } @@ -645,16 +645,16 @@ /// /// Give a new edge map skipping command to the reader. template - UndirGraphReader& skipEdgeMap(std::string name, + UGraphReader& skipEdgeMap(std::string name, const Reader& reader = Reader()) { - undir_edgeset_reader.skipEdgeMap(name, reader); + u_edgeset_reader.skipEdgeMap(name, reader); return *this; } /// \brief Give a new labeled node reading command to the reader. /// /// Give a new labeled node reading command to the reader. - UndirGraphReader& readNode(std::string name, Node& node) { + UGraphReader& readNode(std::string name, Node& node) { node_reader.readNode(name, node); return *this; } @@ -662,23 +662,23 @@ /// \brief Give a new labeled edge reading command to the reader. /// /// Give a new labeled edge reading command to the reader. - UndirGraphReader& readEdge(std::string name, Edge& edge) { - undir_edge_reader.readEdge(name, edge); + UGraphReader& readEdge(std::string name, Edge& edge) { + u_edge_reader.readEdge(name, edge); } /// \brief Give a new labeled undirected edge reading command to the /// reader. /// /// Give a new labeled undirected edge reading command to the reader. - UndirGraphReader& readUndirEdge(std::string name, UndirEdge& edge) { - undir_edge_reader.readUndirEdge(name, edge); + UGraphReader& readUEdge(std::string name, UEdge& edge) { + u_edge_reader.readUEdge(name, edge); } /// \brief Give a new attribute reading command. /// /// Give a new attribute reading command. template - UndirGraphReader& readAttribute(std::string name, Value& value) { + UGraphReader& readAttribute(std::string name, Value& value) { attribute_reader.readAttribute(name, value); return *this; } @@ -687,7 +687,7 @@ /// /// Give a new attribute reading command. template - UndirGraphReader& readAttribute(std::string name, Value& value, + UGraphReader& readAttribute(std::string name, Value& value, const Reader& reader) { attribute_reader.readAttribute(name, value, reader); return *this; @@ -716,7 +716,7 @@ /// \brief Returns true if the reader can give back the items by its label. bool isLabelReader() const { return nodeset_reader.isLabelReader() && - undir_edgeset_reader.isLabelReader(); + u_edgeset_reader.isLabelReader(); } /// \brief Gives back the node by its label. @@ -732,7 +732,7 @@ /// It reads an label from the stream and gives back which edge belongs to /// it. It is possible only if there was read an "label" named edge map. void readLabel(std::istream& is, Edge& edge) const { - return undir_edgeset_reader.readLabel(is, edge); + return u_edgeset_reader.readLabel(is, edge); } /// \brief Gives back the undirected edge by its label. @@ -740,8 +740,8 @@ /// It reads an label from the stream and gives back which undirected edge /// belongs to it. It is possible only if there was read an "label" named /// edge map. - void readLabel(std::istream& is, UndirEdge& uedge) const { - return undir_edgeset_reader.readLabel(is, uedge); + void readLabel(std::istream& is, UEdge& uedge) const { + return u_edgeset_reader.readLabel(is, uedge); } @@ -753,10 +753,10 @@ DefaultSkipper skipper; NodeSetReader nodeset_reader; - UndirEdgeSetReader undir_edgeset_reader; + UEdgeSetReader u_edgeset_reader; NodeReader node_reader; - UndirEdgeReader undir_edge_reader; + UEdgeReader u_edge_reader; AttributeReader attribute_reader; }; @@ -764,7 +764,7 @@ /// \brief Read an undirected graph from the input. /// /// It is a helper function to read an undirected graph from the given input - /// stream. It gives back an UndirGraphReader object and this object + /// stream. It gives back an UGraphReader object and this object /// can read more maps, labeled nodes, edges, undirected edges and /// attributes. /// @@ -773,14 +773,14 @@ /// \param is The input stream. /// \param g The graph. template - UndirGraphReader undirGraphReader(std::istream& is, Graph &g) { + UGraphReader uGraphReader(std::istream& is, Graph &g) { return GraphReader(is, g); } /// \brief Read an undirected graph from the input. /// /// It is a helper function to read an undirected graph from the given input - /// file. It gives back an UndirGraphReader object and this object + /// file. It gives back an UGraphReader object and this object /// can read more maps, labeled nodes, edges, undirected edges and /// attributes. /// @@ -789,7 +789,7 @@ /// \param fn The input filename. /// \param g The graph. template - UndirGraphReader undirGraphReader(const std::string& fn, Graph &g) { + UGraphReader uGraphReader(const std::string& fn, Graph &g) { return GraphReader(fn, g); } diff -r e225719bde6b -r 2d806130e700 lemon/graph_to_eps.h --- a/lemon/graph_to_eps.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/graph_to_eps.h Thu Jan 26 15:42:13 2006 +0000 @@ -234,7 +234,7 @@ ConstMap _nodePsTexts; char *_nodePsTextsPreamble; - bool _undir; + bool _u; bool _pleaseRemoveOsStream; bool _scaleToA4; @@ -272,7 +272,7 @@ _enableParallel(false), _parEdgeDist(1), _showNodeText(false), _nodeTexts(false), _nodeTextSize(1), _showNodePsText(false), _nodePsTexts(false), _nodePsTextsPreamble(0), - _undir(false), + _u(false), _pleaseRemoveOsStream(_pros), _scaleToA4(false), _nodeTextColorType(SAME_COL), _nodeTextColors(Color(0,0,0)), _autoNodeScale(false), @@ -329,7 +329,7 @@ using T::_nodePsTexts; using T::_nodePsTextsPreamble; - using T::_undir; + using T::_u; using T::_pleaseRemoveOsStream; using T::_scaleToA4; @@ -734,12 +734,12 @@ ///Sets whether the the graph is undirected /// - GraphToEps &undir(bool b=true) {_undir=b;return *this;} + GraphToEps &u(bool b=true) {_u=b;return *this;} ///Sets whether the the graph is directed ///Sets whether the the graph is directed. ///Use it to show the undirected edges as a pair of directed ones. - GraphToEps &bidir(bool b=true) {_undir=!b;return *this;} + GraphToEps &bidir(bool b=true) {_u=!b;return *this;} ///Sets the title. @@ -958,7 +958,7 @@ if(_enableParallel) { std::vector el; for(EdgeIt e(g);e!=INVALID;++e) - if((!_undir||g.source(e)0) + if((!_u||g.source(e)0) el.push_back(e); std::sort(el.begin(),el.end(),edgeLess(g)); @@ -1046,7 +1046,7 @@ } } else for(EdgeIt e(g);e!=INVALID;++e) - if((!_undir||g.source(e)0) + if((!_u||g.source(e)0) if(_drawArrows) { xy d(mycoords[g.target(e)]-mycoords[g.source(e)]); double rn=_nodeSizes[g.target(e)]*_nodeScale; diff -r e225719bde6b -r 2d806130e700 lemon/graph_utils.h --- a/lemon/graph_utils.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/graph_utils.h Thu Jan 26 15:42:13 2006 +0000 @@ -71,8 +71,8 @@ ///This \c \#define creates the same convenience typedefs as defined by ///\ref GRAPH_TYPEDEFS(Graph) and three more, namely it creates - ///\c UndirEdge, \c UndirEdgeIt, \c IncEdgeIt, - ///\c BoolUndirEdgeMap, \c IntUndirEdgeMap, \c DoubleUndirEdgeMap. + ///\c UEdge, \c UEdgeIt, \c IncEdgeIt, + ///\c BoolUEdgeMap, \c IntUEdgeMap, \c DoubleUEdgeMap. /// ///\note If \c G it a template parameter, it should be used in this way. ///\code @@ -83,12 +83,12 @@ ///template typedefs in C++. #define UNDIRGRAPH_TYPEDEFS(Graph) \ GRAPH_TYPEDEFS(Graph) \ - typedef Graph:: UndirEdge UndirEdge; \ - typedef Graph:: UndirEdgeIt UndirEdgeIt; \ + typedef Graph:: UEdge UEdge; \ + typedef Graph:: UEdgeIt UEdgeIt; \ typedef Graph:: IncEdgeIt IncEdgeIt; -// typedef Graph::template UndirEdgeMap BoolUndirEdgeMap; -// typedef Graph::template UndirEdgeMap IntUndirEdgeMap; -// typedef Graph::template UndirEdgeMap DoubleUndirEdgeMap; +// typedef Graph::template UEdgeMap BoolUEdgeMap; +// typedef Graph::template UEdgeMap IntUEdgeMap; +// typedef Graph::template UEdgeMap DoubleUEdgeMap; @@ -162,13 +162,13 @@ template inline typename enable_if::type - _countUndirEdges(const Graph &g) { - return g.undirEdgeNum(); + _countUEdges(const Graph &g) { + return g.uEdgeNum(); } template - inline int _countUndirEdges(Wrap w) { - return countItems(w.value); + inline int _countUEdges(Wrap w) { + return countItems(w.value); } /// \brief Function to count the undirected edges in the graph. @@ -178,8 +178,8 @@ /// graph structures it is specialized to run in O(1). template - inline int countUndirEdges(const Graph& g) { - return _countUndirEdges(g); + inline int countUEdges(const Graph& g) { + return _countUEdges(g); } @@ -325,19 +325,19 @@ inline typename enable_if< typename Graph::FindEdgeTag, - typename Graph::UndirEdge>::type - _findUndirEdge(const Graph &g, + typename Graph::UEdge>::type + _findUEdge(const Graph &g, typename Graph::Node u, typename Graph::Node v, - typename Graph::UndirEdge prev = INVALID) { - return g.findUndirEdge(u, v, prev); + typename Graph::UEdge prev = INVALID) { + return g.findUEdge(u, v, prev); } template - inline typename Graph::UndirEdge - _findUndirEdge(Wrap w, + inline typename Graph::UEdge + _findUEdge(Wrap w, typename Graph::Node u, typename Graph::Node v, - typename Graph::UndirEdge prev = INVALID) { + typename Graph::UEdge prev = INVALID) { const Graph& g = w.value; if (prev == INVALID) { typename Graph::OutEdgeIt e(g, u); @@ -350,9 +350,9 @@ } } - /// \brief Finds an undir edge between two nodes of a graph. + /// \brief Finds an uedge between two nodes of a graph. /// - /// Finds an undir edge from node \c u to node \c v in graph \c g. + /// Finds an uedge from node \c u to node \c v in graph \c g. /// /// If \c prev is \ref INVALID (this is the default value), then /// it finds the first edge from \c u to \c v. Otherwise it looks for @@ -361,63 +361,63 @@ /// /// Thus you can iterate through each edge from \c u to \c v as it follows. /// \code - /// for(UndirEdge e = findUndirEdge(g,u,v); e != INVALID; - /// e = findUndirEdge(g,u,v,e)) { + /// for(UEdge e = findUEdge(g,u,v); e != INVALID; + /// e = findUEdge(g,u,v,e)) { /// ... /// } /// \endcode // /// \todo We may want to use the "GraphBase" // /// interface here... template - inline typename Graph::UndirEdge - findUndirEdge(const Graph &g, + inline typename Graph::UEdge + findUEdge(const Graph &g, typename Graph::Node u, typename Graph::Node v, - typename Graph::UndirEdge prev = INVALID) { - return _findUndirEdge(g, u, v, prev); + typename Graph::UEdge prev = INVALID) { + return _findUEdge(g, u, v, prev); } - /// \brief Iterator for iterating on undir edges connected the same nodes. + /// \brief Iterator for iterating on uedges connected the same nodes. /// - /// Iterator for iterating on undir edges connected the same nodes. It is - /// higher level interface for the findUndirEdge() function. You can + /// Iterator for iterating on uedges connected the same nodes. It is + /// higher level interface for the findUEdge() function. You can /// use it the following way: /// \code - /// for (ConUndirEdgeIt it(g, src, trg); it != INVALID; ++it) { + /// for (ConUEdgeIt it(g, src, trg); it != INVALID; ++it) { /// ... /// } /// \endcode /// /// \author Balazs Dezso template - class ConUndirEdgeIt : public _Graph::UndirEdge { + class ConUEdgeIt : public _Graph::UEdge { public: typedef _Graph Graph; - typedef typename Graph::UndirEdge Parent; + typedef typename Graph::UEdge Parent; - typedef typename Graph::UndirEdge UndirEdge; + typedef typename Graph::UEdge UEdge; typedef typename Graph::Node Node; /// \brief Constructor. /// - /// Construct a new ConUndirEdgeIt iterating on the edges which + /// Construct a new ConUEdgeIt iterating on the edges which /// connects the \c u and \c v node. - ConUndirEdgeIt(const Graph& g, Node u, Node v) : graph(g) { - Parent::operator=(findUndirEdge(graph, u, v)); + ConUEdgeIt(const Graph& g, Node u, Node v) : graph(g) { + Parent::operator=(findUEdge(graph, u, v)); } /// \brief Constructor. /// - /// Construct a new ConUndirEdgeIt which continues the iterating from + /// Construct a new ConUEdgeIt which continues the iterating from /// the \c e edge. - ConUndirEdgeIt(const Graph& g, UndirEdge e) : Parent(e), graph(g) {} + ConUEdgeIt(const Graph& g, UEdge e) : Parent(e), graph(g) {} /// \brief Increment operator. /// /// It increments the iterator and gives back the next edge. - ConUndirEdgeIt& operator++() { - Parent::operator=(findUndirEdge(graph, graph.source(*this), + ConUEdgeIt& operator++() { + Parent::operator=(findUEdge(graph, graph.source(*this), graph.target(*this), *this)); return *this; } @@ -596,53 +596,53 @@ /// \brief Class to copy an undirected graph. /// /// Class to copy an undirected graph to an other graph (duplicate a graph). - /// The simplest way of using it is through the \c copyUndirGraph() function. + /// The simplest way of using it is through the \c copyUGraph() function. template - class UndirGraphCopy { + class UGraphCopy { public: typedef typename Source::Node Node; typedef typename Source::NodeIt NodeIt; typedef typename Source::Edge Edge; typedef typename Source::EdgeIt EdgeIt; - typedef typename Source::UndirEdge UndirEdge; - typedef typename Source::UndirEdgeIt UndirEdgeIt; + typedef typename Source::UEdge UEdge; + typedef typename Source::UEdgeIt UEdgeIt; typedef typename Source:: template NodeMap NodeRefMap; typedef typename Source:: - template UndirEdgeMap UndirEdgeRefMap; + template UEdgeMap UEdgeRefMap; private: struct EdgeRefMap { - EdgeRefMap(UndirGraphCopy& _gc) : gc(_gc) {} + EdgeRefMap(UGraphCopy& _gc) : gc(_gc) {} typedef typename Source::Edge Key; typedef typename Target::Edge Value; Value operator[](const Key& key) { - return gc.target.direct(gc.undirEdgeRef[key], + return gc.target.direct(gc.uEdgeRef[key], gc.target.direction(key)); } - UndirGraphCopy& gc; + UGraphCopy& gc; }; public: - /// \brief Constructor for the UndirGraphCopy. + /// \brief Constructor for the UGraphCopy. /// /// It copies the content of the \c _source graph into the /// \c _target graph. It creates also two references, one beetween /// the two nodeset and one beetween the two edgesets. - UndirGraphCopy(Target& _target, const Source& _source) + UGraphCopy(Target& _target, const Source& _source) : source(_source), target(_target), - nodeRefMap(_source), edgeRefMap(*this), undirEdgeRefMap(_source) { + nodeRefMap(_source), edgeRefMap(*this), uEdgeRefMap(_source) { for (NodeIt it(source); it != INVALID; ++it) { nodeRefMap[it] = target.addNode(); } - for (UndirEdgeIt it(source); it != INVALID; ++it) { - undirEdgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)], + for (UEdgeIt it(source); it != INVALID; ++it) { + uEdgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)], nodeRefMap[source.target(it)]); } } @@ -651,7 +651,7 @@ /// /// Copies the node references into the given map. template - const UndirGraphCopy& nodeRef(NodeRef& map) const { + const UGraphCopy& nodeRef(NodeRef& map) const { for (NodeIt it(source); it != INVALID; ++it) { map.set(it, nodeRefMap[it]); } @@ -662,7 +662,7 @@ /// /// Reverse and copies the node references into the given map. template - const UndirGraphCopy& nodeCrossRef(NodeRef& map) const { + const UGraphCopy& nodeCrossRef(NodeRef& map) const { for (NodeIt it(source); it != INVALID; ++it) { map.set(nodeRefMap[it], it); } @@ -673,7 +673,7 @@ /// /// Copies the edge references into the given map. template - const UndirGraphCopy& edgeRef(EdgeRef& map) const { + const UGraphCopy& edgeRef(EdgeRef& map) const { for (EdgeIt it(source); it != INVALID; ++it) { map.set(edgeRefMap[it], it); } @@ -685,7 +685,7 @@ /// /// Reverse and copies the undirected edge references into the given map. template - const UndirGraphCopy& edgeCrossRef(EdgeRef& map) const { + const UGraphCopy& edgeCrossRef(EdgeRef& map) const { for (EdgeIt it(source); it != INVALID; ++it) { map.set(it, edgeRefMap[it]); } @@ -696,9 +696,9 @@ /// /// Copies the undirected edge references into the given map. template - const UndirGraphCopy& undirEdgeRef(EdgeRef& map) const { - for (UndirEdgeIt it(source); it != INVALID; ++it) { - map.set(it, undirEdgeRefMap[it]); + const UGraphCopy& uEdgeRef(EdgeRef& map) const { + for (UEdgeIt it(source); it != INVALID; ++it) { + map.set(it, uEdgeRefMap[it]); } return *this; } @@ -708,9 +708,9 @@ /// /// Reverse and copies the undirected edge references into the given map. template - const UndirGraphCopy& undirEdgeCrossRef(EdgeRef& map) const { - for (UndirEdgeIt it(source); it != INVALID; ++it) { - map.set(undirEdgeRefMap[it], it); + const UGraphCopy& uEdgeCrossRef(EdgeRef& map) const { + for (UEdgeIt it(source); it != INVALID; ++it) { + map.set(uEdgeRefMap[it], it); } return *this; } @@ -722,7 +722,7 @@ /// and the copied map's key type is the source graph's node /// type. template - const UndirGraphCopy& nodeMap(TargetMap& tMap, + const UGraphCopy& nodeMap(TargetMap& tMap, const SourceMap& sMap) const { copyMap(tMap, sMap, NodeIt(source), nodeRefMap); return *this; @@ -735,7 +735,7 @@ /// and the copied map's key type is the source graph's edge /// type. template - const UndirGraphCopy& edgeMap(TargetMap& tMap, + const UGraphCopy& edgeMap(TargetMap& tMap, const SourceMap& sMap) const { copyMap(tMap, sMap, EdgeIt(source), edgeRefMap); return *this; @@ -748,9 +748,9 @@ /// and the copied map's key type is the source graph's edge /// type. template - const UndirGraphCopy& undirEdgeMap(TargetMap& tMap, + const UGraphCopy& uEdgeMap(TargetMap& tMap, const SourceMap& sMap) const { - copyMap(tMap, sMap, UndirEdgeIt(source), undirEdgeRefMap); + copyMap(tMap, sMap, UEdgeIt(source), uEdgeRefMap); return *this; } @@ -768,11 +768,11 @@ return edgeRefMap; } - /// \brief Gives back the stored undir edge references. + /// \brief Gives back the stored uedge references. /// - /// Gives back the stored undir edge references. - const UndirEdgeRefMap& undirEdgeRef() const { - return undirEdgeRefMap; + /// Gives back the stored uedge references. + const UEdgeRefMap& uEdgeRef() const { + return uEdgeRefMap; } void run() {} @@ -784,7 +784,7 @@ NodeRefMap nodeRefMap; EdgeRefMap edgeRefMap; - UndirEdgeRefMap undirEdgeRefMap; + UEdgeRefMap uEdgeRefMap; }; /// \brief Copy a graph to an other graph. @@ -801,9 +801,9 @@ /// contain the mapping from the target graph's edges to the source's /// edges. template - UndirGraphCopy - copyUndirGraph(Target& target, const Source& source) { - return UndirGraphCopy(target, source); + UGraphCopy + copyUGraph(Target& target, const Source& source) { + return UGraphCopy(target, source); } @@ -905,7 +905,7 @@ typedef _Map Map; typedef _Graph Graph; - /// The key type of InvertableMap (Node, Edge, UndirEdge). + /// The key type of InvertableMap (Node, Edge, UEdge). typedef typename _Map::Key Key; /// The value type of the InvertableMap. typedef typename _Map::Value Value; @@ -1036,7 +1036,7 @@ /// /// \param _Graph The graph class the \c DescriptorMap belongs to. /// \param _Item The Item is the Key of the Map. It may be Node, Edge or - /// UndirEdge. + /// UEdge. #ifndef DOXYGEN /// \param _Map A ReadWriteMap mapping from the item type to integer. template < @@ -1055,7 +1055,7 @@ /// The graph class of DescriptorMap. typedef _Graph Graph; - /// The key type of DescriptorMap (Node, Edge, UndirEdge). + /// The key type of DescriptorMap (Node, Edge, UEdge). typedef typename _Map::Key Key; /// The value type of DescriptorMap. typedef typename _Map::Value Value; @@ -1296,7 +1296,7 @@ public: typedef typename Graph::Edge Value; - typedef typename Graph::UndirEdge Key; + typedef typename Graph::UEdge Key; /// \brief Constructor /// @@ -1335,7 +1335,7 @@ public: typedef typename Graph::Edge Value; - typedef typename Graph::UndirEdge Key; + typedef typename Graph::UEdge Key; /// \brief Constructor /// diff -r e225719bde6b -r 2d806130e700 lemon/graph_writer.h --- a/lemon/graph_writer.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/graph_writer.h Thu Jan 26 15:42:13 2006 +0000 @@ -315,39 +315,39 @@ /// \brief The undirected graph writer class. /// - /// The \c UndirGraphWriter class provides the undir graph output. To write + /// The \c UGraphWriter class provides the ugraph output. To write /// a graph you should first give writing commands to the writer. You can - /// declare write command as \c NodeMap, \c EdgeMap or \c UndirEdgeMap - /// writing and labeled Node, Edge or UndirEdge writing. + /// declare write command as \c NodeMap, \c EdgeMap or \c UEdgeMap + /// writing and labeled Node, Edge or UEdge writing. /// /// \code - /// UndirGraphWriter writer(std::cout, graph); + /// UGraphWriter writer(std::cout, graph); /// \endcode /// /// The \c writeNodeMap() function declares a \c NodeMap writing - /// command in the \c UndirGraphWriter. You should give as parameter + /// command in the \c UGraphWriter. You should give as parameter /// the name of the map and the map object. The NodeMap writing /// command with name "label" should write a unique map because it /// is regarded as label map. /// /// \code - /// IdMap nodeLabelMap; + /// IdMap nodeLabelMap; /// writer.writeNodeMap("label", nodeLabelMap); /// /// writer.writeNodeMap("coords", coords); /// writer.writeNodeMap("color", colorMap); /// \endcode /// - /// With the \c writeUndirEdgeMap() member function you can give an + /// With the \c writeUEdgeMap() member function you can give an /// undirected edge map writing command similar to the NodeMaps. /// /// \code /// DescriptorMap > /// edgeDescMap(graph); - /// writer.writeUndirEdgeMap("descriptor", edgeDescMap); + /// writer.writeUEdgeMap("descriptor", edgeDescMap); /// - /// writer.writeUndirEdgeMap("weight", weightMap); - /// writer.writeUndirEdgeMap("label", labelMap); + /// writer.writeUEdgeMap("weight", weightMap); + /// writer.writeUEdgeMap("label", labelMap); /// \endcode /// /// The EdgeMap handling is just a syntactical sugar. It writes @@ -358,7 +358,7 @@ /// \endcode /// /// - /// With \c writeNode() and \c writeUndirEdge() functions you can + /// With \c writeNode() and \c writeUEdge() functions you can /// designate nodes and undirected edges in the graph. For example, you can /// write out the source and target of the graph. /// @@ -366,7 +366,7 @@ /// writer.writeNode("source", sourceNode); /// writer.writeNode("target", targetNode); /// - /// writer.writeUndirEdge("observed", undirEdge); + /// writer.writeUEdge("observed", uEdge); /// \endcode /// /// After you give all write commands you must call the \c run() member @@ -384,56 +384,56 @@ /// \see \ref graph-io-page /// \author Balazs Dezso template - class UndirGraphWriter { + class UGraphWriter { public: typedef _Graph Graph; typedef typename Graph::Node Node; typedef typename Graph::Edge Edge; - typedef typename Graph::UndirEdge UndirEdge; + typedef typename Graph::UEdge UEdge; typedef _WriterTraits WriterTraits; - /// \brief Construct a new UndirGraphWriter. + /// \brief Construct a new UGraphWriter. /// - /// Construct a new UndirGraphWriter. It writes the given graph + /// Construct a new UGraphWriter. It writes the given graph /// to the given stream. - UndirGraphWriter(std::ostream& _os, const Graph& _graph) + UGraphWriter(std::ostream& _os, const Graph& _graph) : writer(new LemonWriter(_os)), own_writer(true), nodeset_writer(*writer, _graph, std::string()), - undir_edgeset_writer(*writer, _graph, nodeset_writer, std::string()), + u_edgeset_writer(*writer, _graph, nodeset_writer, std::string()), node_writer(*writer, nodeset_writer, std::string()), - undir_edge_writer(*writer, undir_edgeset_writer, std::string()), + u_edge_writer(*writer, u_edgeset_writer, std::string()), attribute_writer(*writer, std::string()) {} - /// \brief Construct a new UndirGraphWriter. + /// \brief Construct a new UGraphWriter. /// - /// Construct a new UndirGraphWriter. It writes the given graph + /// Construct a new UGraphWriter. It writes the given graph /// to the given file. - UndirGraphWriter(const std::string& _filename, const Graph& _graph) + UGraphWriter(const std::string& _filename, const Graph& _graph) : writer(new LemonWriter(_filename)), own_writer(true), nodeset_writer(*writer, _graph, std::string()), - undir_edgeset_writer(*writer, _graph, nodeset_writer, std::string()), + u_edgeset_writer(*writer, _graph, nodeset_writer, std::string()), node_writer(*writer, nodeset_writer, std::string()), - undir_edge_writer(*writer, undir_edgeset_writer, std::string()), + u_edge_writer(*writer, u_edgeset_writer, std::string()), attribute_writer(*writer, std::string()) {} - /// \brief Construct a new UndirGraphWriter. + /// \brief Construct a new UGraphWriter. /// - /// Construct a new UndirGraphWriter. It writes the given graph + /// Construct a new UGraphWriter. It writes the given graph /// to given LemonReader. - UndirGraphWriter(LemonWriter& _writer, const Graph& _graph) + UGraphWriter(LemonWriter& _writer, const Graph& _graph) : writer(_writer), own_writer(false), nodeset_writer(*writer, _graph, std::string()), - undir_edgeset_writer(*writer, _graph, nodeset_writer, std::string()), + u_edgeset_writer(*writer, _graph, nodeset_writer, std::string()), node_writer(*writer, nodeset_writer, std::string()), - undir_edge_writer(*writer, undir_edgeset_writer, std::string()), + u_edge_writer(*writer, u_edgeset_writer, std::string()), attribute_writer(*writer, std::string()) {} /// \brief Destruct the graph writer. /// /// Destruct the graph writer. - ~UndirGraphWriter() { + ~UGraphWriter() { if (own_writer) delete writer; } @@ -442,7 +442,7 @@ /// /// This function issues a new node map writing command to the writer. template - UndirGraphWriter& writeNodeMap(std::string name, const Map& map) { + UGraphWriter& writeNodeMap(std::string name, const Map& map) { nodeset_writer.writeNodeMap(name, map); return *this; } @@ -451,7 +451,7 @@ /// /// This function issues a new node map writing command to the writer. template - UndirGraphWriter& writeNodeMap(std::string name, const Map& map, + UGraphWriter& writeNodeMap(std::string name, const Map& map, const Writer& writer = Writer()) { nodeset_writer.writeNodeMap(name, map, writer); return *this; @@ -461,8 +461,8 @@ /// /// This function issues a new edge map writing command to the writer. template - UndirGraphWriter& writeEdgeMap(std::string name, const Map& map) { - undir_edgeset_writer.writeEdgeMap(name, map); + UGraphWriter& writeEdgeMap(std::string name, const Map& map) { + u_edgeset_writer.writeEdgeMap(name, map); return *this; } @@ -470,9 +470,9 @@ /// /// This function issues a new edge map writing command to the writer. template - UndirGraphWriter& writeEdgeMap(std::string name, const Map& map, + UGraphWriter& writeEdgeMap(std::string name, const Map& map, const Writer& writer = Writer()) { - undir_edgeset_writer.writeEdgeMap(name, map, writer); + u_edgeset_writer.writeEdgeMap(name, map, writer); return *this; } @@ -481,8 +481,8 @@ /// This function issues a new undirected edge map writing /// command to the writer. template - UndirGraphWriter& writeUndirEdgeMap(std::string name, const Map& map) { - undir_edgeset_writer.writeUndirEdgeMap(name, map); + UGraphWriter& writeUEdgeMap(std::string name, const Map& map) { + u_edgeset_writer.writeUEdgeMap(name, map); return *this; } @@ -491,9 +491,9 @@ /// This function issues a new undirected edge map writing /// command to the writer. template - UndirGraphWriter& writeUndirEdgeMap(std::string name, const Map& map, + UGraphWriter& writeUEdgeMap(std::string name, const Map& map, const Writer& writer = Writer()) { - undir_edgeset_writer.writeUndirEdgeMap(name, map, writer); + u_edgeset_writer.writeUEdgeMap(name, map, writer); return *this; } @@ -501,7 +501,7 @@ /// /// This function issues a new labeled node writing /// command to the writer. - UndirGraphWriter& writeNode(std::string name, const Node& node) { + UGraphWriter& writeNode(std::string name, const Node& node) { node_writer.writeNode(name, node); return *this; } @@ -510,8 +510,8 @@ /// /// This function issues a new labeled edge writing /// command to the writer. - UndirGraphWriter& writeEdge(std::string name, const Edge& edge) { - undir_edge_writer.writeEdge(name, edge); + UGraphWriter& writeEdge(std::string name, const Edge& edge) { + u_edge_writer.writeEdge(name, edge); } /// \brief Issue a new labeled undirected edge writing command to @@ -519,8 +519,8 @@ /// /// Issue a new labeled undirected edge writing command to /// the writer. - UndirGraphWriter& writeUndirEdge(std::string name, const UndirEdge& edge) { - undir_edge_writer.writeUndirEdge(name, edge); + UGraphWriter& writeUEdge(std::string name, const UEdge& edge) { + u_edge_writer.writeUEdge(name, edge); } /// \brief Issue a new attribute writing command. @@ -528,7 +528,7 @@ /// This function issues a new attribute writing /// command to the writer. template - UndirGraphWriter& writeAttribute(std::string name, const Value& value) { + UGraphWriter& writeAttribute(std::string name, const Value& value) { attribute_writer.writeAttribute(name, value); return *this; } @@ -538,7 +538,7 @@ /// This function issues a new attribute writing /// command to the writer. template - UndirGraphWriter& writeAttribute(std::string name, const Value& value, + UGraphWriter& writeAttribute(std::string name, const Value& value, const Writer& writer) { attribute_writer.writeAttribute(name, value, writer); return *this; @@ -574,7 +574,7 @@ /// It writes the label of the given edge. If there was written an "label" /// named edge map then it will write the map value belonging to the edge. void writeLabel(std::ostream& os, const Edge& item) const { - undir_edgeset_writer.writeLabel(os, item); + u_edgeset_writer.writeLabel(os, item); } /// \brief Write the label of the given undirected edge. @@ -582,8 +582,8 @@ /// It writes the label of the given undirected edge. If there was written /// an "label" named edge map then it will write the map value belonging to /// the edge. - void writeLabel(std::ostream& os, const UndirEdge& item) const { - undir_edgeset_writer.writeLabel(os, item); + void writeLabel(std::ostream& os, const UEdge& item) const { + u_edgeset_writer.writeLabel(os, item); } @@ -593,10 +593,10 @@ bool own_writer; NodeSetWriter nodeset_writer; - UndirEdgeSetWriter undir_edgeset_writer; + UEdgeSetWriter u_edgeset_writer; NodeWriter node_writer; - UndirEdgeWriter undir_edge_writer; + UEdgeWriter u_edge_writer; AttributeWriter attribute_writer; }; @@ -604,21 +604,21 @@ /// \brief Write an undirected graph to the output. /// /// It is a helper function to write an undirected graph to the given output - /// stream. It gives back an UndirGraphWriter object and this object + /// stream. It gives back an UGraphWriter object and this object /// can write more maps, labeled nodes and edges and attributes. /// \warning Do not forget to call the \c run() function. /// /// \param os The output stream. /// \param g The graph. template - UndirGraphWriter undirGraphWriter(std::ostream& os, const Graph &g) { - return UndirGraphWriter(os, g); + UGraphWriter uGraphWriter(std::ostream& os, const Graph &g) { + return UGraphWriter(os, g); } /// \brief Write an undirected graph to the output. /// /// It is a helper function to write an undirected graph to the given output - /// file. It gives back an UndirGraphWriter object and this object + /// file. It gives back an UGraphWriter object and this object /// can write more maps, labeled nodes, edges, undirected edges and /// attributes. /// @@ -627,9 +627,9 @@ /// \param fn The output file. /// \param g The graph. template - UndirGraphWriter undirGraphWriter(const std::string& fn, + UGraphWriter uGraphWriter(const std::string& fn, const Graph &g) { - return UndirGraphWriter(fn, g); + return UGraphWriter(fn, g); } /// @} diff -r e225719bde6b -r 2d806130e700 lemon/grid_graph.h --- a/lemon/grid_graph.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/grid_graph.h Thu Jan 26 15:42:13 2006 +0000 @@ -338,10 +338,10 @@ }; - typedef StaticMappableUndirGraphExtender< - IterableUndirGraphExtender< - AlterableUndirGraphExtender< - UndirGraphExtender > > > ExtendedGridGraphBase; + typedef StaticMappableUGraphExtender< + IterableUGraphExtender< + AlterableUGraphExtender< + UGraphExtender > > > ExtendedGridGraphBase; /// \ingroup graphs /// @@ -364,7 +364,7 @@ /// } /// \endcode /// - /// The graph type is fully conform to the \ref concept::UndirGraph + /// The graph type is fully conform to the \ref concept::UGraph /// "Undirected Graph" concept. /// /// \author Balazs Dezso @@ -463,7 +463,7 @@ /// Gives back the edge goes down from the node. If there is not /// outgoing edge then it gives back INVALID. Edge down(Node n) const { - UndirEdge ue = _down(n); + UEdge ue = _down(n); return ue != INVALID ? direct(ue, true) : INVALID; } @@ -472,7 +472,7 @@ /// Gives back the edge goes up from the node. If there is not /// outgoing edge then it gives back INVALID. Edge up(Node n) const { - UndirEdge ue = _up(n); + UEdge ue = _up(n); return ue != INVALID ? direct(ue, false) : INVALID; } @@ -481,7 +481,7 @@ /// Gives back the edge goes right from the node. If there is not /// outgoing edge then it gives back INVALID. Edge right(Node n) const { - UndirEdge ue = _right(n); + UEdge ue = _right(n); return ue != INVALID ? direct(ue, true) : INVALID; } @@ -490,7 +490,7 @@ /// Gives back the edge goes left from the node. If there is not /// outgoing edge then it gives back INVALID. Edge left(Node n) const { - UndirEdge ue = _left(n); + UEdge ue = _left(n); return ue != INVALID ? direct(ue, false) : INVALID; } diff -r e225719bde6b -r 2d806130e700 lemon/hypercube_graph.h --- a/lemon/hypercube_graph.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/hypercube_graph.h Thu Jan 26 15:42:13 2006 +0000 @@ -254,7 +254,7 @@ /// is 26. /// /// The graph type is fully conform to the \ref concept::StaticGraph - /// concept but it does not conform to the \ref concept::UndirGraph. + /// concept but it does not conform to the \ref concept::UGraph. /// /// \see HyperCubeGraphBase /// \author Balazs Dezso diff -r e225719bde6b -r 2d806130e700 lemon/kruskal.h --- a/lemon/kruskal.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/kruskal.h Thu Jan 26 15:42:13 2006 +0000 @@ -51,7 +51,7 @@ /// /// \param g The graph the algorithm runs on. /// It can be either \ref concept::StaticGraph "directed" or - /// \ref concept::UndirGraph "undirected". + /// \ref concept::UGraph "undirected". /// If the graph is directed, the algorithm consider it to be /// undirected by disregarding the direction of the edges. /// @@ -89,15 +89,15 @@ /// \return The cost of the found tree. /// /// \warning If kruskal is run on an - /// \ref lemon::concept::UndirGraph "undirected graph", be sure that the + /// \ref lemon::concept::UGraph "undirected graph", be sure that the /// map storing the tree is also undirected - /// (e.g. UndirListGraph::UndirEdgeMap, otherwise the values of the + /// (e.g. ListUGraph::UEdgeMap, otherwise the values of the /// half of the edges will not be set. /// /// \todo Discuss the case of undirected graphs: In this case the algorithm - /// also require Edges instead of UndirEdges, as some + /// also require Edges instead of UEdges, as some /// people would expect. So, one should be careful not to add both of the - /// Edges belonging to a certain UndirEdge. + /// Edges belonging to a certain UEdge. /// (\ref kruskal() and \ref KruskalMapInput are kind enough to do so.) #ifdef DOXYGEN @@ -225,15 +225,15 @@ }; template - typename enable_if::type + typename enable_if::type fillWithEdges(const _GR& g, const Map& m,dummy<0> = 0) { - for(typename GR::UndirEdgeIt e(g);e!=INVALID;++e) + for(typename GR::UEdgeIt e(g);e!=INVALID;++e) push_back(value_type(g.direct(e, true), m[e])); } template - typename disable_if::type + typename disable_if::type fillWithEdges(const _GR& g, const Map& m,dummy<1> = 1) { for(typename GR::EdgeIt e(g);e!=INVALID;++e) diff -r e225719bde6b -r 2d806130e700 lemon/lemon_reader.h --- a/lemon/lemon_reader.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/lemon_reader.h Thu Jan 26 15:42:13 2006 +0000 @@ -104,7 +104,7 @@ template class ForwardComposeMap { public: - typedef typename Graph::UndirEdge Key; + typedef typename Graph::UEdge Key; typedef typename Map::Value Value; ForwardComposeMap(const Graph& _graph, typename Arg::Type _map) @@ -134,7 +134,7 @@ template class BackwardComposeMap { public: - typedef typename Graph::UndirEdge Key; + typedef typename Graph::UEdge Key; typedef typename Map::Value Value; BackwardComposeMap(const Graph& _graph, typename Arg::Type _map) @@ -1167,8 +1167,8 @@ /// \brief SectionReader for reading a undirected graph's edgeset. /// /// The lemon format can store multiple undirected edgesets with several - /// maps. The undirected edgeset section's header line is \c \@undiredgeset - /// \c undiredgeset_name, but the \c undiredgeset_name may be empty. + /// maps. The undirected edgeset section's header line is \c \@uedgeset + /// \c uedgeset_name, but the \c uedgeset_name may be empty. /// /// The first line of the section contains the names of the maps separated /// with white spaces. Each next lines describes an edge in the edgeset. The @@ -1183,7 +1183,7 @@ /// If the edgeset contains an \c "label" named map then it will be regarded /// as id map. This map should contain only unique values and when the /// \c readLabel() member will read a value from the given stream it will - /// give back that undiricted edge which is mapped to this value. + /// give back that uicted edge which is mapped to this value. /// /// The undirected edgeset reader needs a node id reader to identify which /// nodes have to be connected. If a NodeSetReader reads an "label" named map, @@ -1191,7 +1191,7 @@ /// /// \relates LemonReader template - class UndirEdgeSetReader : public LemonReader::SectionReader { + class UEdgeSetReader : public LemonReader::SectionReader { typedef LemonReader::SectionReader Parent; public: @@ -1199,19 +1199,19 @@ typedef _Traits Traits; typedef typename Graph::Node Node; typedef typename Graph::Edge Edge; - typedef typename Graph::UndirEdge UndirEdge; + typedef typename Graph::UEdge UEdge; typedef typename Traits::Skipper DefaultSkipper; /// \brief Constructor. /// - /// Constructor for UndirEdgeSetReader. It creates the UndirEdgeSetReader + /// Constructor for UEdgeSetReader. It creates the UEdgeSetReader /// and attach it into the given LemonReader. The undirected edgeset /// reader will add the readed undirected edges to the given Graph. It /// will use the given node id reader to read the source and target /// nodes of the edges. The reader will read the section only if the - /// \c _name and the \c undiredgset_name are the same. + /// \c _name and the \c uedgset_name are the same. template - UndirEdgeSetReader(LemonReader& _reader, + UEdgeSetReader(LemonReader& _reader, Graph& _graph, const NodeLabelReader& _nodeLabelReader, const std::string& _name = std::string(), @@ -1223,8 +1223,8 @@ } /// \brief Destructor. /// - /// Destructor for UndirEdgeSetReader. - virtual ~UndirEdgeSetReader() { + /// Destructor for UEdgeSetReader. + virtual ~UEdgeSetReader() { for (typename MapReaders::iterator it = readers.begin(); it != readers.end(); ++it) { delete it->second; @@ -1232,8 +1232,8 @@ } private: - UndirEdgeSetReader(const UndirEdgeSetReader&); - void operator=(const UndirEdgeSetReader&); + UEdgeSetReader(const UEdgeSetReader&); + void operator=(const UEdgeSetReader&); public: @@ -1241,14 +1241,14 @@ /// /// Add a new edge undirected map reader command for the reader. template - UndirEdgeSetReader& readUndirEdgeMap(std::string name, Map& map) { + UEdgeSetReader& readUEdgeMap(std::string name, Map& map) { return _readMap< typename Traits::template Reader, Map, typename _reader_bits::Arg::Type>(name, map); } template - UndirEdgeSetReader& readUndirEdgeMap(std::string name, const Map& map) { + UEdgeSetReader& readUEdgeMap(std::string name, const Map& map) { return _readMap< typename Traits::template Reader, Map, typename _reader_bits::Arg::Type>(name, map); @@ -1258,14 +1258,14 @@ /// /// Add a new edge undirected map reader command for the reader. template - UndirEdgeSetReader& readUndirEdgeMap(std::string name, Map& map, + UEdgeSetReader& readUEdgeMap(std::string name, Map& map, const Reader& reader = Reader()) { return _readMap::Type> (name, map, reader); } template - UndirEdgeSetReader& readUndirEdgeMap(std::string name, const Map& map, + UEdgeSetReader& readUEdgeMap(std::string name, const Map& map, const Reader& reader = Reader()) { return _readMap::Type > (name, map, reader); @@ -1274,9 +1274,9 @@ private: template - UndirEdgeSetReader& _readMap(std::string name, MapParameter map, + UEdgeSetReader& _readMap(std::string name, MapParameter map, const Reader& reader = Reader()) { - checkConcept, Map>(); + checkConcept, Map>(); checkConcept<_reader_bits::ItemReader, Reader>(); if (readers.find(name) != readers.end()) { ErrorMessage msg; @@ -1285,7 +1285,7 @@ } readers.insert( make_pair(name, new _reader_bits:: - MapReader(map, reader))); + MapReader(map, reader))); return *this; } @@ -1295,7 +1295,7 @@ /// /// Add a new undirected edge map skipper command for the reader. template - UndirEdgeSetReader& skipUndirEdgeMap(std::string name, + UEdgeSetReader& skipUEdgeMap(std::string name, const Reader& reader = Reader()) { if (readers.find(name) != readers.end()) { ErrorMessage msg; @@ -1303,7 +1303,7 @@ throw IOParameterError(msg.message()); } readers.insert(make_pair(name, new _reader_bits:: - SkipReader(reader))); + SkipReader(reader))); return *this; } @@ -1311,14 +1311,14 @@ /// /// Add a new directed edge map reader command for the reader. template - UndirEdgeSetReader& readEdgeMap(std::string name, Map& map) { + UEdgeSetReader& readEdgeMap(std::string name, Map& map) { return _readDirMap< typename Traits::template Reader, Map, typename _reader_bits::Arg::Type>(name, map); } template - UndirEdgeSetReader& readEdgeMap(std::string name, const Map& map) { + UEdgeSetReader& readEdgeMap(std::string name, const Map& map) { return _readDirMap< typename Traits::template Reader, Map, typename _reader_bits::Arg::Type>(name, map); @@ -1328,14 +1328,14 @@ /// /// Add a new directed edge map reader command for the reader. template - UndirEdgeSetReader& readEdgeMap(std::string name, Map& map, + UEdgeSetReader& readEdgeMap(std::string name, Map& map, const Reader& reader = Reader()) { return _readDirMap::Type> (name, map, reader); } template - UndirEdgeSetReader& readEdgeMap(std::string name, const Map& map, + UEdgeSetReader& readEdgeMap(std::string name, const Map& map, const Reader& reader = Reader()) { return _readDirMap::Type> (name, map, reader); @@ -1344,7 +1344,7 @@ private: template - UndirEdgeSetReader& _readDirMap(std::string name, MapParameter map, + UEdgeSetReader& _readDirMap(std::string name, MapParameter map, const Reader& reader = Reader()) { checkConcept<_reader_bits::ItemReader, Reader>(); checkConcept, Map>(); @@ -1361,7 +1361,7 @@ /// /// Add a new directed edge map skipper command for the reader. template - UndirEdgeSetReader& skipEdgeMap(std::string name, + UEdgeSetReader& skipEdgeMap(std::string name, const Reader& reader = Reader()) { skipMap("+" + name, reader); skipMap("-" + name, reader); @@ -1373,14 +1373,14 @@ /// \brief Gives back true when the SectionReader can process /// the section with the given header line. /// - /// It gives back true when the header line starts with \c \@undiredgeset, + /// It gives back true when the header line starts with \c \@uedgeset, /// and the header line's name and the edgeset's name are the same. virtual bool header(const std::string& line) { std::istringstream ls(line); std::string command; std::string id; ls >> command >> name; - return command == "@undiredgeset" && name == id; + return command == "@uedgeset" && name == id; } /// \brief Reader function of the section. @@ -1390,7 +1390,7 @@ if (!nodeLabelReader->isLabelReader()) { throw DataFormatError("Cannot find nodeset or label map"); } - std::vector<_reader_bits::MapReaderBase* > index; + std::vector<_reader_bits::MapReaderBase* > index; std::string line; getline(is, line); @@ -1421,7 +1421,7 @@ std::istringstream ls(line); Node from = nodeLabelReader->read(ls); Node to = nodeLabelReader->read(ls); - UndirEdge edge = graph.addEdge(from, to); + UEdge edge = graph.addEdge(from, to); for (int i = 0; i < (int)index.size(); ++i) { index[i]->read(ls, edge); } @@ -1442,8 +1442,8 @@ /// /// It reads an id from the stream and gives back which undirected edge /// belongs to it. It is possible only if there was read an "label" named map. - void readLabel(std::istream& is, UndirEdge& undirEdge) const { - undirEdge = inverter->read(is); + void readLabel(std::istream& is, UEdge& uEdge) const { + uEdge = inverter->read(is); } /// \brief Gives back the directed edge by its label. @@ -1455,11 +1455,11 @@ void readLabel(std::istream& is, Edge& edge) const { char c; is >> c; - UndirEdge undirEdge = inverter->read(is); + UEdge uEdge = inverter->read(is); if (c == '+') { - edge = graph.direct(undirEdge, true); + edge = graph.direct(uEdge, true); } else if (c == '-') { - edge = graph.direct(undirEdge, false); + edge = graph.direct(uEdge, false); } else { throw DataFormatError("Wrong id format for edge " "in undirected edgeset"); @@ -1469,14 +1469,14 @@ private: typedef std::map*> MapReaders; + _reader_bits::MapReaderBase*> MapReaders; MapReaders readers; Graph& graph; std::string name; - _reader_bits::SkipReader skipper; + _reader_bits::SkipReader skipper; - std::auto_ptr<_reader_bits::MapInverterBase > inverter; + std::auto_ptr<_reader_bits::MapInverterBase > inverter; std::auto_ptr<_reader_bits::LabelReaderBase > nodeLabelReader; }; @@ -1696,66 +1696,66 @@ /// \ingroup io_group /// \brief SectionReader for reading labeled undirected edges. /// - /// The undirected edges section's header line is \c \@undiredges - /// \c undiredges_name, but the \c undiredges_name may be empty. + /// The undirected edges section's header line is \c \@uedges + /// \c uedges_name, but the \c uedges_name may be empty. /// /// Each line in the section contains the name of the undirected edge /// and then the undirected edge id. /// /// \relates LemonReader template - class UndirEdgeReader : public LemonReader::SectionReader { + class UEdgeReader : public LemonReader::SectionReader { typedef LemonReader::SectionReader Parent; typedef _Graph Graph; typedef typename Graph::Edge Edge; - typedef typename Graph::UndirEdge UndirEdge; + typedef typename Graph::UEdge UEdge; public: /// \brief Constructor. /// - /// Constructor for UndirEdgeReader. It creates the UndirEdgeReader and + /// Constructor for UEdgeReader. It creates the UEdgeReader and /// attach it into the given LemonReader. It will use the given /// undirected edge id reader to give back the edges. The reader will - /// read the section only if the \c _name and the \c undiredges_name are + /// read the section only if the \c _name and the \c uedges_name are /// the same. template - UndirEdgeReader(LemonReader& _reader, const _LabelReader& _labelReader, + UEdgeReader(LemonReader& _reader, const _LabelReader& _labelReader, const std::string& _name = std::string()) : Parent(_reader), name(_name) { - checkConcept<_reader_bits::ItemLabelReader, _LabelReader>(); + checkConcept<_reader_bits::ItemLabelReader, _LabelReader>(); checkConcept<_reader_bits::ItemLabelReader, _LabelReader>(); - undirEdgeLabelReader.reset(new _reader_bits:: - LabelReader(_labelReader)); + uEdgeLabelReader.reset(new _reader_bits:: + LabelReader(_labelReader)); edgeLabelReader.reset(new _reader_bits:: LabelReader(_labelReader)); } /// \brief Destructor. /// - /// Destructor for UndirEdgeReader. - virtual ~UndirEdgeReader() {} + /// Destructor for UEdgeReader. + virtual ~UEdgeReader() {} private: - UndirEdgeReader(const UndirEdgeReader&); - void operator=(const UndirEdgeReader&); + UEdgeReader(const UEdgeReader&); + void operator=(const UEdgeReader&); public: - /// \brief Add an undirected edge reader command for the UndirEdgeReader. + /// \brief Add an undirected edge reader command for the UEdgeReader. /// - /// Add an undirected edge reader command for the UndirEdgeReader. - void readUndirEdge(const std::string& name, UndirEdge& item) { - if (undirEdgeReaders.find(name) != undirEdgeReaders.end()) { + /// Add an undirected edge reader command for the UEdgeReader. + void readUEdge(const std::string& name, UEdge& item) { + if (uEdgeReaders.find(name) != uEdgeReaders.end()) { ErrorMessage msg; msg << "Multiple read rule for undirected edge: " << name; throw IOParameterError(msg.message()); } - undirEdgeReaders.insert(make_pair(name, _reader_bits:: - ItemStore(item))); + uEdgeReaders.insert(make_pair(name, _reader_bits:: + ItemStore(item))); } - /// \brief Add an edge reader command for the UndirEdgeReader. + /// \brief Add an edge reader command for the UEdgeReader. /// - /// Add an edge reader command for the UndirEdgeReader. + /// Add an edge reader command for the UEdgeReader. void readEdge(const std::string& name, Edge& item) { if (edgeReaders.find(name) != edgeReaders.end()) { ErrorMessage msg; @@ -1777,7 +1777,7 @@ std::string command; std::string id; ls >> command >> name; - return command == "@undiredges" && name == id; + return command == "@uedges" && name == id; } /// \brief Reader function of the section. @@ -1787,7 +1787,7 @@ if (!edgeLabelReader->isLabelReader()) { throw DataFormatError("Cannot find undirected edgeset or label map"); } - if (!undirEdgeLabelReader->isLabelReader()) { + if (!uEdgeLabelReader->isLabelReader()) { throw DataFormatError("Cannot find undirected edgeset or label map"); } std::string line; @@ -1796,9 +1796,9 @@ std::string id; ls >> id; { - typename UndirEdgeReaders::iterator it = undirEdgeReaders.find(id); - if (it != undirEdgeReaders.end()) { - it->second.read(undirEdgeLabelReader->read(ls)); + typename UEdgeReaders::iterator it = uEdgeReaders.find(id); + if (it != uEdgeReaders.end()) { + it->second.read(uEdgeLabelReader->read(ls)); it->second.touch(); continue; } @@ -1819,11 +1819,11 @@ throw IOParameterError(msg.message()); } } - for (typename UndirEdgeReaders::iterator it = undirEdgeReaders.begin(); - it != undirEdgeReaders.end(); ++it) { + for (typename UEdgeReaders::iterator it = uEdgeReaders.begin(); + it != uEdgeReaders.end(); ++it) { if (!it->second.touched()) { ErrorMessage msg; - msg << "UndirEdge not found in file: " << it->first; + msg << "UEdge not found in file: " << it->first; throw IOParameterError(msg.message()); } } @@ -1834,9 +1834,9 @@ std::string name; typedef std::map > UndirEdgeReaders; - UndirEdgeReaders undirEdgeReaders; - std::auto_ptr<_reader_bits::LabelReaderBase > undirEdgeLabelReader; + _reader_bits::ItemStore > UEdgeReaders; + UEdgeReaders uEdgeReaders; + std::auto_ptr<_reader_bits::LabelReaderBase > uEdgeLabelReader; typedef std::map > EdgeReaders; EdgeReaders edgeReaders; @@ -2025,24 +2025,24 @@ /// \brief Gives back how many undirected edgesets are in the file. /// /// Gives back how many undirected edgesets are in the file. - int undirEdgeSetNum() const { - return undiredgesets.size(); + int uEdgeSetNum() const { + return uedgesets.size(); } /// \brief Gives back the name of undirected edgeset on the indiced /// position. /// /// Gives back the name of undirected edgeset on the indiced position. - std::string undirEdgeSetName(int index) const { - return undiredgesets[index].name; + std::string uEdgeSetName(int index) const { + return uedgesets[index].name; } /// \brief Gives back the map names of undirected edgeset on the indiced /// position. /// /// Gives back the map names of undirected edgeset on the indiced position. - const std::vector& undirEdgeSetMaps(int index) const { - return undiredgesets[index].items; + const std::vector& uEdgeSetMaps(int index) const { + return uedgesets[index].items; } /// \brief Gives back how many labeled nodes section are in the file. @@ -2095,8 +2095,8 @@ /// in the file. /// /// Gives back how many labeled undirected edges section are in the file. - int undirEdgesNum() const { - return undiredges.size(); + int uEdgesNum() const { + return uedges.size(); } /// \brief Gives back the name of labeled undirected edges section @@ -2104,8 +2104,8 @@ /// /// Gives back the name of labeled undirected edges section on the /// indiced position. - std::string undirEdgesName(int index) const { - return undiredges[index].name; + std::string uEdgesName(int index) const { + return uedges[index].name; } /// \brief Gives back the names of the labeled undirected edges in @@ -2113,8 +2113,8 @@ /// /// Gives back the names of the labeled undirected edges in the /// indiced section. - const std::vector& undirEdgesItems(int index) const { - return undiredges[index].items; + const std::vector& uEdgesItems(int index) const { + return uedges[index].items; } @@ -2160,18 +2160,18 @@ } else if (command == "@edgeset") { current = command; edgesets.push_back(SectionInfo(name)); - } else if (command == "@undiredgeset") { + } else if (command == "@uedgeset") { current = command; - undiredgesets.push_back(SectionInfo(name)); + uedgesets.push_back(SectionInfo(name)); } else if (command == "@nodes") { current = command; nodes.push_back(SectionInfo(name)); } else if (command == "@edges") { current = command; edges.push_back(SectionInfo(name)); - } else if (command == "@undiredges") { + } else if (command == "@uedges") { current = command; - undiredges.push_back(SectionInfo(name)); + uedges.push_back(SectionInfo(name)); } else if (command == "@attributes") { current = command; attributes.push_back(SectionInfo(name)); @@ -2190,14 +2190,14 @@ readMapNames(is, nodesets.back().items); } else if (current == "@edgeset") { readMapNames(is, edgesets.back().items); - } else if (current == "@undiredgeset") { - readMapNames(is, undiredgesets.back().items); + } else if (current == "@uedgeset") { + readMapNames(is, uedgesets.back().items); } else if (current == "@nodes") { readItemNames(is, nodes.back().items); } else if (current == "@edges") { readItemNames(is, edges.back().items); - } else if (current == "@undiredges") { - readItemNames(is, undiredges.back().items); + } else if (current == "@uedges") { + readItemNames(is, uedges.back().items); } else if (current == "@attributes") { readItemNames(is, attributes.back().items); } @@ -2233,11 +2233,11 @@ std::vector nodesets; std::vector edgesets; - std::vector undiredgesets; + std::vector uedgesets; std::vector nodes; std::vector edges; - std::vector undiredges; + std::vector uedges; std::vector attributes; diff -r e225719bde6b -r 2d806130e700 lemon/lemon_writer.h --- a/lemon/lemon_writer.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/lemon_writer.h Thu Jan 26 15:42:13 2006 +0000 @@ -91,7 +91,7 @@ template class ForwardComposeMap { public: - typedef typename Graph::UndirEdge Key; + typedef typename Graph::UEdge Key; typedef typename Map::Value Value; ForwardComposeMap(const Graph& _graph, const Map& _map) @@ -115,7 +115,7 @@ template class BackwardComposeMap { public: - typedef typename Graph::UndirEdge Key; + typedef typename Graph::UEdge Key; typedef typename Map::Value Value; BackwardComposeMap(const Graph& _graph, const Map& _map) @@ -708,8 +708,8 @@ /// \brief SectionWriter for writing a undirected edgeset. /// /// The lemon format can store multiple undirected edgesets with several - /// maps. The undirected edgeset section's header line is \c \@undiredgeset - /// \c undiredgeset_name, but the \c undiredgeset_name may be empty. + /// maps. The undirected edgeset section's header line is \c \@uedgeset + /// \c uedgeset_name, but the \c uedgeset_name may be empty. /// /// The first line of the section contains the names of the maps separated /// with white spaces. Each next lines describes an undirected edge in the @@ -734,7 +734,7 @@ /// /// \relates LemonWriter template - class UndirEdgeSetWriter : public LemonWriter::SectionWriter { + class UEdgeSetWriter : public LemonWriter::SectionWriter { typedef LemonWriter::SectionWriter Parent; public: @@ -742,17 +742,17 @@ typedef _Traits Traits; typedef typename Graph::Node Node; typedef typename Graph::Edge Edge; - typedef typename Graph::UndirEdge UndirEdge; + typedef typename Graph::UEdge UEdge; /// \brief Constructor. /// - /// Constructor for UndirEdgeSetWriter. It creates the UndirEdgeSetWriter + /// Constructor for UEdgeSetWriter. It creates the UEdgeSetWriter /// and attach it into the given LemonWriter. It will write node labels by /// the \c _nodeLabelWriter. If the \c _forceLabelMap parameter is true /// then the writer will write own label map if the user does not give /// "label" named map. template - UndirEdgeSetWriter(LemonWriter& _writer, const Graph& _graph, + UEdgeSetWriter(LemonWriter& _writer, const Graph& _graph, const NodeLabelWriter& _nodeLabelWriter, const std::string& _name = std::string(), bool _forceLabelMap = true) @@ -765,8 +765,8 @@ /// \brief Destructor. /// - /// Destructor for UndirEdgeSetWriter. - virtual ~UndirEdgeSetWriter() { + /// Destructor for UEdgeSetWriter. + virtual ~UEdgeSetWriter() { typename MapWriters::iterator it; for (it = writers.begin(); it != writers.end(); ++it) { delete it->second; @@ -774,8 +774,8 @@ } private: - UndirEdgeSetWriter(const UndirEdgeSetWriter&); - void operator=(const UndirEdgeSetWriter&); + UEdgeSetWriter(const UEdgeSetWriter&); + void operator=(const UEdgeSetWriter&); public: @@ -783,8 +783,8 @@ /// /// Add a new undirected map writer command for the writer. template - UndirEdgeSetWriter& writeUndirEdgeMap(std::string name, const Map& map) { - return writeUndirEdgeMap, Map>(name, map); } @@ -792,13 +792,13 @@ /// /// Add a new undirected map writer command for the writer. template - UndirEdgeSetWriter& writeUndirEdgeMap(std::string name, const Map& map, + UEdgeSetWriter& writeUEdgeMap(std::string name, const Map& map, const Writer& writer = Writer()) { - checkConcept, Map>(); + checkConcept, Map>(); checkConcept<_writer_bits::ItemWriter, Writer>(); writers.push_back( make_pair(name, new _writer_bits:: - MapWriter(map, writer))); + MapWriter(map, writer))); return *this; } @@ -806,7 +806,7 @@ /// /// Add a new directed map writer command for the writer. template - UndirEdgeSetWriter& writeEdgeMap(std::string name, const Map& map) { + UEdgeSetWriter& writeEdgeMap(std::string name, const Map& map) { return writeEdgeMap, Map>(name, map); } @@ -815,13 +815,13 @@ /// /// Add a new directed map writer command for the writer. template - UndirEdgeSetWriter& writeEdgeMap(std::string name, const Map& map, + UEdgeSetWriter& writeEdgeMap(std::string name, const Map& map, const Writer& writer = Writer()) { checkConcept, Map>(); checkConcept<_writer_bits::ItemWriter, Writer>(); - writeUndirEdge("+" + name, + writeUEdge("+" + name, _writer_bits::forwardComposeMap(graph, map), writer); - writeUndirEdge("-" + name, + writeUEdge("-" + name, _writer_bits::backwardComposeMap(graph, map), writer); return *this; } @@ -832,7 +832,7 @@ /// /// It gives back the header of the section. virtual std::string header() { - return "@undiredgeset " + name; + return "@uedgeset " + name; } /// \brief Writer function of the section. @@ -857,7 +857,7 @@ os << writers[i].first << '\t'; } os << std::endl; - for (typename Graph::UndirEdgeIt it(graph); it != INVALID; ++it) { + for (typename Graph::UEdgeIt it(graph); it != INVALID; ++it) { nodeLabelWriter->write(os, graph.source(it)); os << '\t'; nodeLabelWriter->write(os, graph.target(it)); @@ -891,7 +891,7 @@ /// an "label" named map then it will write the map value belongs to the /// undirected edge. Otherwise if the \c forceLabel parameter was true it /// will write its id in the graph. - void writeLabel(std::ostream& os, const UndirEdge& item) const { + void writeLabel(std::ostream& os, const UEdge& item) const { if (forceLabelMap) { os << graph.id(item); } else { @@ -922,10 +922,10 @@ private: typedef std::vector*> > MapWriters; + MapWriterBase*> > MapWriters; MapWriters writers; - _writer_bits::MapWriterBase* labelMap; + _writer_bits::MapWriterBase* labelMap; bool forceLabelMap; const Graph& graph; @@ -1099,62 +1099,62 @@ /// \ingroup io_group /// \brief SectionWriter for writing named undirected edges. /// - /// The undirected edges section's header line is \c \@undiredges - /// \c undiredges_name, but the \c undiredges_name may be empty. + /// The undirected edges section's header line is \c \@uedges + /// \c uedges_name, but the \c uedges_name may be empty. /// /// Each line in the section contains the name of the undirected edge and /// then the undirected edge label. /// /// \relates LemonWriter template - class UndirEdgeWriter : public LemonWriter::SectionWriter { + class UEdgeWriter : public LemonWriter::SectionWriter { typedef LemonWriter::SectionWriter Parent; typedef _Graph Graph; typedef typename Graph::Node Node; typedef typename Graph::Edge Edge; - typedef typename Graph::UndirEdge UndirEdge; + typedef typename Graph::UEdge UEdge; public: /// \brief Constructor. /// - /// Constructor for UndirEdgeWriter. It creates the UndirEdgeWriter and + /// Constructor for UEdgeWriter. It creates the UEdgeWriter and /// attach it into the given LemonWriter. The given \c _LabelWriter /// will write the undirected edges' label what can be an undirected /// edgeset writer. template - UndirEdgeWriter(LemonWriter& _writer, const _LabelWriter& _labelWriter, + UEdgeWriter(LemonWriter& _writer, const _LabelWriter& _labelWriter, const std::string& _name = std::string()) : Parent(_writer), name(_name) { checkConcept<_writer_bits::ItemLabelWriter, _LabelWriter>(); - checkConcept<_writer_bits::ItemLabelWriter, _LabelWriter>(); - undirEdgeLabelWriter.reset(new _writer_bits:: - LabelWriter(_labelWriter)); + checkConcept<_writer_bits::ItemLabelWriter, _LabelWriter>(); + uEdgeLabelWriter.reset(new _writer_bits:: + LabelWriter(_labelWriter)); edgeLabelWriter.reset(new _writer_bits:: LabelWriter(_labelWriter)); } /// \brief Destructor. /// - /// Destructor for UndirEdgeWriter. - virtual ~UndirEdgeWriter() {} + /// Destructor for UEdgeWriter. + virtual ~UEdgeWriter() {} private: - UndirEdgeWriter(const UndirEdgeWriter&); - void operator=(const UndirEdgeWriter&); + UEdgeWriter(const UEdgeWriter&); + void operator=(const UEdgeWriter&); public: - /// \brief Add an edge writer command for the UndirEdgeWriter. + /// \brief Add an edge writer command for the UEdgeWriter. /// - /// Add an edge writer command for the UndirEdgeWriter. + /// Add an edge writer command for the UEdgeWriter. void writeEdge(const std::string& name, const Edge& item) { edgeWriters.push_back(make_pair(name, &item)); } - /// \brief Add an undirected edge writer command for the UndirEdgeWriter. + /// \brief Add an undirected edge writer command for the UEdgeWriter. /// - /// Add an undirected edge writer command for the UndirEdgeWriter. - void writeUndirEdge(const std::string& name, const UndirEdge& item) { - undirEdgeWriters.push_back(make_pair(name, &item)); + /// Add an undirected edge writer command for the UEdgeWriter. + void writeUEdge(const std::string& name, const UEdge& item) { + uEdgeWriters.push_back(make_pair(name, &item)); } protected: @@ -1163,7 +1163,7 @@ /// /// It gives back the header of the section. virtual std::string header() { - return "@undiredges " + name; + return "@uedges " + name; } /// \brief Writer function of the section. @@ -1173,12 +1173,12 @@ if (!edgeLabelWriter->isLabelWriter()) { throw DataFormatError("Cannot find undirected edgeset or label map"); } - if (!undirEdgeLabelWriter->isLabelWriter()) { + if (!uEdgeLabelWriter->isLabelWriter()) { throw DataFormatError("Cannot find undirected edgeset or label map"); } - for (int i = 0; i < (int)undirEdgeWriters.size(); ++i) { - os << undirEdgeWriters[i].first << ' '; - undirEdgeLabelWriter->write(os, *(undirEdgeWriters[i].second)); + for (int i = 0; i < (int)uEdgeWriters.size(); ++i) { + os << uEdgeWriters[i].first << ' '; + uEdgeLabelWriter->write(os, *(uEdgeWriters[i].second)); os << std::endl; } for (int i = 0; i < (int)edgeWriters.size(); ++i) { @@ -1193,9 +1193,9 @@ std::string name; typedef std::vector > UndirEdgeWriters; - UndirEdgeWriters undirEdgeWriters; - std::auto_ptr<_writer_bits::LabelWriterBase > undirEdgeLabelWriter; + const UEdge*> > UEdgeWriters; + UEdgeWriters uEdgeWriters; + std::auto_ptr<_writer_bits::LabelWriterBase > uEdgeLabelWriter; typedef std::vector > EdgeWriters; EdgeWriters edgeWriters; diff -r e225719bde6b -r 2d806130e700 lemon/list_graph.h --- a/lemon/list_graph.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/list_graph.h Thu Jan 26 15:42:13 2006 +0000 @@ -19,7 +19,7 @@ ///\ingroup graphs ///\file -///\brief ListGraph, UndirListGraph classes. +///\brief ListGraph, ListUGraph classes. #include #include @@ -576,13 +576,13 @@ /**************** Undirected List Graph ****************/ - typedef ErasableUndirGraphExtender< - ClearableUndirGraphExtender< - ExtendableUndirGraphExtender< - MappableUndirGraphExtender< - IterableUndirGraphExtender< - AlterableUndirGraphExtender< - UndirGraphExtender > > > > > > ExtendedUndirListGraphBase; + typedef ErasableUGraphExtender< + ClearableUGraphExtender< + ExtendableUGraphExtender< + MappableUGraphExtender< + IterableUGraphExtender< + AlterableUGraphExtender< + UGraphExtender > > > > > > ExtendedListUGraphBase; /// \addtogroup graphs /// @{ @@ -592,16 +592,16 @@ ///This is a simple and fast erasable undirected graph implementation. /// ///It conforms to the - ///\ref concept::UndirGraph "UndirGraph" concept. + ///\ref concept::UGraph "UGraph" concept. /// - ///\sa concept::UndirGraph. + ///\sa concept::UGraph. /// ///\todo Snapshot, reverseEdge(), changeTarget(), changeSource(), contract() ///haven't been implemented yet. /// - class UndirListGraph : public ExtendedUndirListGraphBase { + class ListUGraph : public ExtendedListUGraphBase { public: - typedef ExtendedUndirListGraphBase Parent; + typedef ExtendedListUGraphBase Parent; /// \brief Changes the target of \c e to \c n /// /// Changes the target of \c e to \c n @@ -609,7 +609,7 @@ /// \note The Edge's and OutEdge's /// referencing the changed edge remain /// valid. However InEdge's are invalidated. - void changeTarget(UndirEdge e, Node n) { + void changeTarget(UEdge e, Node n) { _changeTarget(e,n); } /// Changes the source of \c e to \c n @@ -619,7 +619,7 @@ ///\note The Edge's and InEdge's ///referencing the changed edge remain ///valid. However OutEdge's are invalidated. - void changeSource(UndirEdge e, Node n) { + void changeSource(UEdge e, Node n) { _changeSource(e,n); } /// \brief Contract two nodes. diff -r e225719bde6b -r 2d806130e700 lemon/max_matching.h --- a/lemon/max_matching.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/max_matching.h Thu Jan 26 15:42:13 2006 +0000 @@ -59,8 +59,8 @@ typedef typename Graph::Node Node; typedef typename Graph::Edge Edge; - typedef typename Graph::UndirEdge UndirEdge; - typedef typename Graph::UndirEdgeIt UndirEdgeIt; + typedef typename Graph::UEdge UEdge; + typedef typename Graph::UEdgeIt UEdgeIt; typedef typename Graph::NodeIt NodeIt; typedef typename Graph::IncEdgeIt IncEdgeIt; @@ -98,7 +98,7 @@ ///2*number of nodes), and a heuristical Edmonds' algorithm with a ///heuristic of postponing shrinks for dense graphs. void run() { - if ( countUndirEdges(g) < HEUR_density*countNodes(g) ) { + if ( countUEdges(g) < HEUR_density*countNodes(g) ) { greedyMatching(); runEdmonds(0); } else runEdmonds(1); @@ -212,26 +212,26 @@ } } - ///Reads a matching from an \c UndirEdge valued \c Node map. + ///Reads a matching from an \c UEdge valued \c Node map. - ///Reads a matching from an \c UndirEdge valued \c Node map. \c - ///map[v] must be an \c UndirEdge incident to \c v. This map must + ///Reads a matching from an \c UEdge valued \c Node map. \c + ///map[v] must be an \c UEdge incident to \c v. This map must ///have the property that if \c g.oppositeNode(u,map[u])==v then ///\c \c g.oppositeNode(v,map[v])==u holds, and now some edge ///joining \c u to \c v will be an edge of the matching. template void readNMapEdge(NMapE& map) { for(NodeIt v(g); v!=INVALID; ++v) { - UndirEdge e=map[v]; + UEdge e=map[v]; if ( e!=INVALID ) _mate.set(v,g.oppositeNode(v,e)); } } - ///Writes the matching stored to an \c UndirEdge valued \c Node map. + ///Writes the matching stored to an \c UEdge valued \c Node map. - ///Writes the stored matching to an \c UndirEdge valued \c Node - ///map. \c map[v] will be an \c UndirEdge incident to \c v. This + ///Writes the stored matching to an \c UEdge valued \c Node + ///map. \c map[v] will be an \c UEdge incident to \c v. This ///map will have the property that if \c g.oppositeNode(u,map[u]) ///== v then \c map[u]==map[v] holds, and now this edge is an edge ///of the matching. @@ -263,7 +263,7 @@ ///map[e]==true form the matching. template void readEMapBool(EMapB& map) { - for(UndirEdgeIt e(g); e!=INVALID; ++e) { + for(UEdgeIt e(g); e!=INVALID; ++e) { if ( map[e] ) { Node u=g.source(e); Node v=g.target(e); @@ -282,7 +282,7 @@ ///edges \c e with \c map[e]==true form the matching. template void writeEMapBool (EMapB& map) const { - for(UndirEdgeIt e(g); e!=INVALID; ++e) map.set(e,false); + for(UEdgeIt e(g); e!=INVALID; ++e) map.set(e,false); typename Graph::template NodeMap todo(g,true); for(NodeIt v(g); v!=INVALID; ++v) { diff -r e225719bde6b -r 2d806130e700 lemon/path.h --- a/lemon/path.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/path.h Thu Jan 26 15:42:13 2006 +0000 @@ -385,7 +385,7 @@ //! \todo Thoroughfully check all the range and consistency tests. /// \todo May we need just path for undirected graph instead of this. template - class UndirPath { + class UPath { public: /// Edge type of the underlying graph. typedef typename Graph::Edge GraphEdge; @@ -403,13 +403,13 @@ /// \param _G The graph in which the path is. /// - UndirPath(const Graph &_G) : gr(&_G) {} + UPath(const Graph &_G) : gr(&_G) {} /// \brief Subpath constructor. /// /// Subpath defined by two nodes. /// \warning It is an error if the two edges are not in order! - UndirPath(const UndirPath &P, const NodeIt &a, const NodeIt &b) { + UPath(const UPath &P, const NodeIt &a, const NodeIt &b) { gr = P.gr; edges.insert(edges.end(), P.edges.begin()+a.idx, P.edges.begin()+b.idx); } @@ -418,7 +418,7 @@ /// /// Subpath defined by two edges. Contains edges in [a,b) /// \warning It is an error if the two edges are not in order! - UndirPath(const UndirPath &P, const EdgeIt &a, const EdgeIt &b) { + UPath(const UPath &P, const EdgeIt &a, const EdgeIt &b) { gr = P.gr; edges.insert(edges.end(), P.edges.begin()+a.idx, P.edges.begin()+b.idx); } @@ -500,17 +500,17 @@ * Yes, it shouldn't. */ class EdgeIt { - friend class UndirPath; + friend class UPath; int idx; - const UndirPath *p; + const UPath *p; public: /// Default constructor EdgeIt() {} /// Invalid constructor EdgeIt(Invalid) : idx(-1), p(0) {} /// Constructor with starting point - EdgeIt(const UndirPath &_p, int _idx = 0) : + EdgeIt(const UPath &_p, int _idx = 0) : idx(_idx), p(&_p) { validate(); } ///Validity check @@ -547,17 +547,17 @@ * Yes, it shouldn't. */ class NodeIt { - friend class UndirPath; + friend class UPath; int idx; - const UndirPath *p; + const UPath *p; public: /// Default constructor NodeIt() {} /// Invalid constructor NodeIt(Invalid) : idx(-1), p(0) {} /// Constructor with starting point - NodeIt(const UndirPath &_p, int _idx = 0) : + NodeIt(const UPath &_p, int _idx = 0) : idx(_idx), p(&_p) { validate(); } ///Validity check @@ -600,17 +600,17 @@ * PathConcept) while the builder is active (after the first modifying * operation and until the commit()) the original Path is in a * "transitional" state (operations ot it have undefined result). But - * in the case of UndirPath the original path is unchanged until the + * in the case of UPath the original path is unchanged until the * commit. However we don't recomend that you use this feature. */ class Builder { - UndirPath &P; + UPath &P; Container front, back; public: ///\param _p the path you want to fill in. /// - Builder(UndirPath &_p) : P(_p) {} + Builder(UPath &_p) : P(_p) {} /// Sets the starting node of the path. diff -r e225719bde6b -r 2d806130e700 lemon/smart_graph.h --- a/lemon/smart_graph.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/smart_graph.h Thu Jan 26 15:42:13 2006 +0000 @@ -19,7 +19,7 @@ ///\ingroup graphs ///\file -///\brief SmartGraph and UndirSmartGraph classes. +///\brief SmartGraph and SmartUGraph classes. #include @@ -353,35 +353,37 @@ /**************** Undirected List Graph ****************/ - typedef ClearableUndirGraphExtender< - ExtendableUndirGraphExtender< - MappableUndirGraphExtender< - IterableUndirGraphExtender< - AlterableUndirGraphExtender< - UndirGraphExtender > > > > > ExtendedUndirSmartGraphBase; + typedef ClearableUGraphExtender< + ExtendableUGraphExtender< + MappableUGraphExtender< + IterableUGraphExtender< + AlterableUGraphExtender< + UGraphExtender > > > > > ExtendedSmartUGraphBase; - ///A smart undirected graph class. - - ///This is a simple and fast undirected graph implementation. - ///It is also quite memory efficient, but at the price - ///that it does support only limited (only stack-like) - ///node and edge deletions. - ///Except from this it conforms to - ///the \ref concept::UndirGraph "UndirGraph" concept. - ///\sa concept::UndirGraph. + /// \ingroup graphs /// - ///\todo Snapshot hasn't been implemented yet. + /// \brief A smart undirected graph class. /// - class UndirSmartGraph : public ExtendedUndirSmartGraphBase { + /// This is a simple and fast undirected graph implementation. + /// It is also quite memory efficient, but at the price + /// that it does support only limited (only stack-like) + /// node and edge deletions. + /// Except from this it conforms to + /// the \ref concept::UGraph "UGraph" concept. + /// \sa concept::UGraph. + /// + /// \todo Snapshot hasn't been implemented yet. + /// + class SmartUGraph : public ExtendedSmartUGraphBase { }; - class SmartUndirBipartiteGraphBase { + class SmartUBipartiteGraphBase { public: class NodeSetError : public LogicError { virtual const char* exceptionName() const { - return "lemon::FullUndirBipartiteGraph::NodeSetError"; + return "lemon::FullUBipartiteGraph::NodeSetError"; } }; @@ -406,7 +408,7 @@ public: class Node { - friend class SmartUndirBipartiteGraphBase; + friend class SmartUBipartiteGraphBase; protected: int id; @@ -420,7 +422,7 @@ }; class Edge { - friend class SmartUndirBipartiteGraphBase; + friend class SmartUBipartiteGraphBase; protected: int id; @@ -583,18 +585,18 @@ }; - typedef ClearableUndirBipartiteGraphExtender< - ExtendableUndirBipartiteGraphExtender< - MappableUndirBipartiteGraphExtender< - IterableUndirBipartiteGraphExtender< - AlterableUndirBipartiteGraphExtender< - UndirBipartiteGraphExtender < - SmartUndirBipartiteGraphBase> > > > > > - ExtendedSmartUndirBipartiteGraphBase; + typedef ClearableUBipartiteGraphExtender< + ExtendableUBipartiteGraphExtender< + MappableUBipartiteGraphExtender< + IterableUBipartiteGraphExtender< + AlterableUBipartiteGraphExtender< + UBipartiteGraphExtender < + SmartUBipartiteGraphBase> > > > > > + ExtendedSmartUBipartiteGraphBase; - class SmartUndirBipartiteGraph : - public ExtendedSmartUndirBipartiteGraphBase { + class SmartUBipartiteGraph : + public ExtendedSmartUBipartiteGraphBase { }; diff -r e225719bde6b -r 2d806130e700 lemon/sub_graph.h --- a/lemon/sub_graph.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/sub_graph.h Thu Jan 26 15:42:13 2006 +0000 @@ -694,13 +694,13 @@ // typename CapacityMap, typename FlowMap> // class ResGraph // : public IterableGraphExtender > > { +// UGraphAdaptor > > { // public: // typedef IterableGraphExtender > > Parent; +// UGraphAdaptor > > Parent; // protected: -// UndirGraphAdaptor undir; +// UGraphAdaptor u; // const CapacityMap* capacity; // FlowMap* flow; @@ -718,15 +718,15 @@ // public: -// typedef typename UndirGraphAdaptor::Node Node; -// typedef typename UndirGraphAdaptor::Edge Edge; -// typedef typename UndirGraphAdaptor::UndirEdge UndirEdge; +// typedef typename UGraphAdaptor::Node Node; +// typedef typename UGraphAdaptor::Edge Edge; +// typedef typename UGraphAdaptor::UEdge UEdge; // ResGraphAdaptor(Graph& _graph, // const CapacityMap& _capacity, FlowMap& _flow) -// : Parent(), undir(_graph), capacity(&_capacity), flow(&_flow), +// : Parent(), u(_graph), capacity(&_capacity), flow(&_flow), // nodes(*this, _graph), edges(*this, _graph) { -// Parent::construct(undir, nodes, edges); +// Parent::construct(u, nodes, edges); // setFlowMap(_flow); // setCapacityMap(_capacity); // typename Graph::Edge edge; @@ -770,11 +770,11 @@ // return Parent::getGraph().direction(edge); // } -// Edge direct(const UndirEdge& edge, bool direction) const { +// Edge direct(const UEdge& edge, bool direction) const { // return Parent::getGraph().direct(edge, direction); // } -// Edge direct(const UndirEdge& edge, const Node& node) const { +// Edge direct(const UEdge& edge, const Node& node) const { // return Parent::getGraph().direct(edge, node); // } diff -r e225719bde6b -r 2d806130e700 lemon/topology.h --- a/lemon/topology.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/topology.h Thu Jan 26 15:42:13 2006 +0000 @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -49,12 +49,12 @@ /// \param graph The undirected graph. /// \return %True when there is path between any two nodes in the graph. /// \note By definition, the empty graph is connected. - template - bool connected(const UndirGraph& graph) { - checkConcept(); - typedef typename UndirGraph::NodeIt NodeIt; + template + bool connected(const UGraph& graph) { + checkConcept(); + typedef typename UGraph::NodeIt NodeIt; if (NodeIt(graph) == INVALID) return true; - Dfs dfs(graph); + Dfs dfs(graph); dfs.run(NodeIt(graph)); for (NodeIt it(graph); it != INVALID; ++it) { if (!dfs.reached(it)) { @@ -74,17 +74,17 @@ /// \return The number of components /// \note By definition, the empty graph consists /// of zero connected components. - template - int countConnectedComponents(const UndirGraph &graph) { - checkConcept(); - typedef typename UndirGraph::Node Node; - typedef typename UndirGraph::Edge Edge; + template + int countConnectedComponents(const UGraph &graph) { + checkConcept(); + typedef typename UGraph::Node Node; + typedef typename UGraph::Edge Edge; typedef NullMap PredMap; typedef NullMap DistMap; int compNum = 0; - typename Bfs:: + typename Bfs:: template DefPredMap:: template DefDistMap:: Create bfs(graph); @@ -96,7 +96,7 @@ bfs.distMap(distMap); bfs.init(); - for(typename UndirGraph::NodeIt n(graph); n != INVALID; ++n) { + for(typename UGraph::NodeIt n(graph); n != INVALID; ++n) { if (!bfs.reached(n)) { bfs.addSource(n); bfs.start(); @@ -122,18 +122,18 @@ /// set continuously. /// \return The number of components /// - template - int connectedComponents(const UndirGraph &graph, NodeMap &compMap) { - checkConcept(); - typedef typename UndirGraph::Node Node; - typedef typename UndirGraph::Edge Edge; + template + int connectedComponents(const UGraph &graph, NodeMap &compMap) { + checkConcept(); + typedef typename UGraph::Node Node; + typedef typename UGraph::Edge Edge; checkConcept, NodeMap>(); typedef NullMap PredMap; typedef NullMap DistMap; int compNum = 0; - typename Bfs:: + typename Bfs:: template DefPredMap:: template DefDistMap:: Create bfs(graph); @@ -145,7 +145,7 @@ bfs.distMap(distMap); bfs.init(); - for(typename UndirGraph::NodeIt n(graph); n != INVALID; ++n) { + for(typename UGraph::NodeIt n(graph); n != INVALID; ++n) { if(!bfs.reached(n)) { bfs.addSource(n); while (!bfs.emptyQueue()) { @@ -484,7 +484,7 @@ public: typedef typename Graph::Node Node; typedef typename Graph::Edge Edge; - typedef typename Graph::UndirEdge UndirEdge; + typedef typename Graph::UEdge UEdge; CountBiNodeConnectedComponentsVisitor(const Graph& graph, int &compNum) : _graph(graph), _compNum(compNum), @@ -542,7 +542,7 @@ public: typedef typename Graph::Node Node; typedef typename Graph::Edge Edge; - typedef typename Graph::UndirEdge UndirEdge; + typedef typename Graph::UEdge UEdge; BiNodeConnectedComponentsVisitor(const Graph& graph, EdgeMap& compMap, int &compNum) @@ -612,7 +612,7 @@ typename Graph::template NodeMap _numMap; typename Graph::template NodeMap _retMap; typename Graph::template NodeMap _predMap; - std::stack _edgeStack; + std::stack _edgeStack; int _num; }; @@ -622,7 +622,7 @@ public: typedef typename Graph::Node Node; typedef typename Graph::Edge Edge; - typedef typename Graph::UndirEdge UndirEdge; + typedef typename Graph::UEdge UEdge; BiNodeConnectedCutNodesVisitor(const Graph& graph, NodeMap& cutMap, int& cutNum) @@ -688,15 +688,15 @@ typename Graph::template NodeMap _numMap; typename Graph::template NodeMap _retMap; typename Graph::template NodeMap _predMap; - std::stack _edgeStack; + std::stack _edgeStack; int _num; bool rootCut; }; } - template - int countBiNodeConnectedComponents(const UndirGraph& graph); + template + int countBiNodeConnectedComponents(const UGraph& graph); /// \ingroup topology /// @@ -709,8 +709,8 @@ /// \param graph The graph. /// \return %True when the graph bi-node-connected. /// \todo Make it faster. - template - bool biNodeConnected(const UndirGraph& graph) { + template + bool biNodeConnected(const UGraph& graph) { return countBiNodeConnectedComponents(graph) == 1; } @@ -725,19 +725,19 @@ /// /// \param graph The graph. /// \return The number of components. - template - int countBiNodeConnectedComponents(const UndirGraph& graph) { - checkConcept(); - typedef typename UndirGraph::NodeIt NodeIt; + template + int countBiNodeConnectedComponents(const UGraph& graph) { + checkConcept(); + typedef typename UGraph::NodeIt NodeIt; using namespace _topology_bits; - typedef CountBiNodeConnectedComponentsVisitor Visitor; + typedef CountBiNodeConnectedComponentsVisitor Visitor; int compNum = 0; Visitor visitor(graph, compNum); - DfsVisit dfs(graph, visitor); + DfsVisit dfs(graph, visitor); dfs.init(); for (NodeIt it(graph); it != INVALID; ++it) { @@ -762,28 +762,28 @@ /// \image latex node_biconnected_components.eps "bi-node-connected components" width=\textwidth /// /// \param graph The graph. - /// \retval compMap A writable undir edge map. The values will be set from 0 + /// \retval compMap A writable uedge map. The values will be set from 0 /// to the number of the biconnected components minus one. Each values /// of the map will be set exactly once, the values of a certain component /// will be set continuously. /// \return The number of components. /// - template - int biNodeConnectedComponents(const UndirGraph& graph, - UndirEdgeMap& compMap) { - checkConcept(); - typedef typename UndirGraph::NodeIt NodeIt; - typedef typename UndirGraph::UndirEdge UndirEdge; - checkConcept, UndirEdgeMap>(); + template + int biNodeConnectedComponents(const UGraph& graph, + UEdgeMap& compMap) { + checkConcept(); + typedef typename UGraph::NodeIt NodeIt; + typedef typename UGraph::UEdge UEdge; + checkConcept, UEdgeMap>(); using namespace _topology_bits; - typedef BiNodeConnectedComponentsVisitor Visitor; + typedef BiNodeConnectedComponentsVisitor Visitor; int compNum = 0; Visitor visitor(graph, compMap, compNum); - DfsVisit dfs(graph, visitor); + DfsVisit dfs(graph, visitor); dfs.init(); for (NodeIt it(graph); it != INVALID; ++it) { @@ -809,21 +809,21 @@ /// \retval cutMap A writable edge map. The values will be set true when /// the node separate two or more components. /// \return The number of the cut nodes. - template - int biNodeConnectedCutNodes(const UndirGraph& graph, NodeMap& cutMap) { - checkConcept(); - typedef typename UndirGraph::Node Node; - typedef typename UndirGraph::NodeIt NodeIt; + template + int biNodeConnectedCutNodes(const UGraph& graph, NodeMap& cutMap) { + checkConcept(); + typedef typename UGraph::Node Node; + typedef typename UGraph::NodeIt NodeIt; checkConcept, NodeMap>(); using namespace _topology_bits; - typedef BiNodeConnectedCutNodesVisitor Visitor; + typedef BiNodeConnectedCutNodesVisitor Visitor; int cutNum = 0; Visitor visitor(graph, cutMap, cutNum); - DfsVisit dfs(graph, visitor); + DfsVisit dfs(graph, visitor); dfs.init(); for (NodeIt it(graph); it != INVALID; ++it) { @@ -842,7 +842,7 @@ public: typedef typename Graph::Node Node; typedef typename Graph::Edge Edge; - typedef typename Graph::UndirEdge UndirEdge; + typedef typename Graph::UEdge UEdge; CountBiEdgeConnectedComponentsVisitor(const Graph& graph, int &compNum) : _graph(graph), _compNum(compNum), @@ -898,7 +898,7 @@ public: typedef typename Graph::Node Node; typedef typename Graph::Edge Edge; - typedef typename Graph::UndirEdge UndirEdge; + typedef typename Graph::UEdge UEdge; BiEdgeConnectedComponentsVisitor(const Graph& graph, NodeMap& compMap, int &compNum) @@ -965,7 +965,7 @@ public: typedef typename Graph::Node Node; typedef typename Graph::Edge Edge; - typedef typename Graph::UndirEdge UndirEdge; + typedef typename Graph::UEdge UEdge; BiEdgeConnectedCutEdgesVisitor(const Graph& graph, EdgeMap& cutMap, int &cutNum) @@ -1022,8 +1022,8 @@ }; } - template - int countbiEdgeConnectedComponents(const UndirGraph& graph); + template + int countbiEdgeConnectedComponents(const UGraph& graph); /// \ingroup topology /// @@ -1036,8 +1036,8 @@ /// \param graph The undirected graph. /// \return The number of components. /// \todo Make it faster. - template - bool biEdgeConnected(const UndirGraph& graph) { + template + bool biEdgeConnected(const UGraph& graph) { return countBiEdgeConnectedComponents(graph) == 1; } @@ -1052,19 +1052,19 @@ /// /// \param graph The undirected graph. /// \return The number of components. - template - int countBiEdgeConnectedComponents(const UndirGraph& graph) { - checkConcept(); - typedef typename UndirGraph::NodeIt NodeIt; + template + int countBiEdgeConnectedComponents(const UGraph& graph) { + checkConcept(); + typedef typename UGraph::NodeIt NodeIt; using namespace _topology_bits; - typedef CountBiEdgeConnectedComponentsVisitor Visitor; + typedef CountBiEdgeConnectedComponentsVisitor Visitor; int compNum = 0; Visitor visitor(graph, compNum); - DfsVisit dfs(graph, visitor); + DfsVisit dfs(graph, visitor); dfs.init(); for (NodeIt it(graph); it != INVALID; ++it) { @@ -1095,21 +1095,21 @@ /// will be set continuously. /// \return The number of components. /// - template - int biEdgeConnectedComponents(const UndirGraph& graph, NodeMap& compMap) { - checkConcept(); - typedef typename UndirGraph::NodeIt NodeIt; - typedef typename UndirGraph::Node Node; + template + int biEdgeConnectedComponents(const UGraph& graph, NodeMap& compMap) { + checkConcept(); + typedef typename UGraph::NodeIt NodeIt; + typedef typename UGraph::Node Node; checkConcept, NodeMap>(); using namespace _topology_bits; - typedef BiEdgeConnectedComponentsVisitor Visitor; + typedef BiEdgeConnectedComponentsVisitor Visitor; int compNum = 0; Visitor visitor(graph, compMap, compNum); - DfsVisit dfs(graph, visitor); + DfsVisit dfs(graph, visitor); dfs.init(); for (NodeIt it(graph); it != INVALID; ++it) { @@ -1136,21 +1136,21 @@ /// \retval cutMap A writable node map. The values will be set true when the /// edge is a cut edge. /// \return The number of cut edges. - template - int biEdgeConnectedCutEdges(const UndirGraph& graph, UndirEdgeMap& cutMap) { - checkConcept(); - typedef typename UndirGraph::NodeIt NodeIt; - typedef typename UndirGraph::UndirEdge UndirEdge; - checkConcept, UndirEdgeMap>(); + template + int biEdgeConnectedCutEdges(const UGraph& graph, UEdgeMap& cutMap) { + checkConcept(); + typedef typename UGraph::NodeIt NodeIt; + typedef typename UGraph::UEdge UEdge; + checkConcept, UEdgeMap>(); using namespace _topology_bits; - typedef BiEdgeConnectedCutEdgesVisitor Visitor; + typedef BiEdgeConnectedCutEdgesVisitor Visitor; int cutNum = 0; Visitor visitor(graph, cutMap, cutNum); - DfsVisit dfs(graph, visitor); + DfsVisit dfs(graph, visitor); dfs.init(); for (NodeIt it(graph); it != INVALID; ++it) { @@ -1326,13 +1326,13 @@ /// \param graph The undirected graph. /// \return %True when there is no circle in the graph. /// \see dag - template - bool acyclic(const UndirGraph& graph) { - checkConcept(); - typedef typename UndirGraph::Node Node; - typedef typename UndirGraph::NodeIt NodeIt; - typedef typename UndirGraph::Edge Edge; - Dfs dfs(graph); + template + bool acyclic(const UGraph& graph) { + checkConcept(); + typedef typename UGraph::Node Node; + typedef typename UGraph::NodeIt NodeIt; + typedef typename UGraph::Edge Edge; + Dfs dfs(graph); dfs.init(); for (NodeIt it(graph); it != INVALID; ++it) { if (!dfs.reached(it)) { @@ -1359,13 +1359,13 @@ /// Check that the given undirected graph is tree. /// \param graph The undirected graph. /// \return %True when the graph is acyclic and connected. - template - bool tree(const UndirGraph& graph) { - checkConcept(); - typedef typename UndirGraph::Node Node; - typedef typename UndirGraph::NodeIt NodeIt; - typedef typename UndirGraph::Edge Edge; - Dfs dfs(graph); + template + bool tree(const UGraph& graph) { + checkConcept(); + typedef typename UGraph::Node Node; + typedef typename UGraph::NodeIt NodeIt; + typedef typename UGraph::Edge Edge; + Dfs dfs(graph); dfs.init(); dfs.addSource(NodeIt(graph)); while (!dfs.emptyQueue()) { @@ -1397,14 +1397,14 @@ /// \sa bipartitePartitions /// /// \author Balazs Attila Mihaly - template - inline bool bipartite(const UndirGraph &graph){ - checkConcept(); + template + inline bool bipartite(const UGraph &graph){ + checkConcept(); - typedef typename UndirGraph::NodeIt NodeIt; - typedef typename UndirGraph::EdgeIt EdgeIt; + typedef typename UGraph::NodeIt NodeIt; + typedef typename UGraph::EdgeIt EdgeIt; - Bfs bfs(graph); + Bfs bfs(graph); bfs.init(); for(NodeIt i(graph);i!=INVALID;++i){ if(!bfs.reached(i)){ @@ -1434,15 +1434,15 @@ /// /// \image html bipartite_partitions.png /// \image latex bipartite_partitions.eps "Bipartite partititions" width=\textwidth - template - inline bool bipartitePartitions(const UndirGraph &graph, NodeMap &partMap){ - checkConcept(); + template + inline bool bipartitePartitions(const UGraph &graph, NodeMap &partMap){ + checkConcept(); - typedef typename UndirGraph::Node Node; - typedef typename UndirGraph::NodeIt NodeIt; - typedef typename UndirGraph::EdgeIt EdgeIt; + typedef typename UGraph::Node Node; + typedef typename UGraph::NodeIt NodeIt; + typedef typename UGraph::EdgeIt EdgeIt; - Bfs bfs(graph); + Bfs bfs(graph); bfs.init(); for(NodeIt i(graph);i!=INVALID;++i){ if(!bfs.reached(i)){ diff -r e225719bde6b -r 2d806130e700 lemon/traits.h --- a/lemon/traits.h Thu Jan 26 06:44:22 2006 +0000 +++ b/lemon/traits.h Thu Jan 26 15:42:13 2006 +0000 @@ -72,18 +72,18 @@ }; template - class ItemSetTraits<_Graph, typename _Graph::UndirEdge> { + class ItemSetTraits<_Graph, typename _Graph::UEdge> { public: typedef _Graph Graph; - typedef typename Graph::UndirEdge Item; - typedef typename Graph::UndirEdgeIt ItemIt; + typedef typename Graph::UEdge Item; + typedef typename Graph::UEdgeIt ItemIt; template - class Map : public Graph::template UndirEdgeMap<_Value> { + class Map : public Graph::template UEdgeMap<_Value> { public: - typedef typename Graph::template UndirEdgeMap<_Value> Parent; + typedef typename Graph::template UEdgeMap<_Value> Parent; typedef typename Parent::Value Value; Map(const Graph& _graph) : Parent(_graph) {} diff -r e225719bde6b -r 2d806130e700 test/Makefile.am --- a/test/Makefile.am Thu Jan 26 06:44:22 2006 +0000 +++ b/test/Makefile.am Thu Jan 26 15:42:13 2006 +0000 @@ -33,7 +33,7 @@ test_tools_pass \ time_measure_test \ unionfind_test \ - undir_graph_test \ + ugraph_test \ xy_test \ heap_test @@ -70,7 +70,7 @@ test_tools_pass_SOURCES = test_tools_pass.cc unionfind_test_SOURCES = unionfind_test.cc xy_test_SOURCES = xy_test.cc -undir_graph_test_SOURCES = undir_graph_test.cc +ugraph_test_SOURCES = ugraph_test.cc heap_test_SOURCES = heap_test.cc lp_test_SOURCES = lp_test.cc diff -r e225719bde6b -r 2d806130e700 test/graph_adaptor_test.cc --- a/test/graph_adaptor_test.cc Thu Jan 26 06:44:22 2006 +0000 +++ b/test/graph_adaptor_test.cc Thu Jan 26 15:42:13 2006 +0000 @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include @@ -65,9 +65,9 @@ Graph::NodeMap > >(); /// \bug why does not compile with StaticGraph - checkConcept >(); - checkConcept >(); - checkConcept >(); + checkConcept >(); + checkConcept >(); + checkConcept >(); } std::cout << __FILE__ ": All tests passed.\n"; diff -r e225719bde6b -r 2d806130e700 test/max_matching_test.cc --- a/test/max_matching_test.cc Thu Jan 26 06:44:22 2006 +0000 +++ b/test/max_matching_test.cc Thu Jan 26 15:42:13 2006 +0000 @@ -31,10 +31,10 @@ int main() { - typedef UndirListGraph Graph; + typedef ListUGraph Graph; typedef Graph::Edge Edge; - typedef Graph::UndirEdgeIt UndirEdgeIt; + typedef Graph::UEdgeIt UEdgeIt; typedef Graph::IncEdgeIt IncEdgeIt; typedef Graph::NodeIt NodeIt; typedef Graph::Node Node; @@ -138,7 +138,7 @@ check ( coincide, "The decompositions do not coincide! " ); bool noedge=true; - for(UndirEdgeIt e(g); e!=INVALID; ++e) { + for(UEdgeIt e(g); e!=INVALID; ++e) { if ( (pos[g.target(e)]==max_matching.C && pos[g.source(e)]==max_matching.D) || (pos[g.target(e)]==max_matching.D && pos[g.source(e)]==max_matching.C) ) noedge=false; diff -r e225719bde6b -r 2d806130e700 test/path_test.cc --- a/test/path_test.cc Thu Jan 26 06:44:22 2006 +0000 +++ b/test/path_test.cc Thu Jan 26 15:42:13 2006 +0000 @@ -89,7 +89,7 @@ template void checkCompilePath< concept::Path >(concept::Path &); template void checkCompilePath< DirPath >(DirPath &); -template void checkCompilePath< UndirPath >(UndirPath &); +template void checkCompilePath< UPath >(UPath &); int main() { diff -r e225719bde6b -r 2d806130e700 test/test_tools.h --- a/test/test_tools.h Thu Jan 26 06:44:22 2006 +0000 +++ b/test/test_tools.h Thu Jan 26 15:42:13 2006 +0000 @@ -133,22 +133,22 @@ } } -///Structure returned by \ref addUndirPetersen(). +///Structure returned by \ref addUPetersen(). -///Structure returned by \ref addUndirPetersen(). +///Structure returned by \ref addUPetersen(). /// -template struct UndirPetStruct +template struct UPetStruct { ///Vector containing the outer nodes. std::vector outer; ///Vector containing the inner nodes. std::vector inner; ///Vector containing the edges of the inner circle. - std::vector incir; + std::vector incir; ///Vector containing the edges of the outer circle. - std::vector outcir; + std::vector outcir; ///Vector containing the chord edges. - std::vector chords; + std::vector chords; }; ///Adds a Petersen graph to the undirected \c G. @@ -157,9 +157,9 @@ ///\return The nodes and edges of the generated graph. template -UndirPetStruct addUndirPetersen(Graph &G,int num=5) +UPetStruct addUPetersen(Graph &G,int num=5) { - UndirPetStruct n; + UPetStruct n; for(int i=0;i +#include +#include +#include +#include +#include + +#include + +#include "test_tools.h" + + +using namespace lemon; +using namespace lemon::concept; + +void check_concepts() { + typedef UGraphExtender ListUGraphBase; + + typedef IterableUGraphExtender< + AlterableUGraphExtender > IterableListUGraph; + + typedef MappableUGraphExtender + MappableListUGraph; + + typedef ErasableUGraphExtender< + ClearableUGraphExtender< + ExtendableUGraphExtender > > Graph; + + checkConcept(); + checkConcept(); + checkConcept(); + + checkConcept(); + checkConcept(); + + checkConcept(); + checkConcept(); + + checkConcept(); + checkConcept(); + + checkConcept(); + + checkConcept(); + + checkConcept(); +} + +template +void check_item_counts(Graph &g, int n, int e) { + int nn = 0; + for (typename Graph::NodeIt it(g); it != INVALID; ++it) { + ++nn; + } + + check(nn == n, "Wrong node number."); + check(countNodes(g) == n, "Wrong node number."); + + int ee = 0; + for (typename Graph::EdgeIt it(g); it != INVALID; ++it) { + ++ee; + } + + check(ee == 2*e, "Wrong edge number."); + check(countEdges(g) == 2*e, "Wrong edge number."); + + int uee = 0; + for (typename Graph::UEdgeIt it(g); it != INVALID; ++it) { + ++uee; + } + + check(uee == e, "Wrong uedge number."); + check(countUEdges(g) == e, "Wrong uedge number."); +} + +template +void print_items(Graph &g) { + + typedef typename Graph::NodeIt NodeIt; + typedef typename Graph::UEdgeIt UEdgeIt; + typedef typename Graph::EdgeIt EdgeIt; + + std::cout << "Nodes" << std::endl; + int i=0; + for(NodeIt it(g); it!=INVALID; ++it, ++i) { + std::cout << " " << i << ": " << g.id(it) << std::endl; + } + + std::cout << "UEdge" << std::endl; + i=0; + for(UEdgeIt it(g); it!=INVALID; ++it, ++i) { + std::cout << " " << i << ": " << g.id(it) + << " (" << g.id(g.source(it)) << ", " << g.id(g.target(it)) + << ")" << std::endl; + } + + std::cout << "Edge" << std::endl; + i=0; + for(EdgeIt it(g); it!=INVALID; ++it, ++i) { + std::cout << " " << i << ": " << g.id(it) + << " (" << g.id(g.source(it)) << ", " << g.id(g.target(it)) + << ")" << std::endl; + } + +} + +template +void check_graph() { + + typedef typename Graph::Node Node; + typedef typename Graph::UEdge UEdge; + typedef typename Graph::Edge Edge; + typedef typename Graph::NodeIt NodeIt; + typedef typename Graph::UEdgeIt UEdgeIt; + typedef typename Graph::EdgeIt EdgeIt; + + Graph g; + + check_item_counts(g,0,0); + + Node + n1 = g.addNode(), + n2 = g.addNode(), + n3 = g.addNode(); + + UEdge + e1 = g.addEdge(n1, n2), + e2 = g.addEdge(n2, n3); + + // print_items(g); + + check_item_counts(g,3,2); +} + +void checkGridGraph(const GridGraph& g, int w, int h) { + check(g.width() == w, "Wrong width"); + check(g.height() == h, "Wrong height"); + + for (int i = 0; i < w; ++i) { + for (int j = 0; j < h; ++j) { + check(g.col(g(i, j)) == i, "Wrong col"); + check(g.row(g(i, j)) == j, "Wrong row"); + } + } + + for (int i = 0; i < w; ++i) { + for (int j = 0; j < h - 1; ++j) { + check(g.source(g.down(g(i, j))) == g(i, j), "Wrong down"); + check(g.target(g.down(g(i, j))) == g(i, j + 1), "Wrong down"); + } + check(g.down(g(i, h - 1)) == INVALID, "Wrong down"); + } + + for (int i = 0; i < w; ++i) { + for (int j = 1; j < h; ++j) { + check(g.source(g.up(g(i, j))) == g(i, j), "Wrong up"); + check(g.target(g.up(g(i, j))) == g(i, j - 1), "Wrong up"); + } + check(g.up(g(i, 0)) == INVALID, "Wrong up"); + } + + for (int j = 0; j < h; ++j) { + for (int i = 0; i < w - 1; ++i) { + check(g.source(g.right(g(i, j))) == g(i, j), "Wrong right"); + check(g.target(g.right(g(i, j))) == g(i + 1, j), "Wrong right"); + } + check(g.right(g(w - 1, j)) == INVALID, "Wrong right"); + } + + for (int j = 0; j < h; ++j) { + for (int i = 1; i < w; ++i) { + check(g.source(g.left(g(i, j))) == g(i, j), "Wrong left"); + check(g.target(g.left(g(i, j))) == g(i - 1, j), "Wrong left"); + } + check(g.left(g(0, j)) == INVALID, "Wrong left"); + } +} + +int main() { + check_concepts(); + + check_graph(); + check_graph(); + + { + FullUGraph g(5); + check_item_counts(g, 5, 10); + } + + { + GridGraph g(5, 6); + check_item_counts(g, 30, 49); + checkGridGraph(g, 5, 6); + } + + std::cout << __FILE__ ": All tests passed.\n"; + + return 0; +} diff -r e225719bde6b -r 2d806130e700 test/undir_graph_test.cc --- a/test/undir_graph_test.cc Thu Jan 26 06:44:22 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,201 +0,0 @@ -// -*- C++ -*- - -#include -#include -#include -#include -#include -#include - -#include - -#include "test_tools.h" - - -using namespace lemon; -using namespace lemon::concept; - -void check_concepts() { - typedef UndirGraphExtender UndirListGraphBase; - - typedef IterableUndirGraphExtender< - AlterableUndirGraphExtender > IterableUndirListGraph; - - typedef MappableUndirGraphExtender - MappableUndirListGraph; - - typedef ErasableUndirGraphExtender< - ClearableUndirGraphExtender< - ExtendableUndirGraphExtender > > Graph; - - checkConcept(); - checkConcept(); - checkConcept(); - - checkConcept(); - checkConcept(); - - checkConcept(); - checkConcept(); - - checkConcept(); - checkConcept(); - - checkConcept(); - - checkConcept(); - - checkConcept(); -} - -template -void check_item_counts(Graph &g, int n, int e) { - int nn = 0; - for (typename Graph::NodeIt it(g); it != INVALID; ++it) { - ++nn; - } - - check(nn == n, "Wrong node number."); - check(countNodes(g) == n, "Wrong node number."); - - int ee = 0; - for (typename Graph::EdgeIt it(g); it != INVALID; ++it) { - ++ee; - } - - check(ee == 2*e, "Wrong edge number."); - check(countEdges(g) == 2*e, "Wrong edge number."); - - int uee = 0; - for (typename Graph::UndirEdgeIt it(g); it != INVALID; ++it) { - ++uee; - } - - check(uee == e, "Wrong undir edge number."); - check(countUndirEdges(g) == e, "Wrong undir edge number."); -} - -template -void print_items(Graph &g) { - - typedef typename Graph::NodeIt NodeIt; - typedef typename Graph::UndirEdgeIt UEdgeIt; - typedef typename Graph::EdgeIt EdgeIt; - - std::cout << "Nodes" << std::endl; - int i=0; - for(NodeIt it(g); it!=INVALID; ++it, ++i) { - std::cout << " " << i << ": " << g.id(it) << std::endl; - } - - std::cout << "UndirEdge" << std::endl; - i=0; - for(UEdgeIt it(g); it!=INVALID; ++it, ++i) { - std::cout << " " << i << ": " << g.id(it) - << " (" << g.id(g.source(it)) << ", " << g.id(g.target(it)) - << ")" << std::endl; - } - - std::cout << "Edge" << std::endl; - i=0; - for(EdgeIt it(g); it!=INVALID; ++it, ++i) { - std::cout << " " << i << ": " << g.id(it) - << " (" << g.id(g.source(it)) << ", " << g.id(g.target(it)) - << ")" << std::endl; - } - -} - -template -void check_graph() { - - typedef typename Graph::Node Node; - typedef typename Graph::UndirEdge UEdge; - typedef typename Graph::Edge Edge; - typedef typename Graph::NodeIt NodeIt; - typedef typename Graph::UndirEdgeIt UEdgeIt; - typedef typename Graph::EdgeIt EdgeIt; - - Graph g; - - check_item_counts(g,0,0); - - Node - n1 = g.addNode(), - n2 = g.addNode(), - n3 = g.addNode(); - - UEdge - e1 = g.addEdge(n1, n2), - e2 = g.addEdge(n2, n3); - - // print_items(g); - - check_item_counts(g,3,2); -} - -void checkGridGraph(const GridGraph& g, int w, int h) { - check(g.width() == w, "Wrong width"); - check(g.height() == h, "Wrong height"); - - for (int i = 0; i < w; ++i) { - for (int j = 0; j < h; ++j) { - check(g.col(g(i, j)) == i, "Wrong col"); - check(g.row(g(i, j)) == j, "Wrong row"); - } - } - - for (int i = 0; i < w; ++i) { - for (int j = 0; j < h - 1; ++j) { - check(g.source(g.down(g(i, j))) == g(i, j), "Wrong down"); - check(g.target(g.down(g(i, j))) == g(i, j + 1), "Wrong down"); - } - check(g.down(g(i, h - 1)) == INVALID, "Wrong down"); - } - - for (int i = 0; i < w; ++i) { - for (int j = 1; j < h; ++j) { - check(g.source(g.up(g(i, j))) == g(i, j), "Wrong up"); - check(g.target(g.up(g(i, j))) == g(i, j - 1), "Wrong up"); - } - check(g.up(g(i, 0)) == INVALID, "Wrong up"); - } - - for (int j = 0; j < h; ++j) { - for (int i = 0; i < w - 1; ++i) { - check(g.source(g.right(g(i, j))) == g(i, j), "Wrong right"); - check(g.target(g.right(g(i, j))) == g(i + 1, j), "Wrong right"); - } - check(g.right(g(w - 1, j)) == INVALID, "Wrong right"); - } - - for (int j = 0; j < h; ++j) { - for (int i = 1; i < w; ++i) { - check(g.source(g.left(g(i, j))) == g(i, j), "Wrong left"); - check(g.target(g.left(g(i, j))) == g(i - 1, j), "Wrong left"); - } - check(g.left(g(0, j)) == INVALID, "Wrong left"); - } -} - -int main() { - check_concepts(); - - check_graph(); - check_graph(); - - { - UndirFullGraph g(5); - check_item_counts(g, 5, 10); - } - - { - GridGraph g(5, 6); - check_item_counts(g, 30, 49); - checkGridGraph(g, 5, 6); - } - - std::cout << __FILE__ ": All tests passed.\n"; - - return 0; -}