Changeset 1909:2d806130e700 in lemon-0.x
- Timestamp:
- 01/26/06 16:42:13 (18 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2484
- Files:
-
- 44 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
demo/coloring.cc
r1875 r1909 41 41 int main() { 42 42 43 typedef UndirSmartGraph Graph;43 typedef SmartUGraph Graph; 44 44 typedef Graph::Node Node; 45 45 typedef Graph::NodeIt NodeIt; 46 typedef Graph::U ndirEdge UndirEdge;46 typedef Graph::UEdge UEdge; 47 47 typedef Graph::IncEdgeIt IncEdgeIt; 48 48 … … 53 53 Graph graph; 54 54 55 U ndirGraphReader<Graph> reader("coloring.lgf", graph);55 UGraphReader<Graph> reader("coloring.lgf", graph); 56 56 Graph::NodeMap<xy<double> > coords(graph); 57 57 reader.readNodeMap("coords", coords); -
demo/coloring.lgf
r1901 r1909 12 12 (157, -150) 1 13 13 (-282, -149) 0 14 @u ndiredgeset14 @uedgeset 15 15 label 16 16 9 10 17 -
demo/partitions.lgf
r1901 r1909 24 24 -607.82 -246.651 2 25 25 -274 -131 1 26 @u ndiredgeset26 @uedgeset 27 27 label 28 28 12 23 15 -
demo/topology_demo.cc
r1875 r1909 44 44 45 45 void drawConnectedComponents() { 46 typedef UndirListGraph Graph;46 typedef ListUGraph Graph; 47 47 typedef Graph::Node Node; 48 48 … … 50 50 Graph::NodeMap<xy<double> > coords(graph); 51 51 52 U ndirGraphReader<Graph>("undir_components.lgf", graph).52 UGraphReader<Graph>("u_components.lgf", graph). 53 53 readNodeMap("coordinates_x", xMap(coords)). 54 54 readNodeMap("coordinates_y", yMap(coords)). … … 60 60 connectedComponents(graph, compMap); 61 61 62 graphToEps(graph, "connected_components.eps").u ndir().62 graphToEps(graph, "connected_components.eps").u(). 63 63 coords(coords).scaleToA4().enableParallel(). 64 64 parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0). … … 98 98 99 99 void drawNodeBiconnectedComponents() { 100 typedef UndirListGraph Graph;100 typedef ListUGraph Graph; 101 101 typedef Graph::Node Node; 102 typedef Graph::U ndirEdge UndirEdge;102 typedef Graph::UEdge UEdge; 103 103 104 104 Graph graph; 105 105 Graph::NodeMap<xy<double> > coords(graph); 106 106 107 U ndirGraphReader<Graph>("undir_components.lgf", graph).107 UGraphReader<Graph>("u_components.lgf", graph). 108 108 readNodeMap("coordinates_x", xMap(coords)). 109 109 readNodeMap("coordinates_y", yMap(coords)). … … 112 112 ColorSet colorSet; 113 113 114 Graph::U ndirEdgeMap<int> compMap(graph);114 Graph::UEdgeMap<int> compMap(graph); 115 115 Graph::NodeMap<bool> cutMap(graph); 116 116 biNodeConnectedComponents(graph, compMap); 117 117 biNodeConnectedCutNodes(graph, cutMap); 118 graphToEps(graph, "bi_node_connected_components.eps").u ndir().118 graphToEps(graph, "bi_node_connected_components.eps").u(). 119 119 coords(coords).scaleToA4().enableParallel(). 120 120 parEdgeDist(20.0).edgeWidthScale(5.0).nodeScale(20.0). … … 127 127 128 128 void drawEdgeBiconnectedComponents() { 129 typedef UndirListGraph Graph;129 typedef ListUGraph Graph; 130 130 typedef Graph::Node Node; 131 typedef Graph::U ndirEdge UndirEdge;131 typedef Graph::UEdge UEdge; 132 132 133 133 Graph graph; 134 134 Graph::NodeMap<xy<double> > coords(graph); 135 135 136 U ndirGraphReader<Graph>("undir_components.lgf", graph).136 UGraphReader<Graph>("u_components.lgf", graph). 137 137 readNodeMap("coordinates_x", xMap(coords)). 138 138 readNodeMap("coordinates_y", yMap(coords)). … … 142 142 143 143 Graph::NodeMap<int> compMap(graph); 144 Graph::U ndirEdgeMap<bool> cutMap(graph);144 Graph::UEdgeMap<bool> cutMap(graph); 145 145 biEdgeConnectedComponents(graph, compMap); 146 146 biEdgeConnectedCutEdges(graph, cutMap); 147 147 148 graphToEps(graph, "bi_edge_connected_components.eps").u ndir().148 graphToEps(graph, "bi_edge_connected_components.eps").u(). 149 149 coords(coords).scaleToA4().enableParallel(). 150 150 parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0). … … 156 156 157 157 void drawBipartitePartitions() { 158 typedef UndirListGraph Graph;158 typedef ListUGraph Graph; 159 159 typedef Graph::Node Node; 160 typedef Graph::U ndirEdge UndirEdge;160 typedef Graph::UEdge UEdge; 161 161 162 162 Graph graph; 163 163 Graph::NodeMap<xy<double> > coords(graph); 164 164 165 U ndirGraphReader<Graph>("partitions.lgf", graph).165 UGraphReader<Graph>("partitions.lgf", graph). 166 166 readNodeMap("coordinates_x", xMap(coords)). 167 167 readNodeMap("coordinates_y", yMap(coords)). … … 173 173 bipartitePartitions(graph, partMap); 174 174 175 graphToEps(graph, "bipartite_partitions.eps").u ndir().175 graphToEps(graph, "bipartite_partitions.eps").u(). 176 176 coords(coords).scaleToA4().enableParallel(). 177 177 parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0). -
demo/undir_components.lgf
r1901 r1909 44 44 -689.204 -237.261 32 45 45 -567.302 43.6423 33 46 @u ndiredgeset46 @uedgeset 47 47 label 48 48 41 42 44 -
doc/Makefile.am
r1671 r1909 20 20 namespaces.dox \ 21 21 quicktour.dox \ 22 u ndir_graphs.dox22 ugraphs.dox 23 23 24 24 html/index.html: -
doc/graph_io.dox
r1901 r1909 318 318 The specialization of writing is very similar to that of reading. 319 319 320 \section u ndirUndirected graphs321 322 In a file describing an undirected graph (u ndirgraph, for short) you find an323 \c u ndiredgeset section instead of the \c edgeset section. The first line of320 \section u Undirected graphs 321 322 In a file describing an undirected graph (ugraph, for short) you find an 323 \c uedgeset section instead of the \c edgeset section. The first line of 324 324 the section describes the names of the maps on the undirected egdes and all 325 325 next lines describe one undirected edge with the the incident nodes and the … … 331 331 332 332 \code 333 @u ndiredgeset333 @uedgeset 334 334 label capacity +flow -flow 335 335 32 2 1 4.3 2.0 0.0 … … 338 338 \endcode 339 339 340 The \c edges section is changed to \c u ndiredges section. This section340 The \c edges section is changed to \c uedges section. This section 341 341 describes labeled edges and undirected edges. The directed edge label 342 342 should start with a \c '+' or a \c '-' prefix to decide the direction … … 344 344 345 345 \code 346 @u ndiredges347 u ndiredge 1346 @uedges 347 uedge 1 348 348 +edge 5 349 349 -back 5 … … 353 353 \ref lemon::GraphWriter "GraphWriter" which 354 354 handle the undirected graphs. These classes are 355 the \ref lemon::U ndirGraphReader "UndirGraphReader"356 and \ref lemon::U ndirGraphWriter "UndirGraphWriter".357 358 The \ref lemon::U ndirGraphReader::readUndirEdgeMap() "readUndirEdgeMap()"355 the \ref lemon::UGraphReader "UGraphReader" 356 and \ref lemon::UGraphWriter "UGraphWriter". 357 358 The \ref lemon::UGraphReader::readUEdgeMap() "readUEdgeMap()" 359 359 function reads an undirected map and the 360 \ref lemon::U ndirGraphReader::readUndirEdge() "readUndirEdge()"360 \ref lemon::UGraphReader::readUEdge() "readUEdge()" 361 361 reads an undirected edge from the file, 362 362 363 363 \code 364 reader.readU ndirEdgeMap("capacity", capacityMap);364 reader.readUEdgeMap("capacity", capacityMap); 365 365 reader.readEdgeMap("flow", flowMap); 366 366 ... 367 reader.readU ndirEdge("undir_edge", undir_edge);367 reader.readUEdge("u_edge", u_edge); 368 368 reader.readEdge("edge", edge); 369 369 \endcode … … 440 440 441 441 \code 442 UndirListGraph network;443 UndirListGraph::UndirEdgeMap<double> capacity;444 ListEdgeSet< UndirListGraph> traffic(network);445 ListEdgeSet< UndirListGraph>::EdgeMap<double> request(network);442 ListUGraph network; 443 ListUGraph::UEdgeMap<double> capacity; 444 ListEdgeSet<ListUGraph> traffic(network); 445 ListEdgeSet<ListUGraph>::EdgeMap<double> request(network); 446 446 447 447 LemonReader reader(std::cin); 448 NodeSetReader< UndirListGraph> nodesetReader(reader, network);449 U ndirEdgeSetReader<UndirListGraph>450 u ndirEdgesetReader(reader, network, nodesetReader);451 u ndirEdgesetReader.readEdgeMap("capacity", capacity);452 EdgeSetReader<ListEdgeSet< UndirListGraph> >448 NodeSetReader<ListUGraph> nodesetReader(reader, network); 449 UEdgeSetReader<ListUGraph> 450 uEdgesetReader(reader, network, nodesetReader); 451 uEdgesetReader.readEdgeMap("capacity", capacity); 452 EdgeSetReader<ListEdgeSet<ListUGraph> > 453 453 edgesetReader(reader, traffic, nodesetReader, "traffic"); 454 454 edgesetReader.readEdgeMap("request", request); … … 458 458 459 459 Because both the \ref lemon::GraphReader "GraphReader" 460 and the \ref lemon::U ndirGraphReader "UndirGraphReader" can be converted460 and the \ref lemon::UGraphReader "UGraphReader" can be converted 461 461 to \ref lemon::LemonReader "LemonReader" 462 462 and it can resolve the label's of the items, the previous 463 result can be achived with the \ref lemon::U ndirGraphReader "UndirGraphReader"463 result can be achived with the \ref lemon::UGraphReader "UGraphReader" 464 464 class, too. 465 465 466 466 467 467 \code 468 UndirListGraph network;469 UndirListGraph::UndirEdgeSet<double> capacity;470 ListEdgeSet< UndirListGraph> traffic(network);471 ListEdgeSet< UndirListGraph>::EdgeMap<double> request(network);472 473 U ndirGraphReader<UndirListGraph> reader(std::cin, network);468 ListUGraph network; 469 ListUGraph::UEdgeSet<double> capacity; 470 ListEdgeSet<ListUGraph> traffic(network); 471 ListEdgeSet<ListUGraph>::EdgeMap<double> request(network); 472 473 UGraphReader<ListUGraph> reader(std::cin, network); 474 474 reader.readEdgeMap("capacity", capacity); 475 EdgeSetReader<ListEdgeSet< UndirListGraph> >475 EdgeSetReader<ListEdgeSet<ListUGraph> > 476 476 edgesetReader(reader, traffic, reader, "traffic"); 477 477 edgesetReader.readEdgeMap("request", request); -
doc/undir_graphs.dox
r1030 r1909 1 1 /*! 2 2 3 \page u ndir_graphs Undirected graph structures3 \page ugraphs Undirected graph structures 4 4 5 5 The primary data structures of LEMON are the graph classes. -
lemon/Makefile.am
r1866 r1909 91 91 concept/graph.h \ 92 92 concept/graph_component.h \ 93 concept/u ndir_graph.h \93 concept/ugraph.h \ 94 94 concept/matrix_maps.h \ 95 95 concept/maps.h \ -
lemon/bits/alteration_notifier.h
r1875 r1909 443 443 444 444 template <typename _Base> 445 class AlterableU ndirGraphExtender445 class AlterableUGraphExtender 446 446 : public AlterableGraphExtender<_Base> { 447 447 public: 448 448 449 typedef AlterableU ndirGraphExtender Graph;449 typedef AlterableUGraphExtender Graph; 450 450 typedef AlterableGraphExtender<_Base> Parent; 451 451 452 typedef typename Parent::U ndirEdge UndirEdge;452 typedef typename Parent::UEdge UEdge; 453 453 454 454 /// The edge observer registry. 455 typedef AlterationNotifier<U ndirEdge> UndirEdgeNotifier;456 457 protected: 458 459 mutable U ndirEdgeNotifier undir_edge_notifier;455 typedef AlterationNotifier<UEdge> UEdgeNotifier; 456 457 protected: 458 459 mutable UEdgeNotifier u_edge_notifier; 460 460 461 461 public: 462 462 463 463 using Parent::getNotifier; 464 U ndirEdgeNotifier& getNotifier(UndirEdge) const {465 return u ndir_edge_notifier;466 } 467 468 ~AlterableU ndirGraphExtender() {469 u ndir_edge_notifier.clear();464 UEdgeNotifier& getNotifier(UEdge) const { 465 return u_edge_notifier; 466 } 467 468 ~AlterableUGraphExtender() { 469 u_edge_notifier.clear(); 470 470 } 471 471 }; 472 472 473 473 template <typename _Base> 474 class AlterableU ndirEdgeSetExtender474 class AlterableUEdgeSetExtender 475 475 : public AlterableEdgeSetExtender<_Base> { 476 476 public: 477 477 478 typedef AlterableU ndirEdgeSetExtender Graph;478 typedef AlterableUEdgeSetExtender Graph; 479 479 typedef AlterableEdgeSetExtender<_Base> Parent; 480 480 481 typedef typename Parent::U ndirEdge UndirEdge;482 483 typedef AlterationNotifier<U ndirEdge> UndirEdgeNotifier;484 485 protected: 486 487 mutable U ndirEdgeNotifier undir_edge_notifier;481 typedef typename Parent::UEdge UEdge; 482 483 typedef AlterationNotifier<UEdge> UEdgeNotifier; 484 485 protected: 486 487 mutable UEdgeNotifier u_edge_notifier; 488 488 489 489 public: 490 490 491 491 using Parent::getNotifier; 492 U ndirEdgeNotifier& getNotifier(UndirEdge) const {493 return u ndir_edge_notifier;494 } 495 496 ~AlterableU ndirEdgeSetExtender() {497 u ndir_edge_notifier.clear();492 UEdgeNotifier& getNotifier(UEdge) const { 493 return u_edge_notifier; 494 } 495 496 ~AlterableUEdgeSetExtender() { 497 u_edge_notifier.clear(); 498 498 } 499 499 }; … … 502 502 503 503 template <typename _Base> 504 class AlterableU ndirBipartiteGraphExtender : public _Base {504 class AlterableUBipartiteGraphExtender : public _Base { 505 505 public: 506 506 507 507 typedef _Base Parent; 508 typedef AlterableU ndirBipartiteGraphExtender Graph;508 typedef AlterableUBipartiteGraphExtender Graph; 509 509 510 510 typedef typename Parent::Node Node; … … 512 512 typedef typename Parent::UpperNode UpperNode; 513 513 typedef typename Parent::Edge Edge; 514 typedef typename Parent::U ndirEdge UndirEdge;514 typedef typename Parent::UEdge UEdge; 515 515 516 516 … … 519 519 typedef AlterationNotifier<UpperNode> UpperNodeNotifier; 520 520 typedef AlterationNotifier<Edge> EdgeNotifier; 521 typedef AlterationNotifier<U ndirEdge> UndirEdgeNotifier;521 typedef AlterationNotifier<UEdge> UEdgeNotifier; 522 522 523 523 protected: … … 527 527 mutable UpperNodeNotifier upperNodeNotifier; 528 528 mutable EdgeNotifier edgeNotifier; 529 mutable U ndirEdgeNotifier undirEdgeNotifier;529 mutable UEdgeNotifier uEdgeNotifier; 530 530 531 531 public: … … 547 547 } 548 548 549 U ndirEdgeNotifier& getNotifier(UndirEdge) const {550 return u ndirEdgeNotifier;551 } 552 553 ~AlterableU ndirBipartiteGraphExtender() {549 UEdgeNotifier& getNotifier(UEdge) const { 550 return uEdgeNotifier; 551 } 552 553 ~AlterableUBipartiteGraphExtender() { 554 554 nodeNotifier.clear(); 555 555 lowerNodeNotifier.clear(); 556 556 upperNodeNotifier.clear(); 557 557 edgeNotifier.clear(); 558 u ndirEdgeNotifier.clear();558 uEdgeNotifier.clear(); 559 559 } 560 560 -
lemon/bits/clearable_graph_extender.h
r1842 r1909 43 43 44 44 template <typename _Base> 45 class ClearableU ndirGraphExtender : public _Base {45 class ClearableUGraphExtender : public _Base { 46 46 public: 47 47 48 typedef ClearableU ndirGraphExtender Graph;48 typedef ClearableUGraphExtender Graph; 49 49 typedef _Base Parent; 50 50 typedef typename Parent::Node Node; 51 typedef typename Parent::U ndirEdge UndirEdge;51 typedef typename Parent::UEdge UEdge; 52 52 typedef typename Parent::Edge Edge; 53 53 54 54 void clear() { 55 55 Parent::getNotifier(Node()).clear(); 56 Parent::getNotifier(U ndirEdge()).clear();56 Parent::getNotifier(UEdge()).clear(); 57 57 Parent::getNotifier(Edge()).clear(); 58 58 Parent::clear(); … … 61 61 62 62 template <typename _Base> 63 class ClearableU ndirEdgeSetExtender : public _Base {63 class ClearableUEdgeSetExtender : public _Base { 64 64 public: 65 65 66 typedef ClearableU ndirEdgeSetExtender Graph;66 typedef ClearableUEdgeSetExtender Graph; 67 67 typedef _Base Parent; 68 68 typedef typename Parent::Node Node; 69 typedef typename Parent::U ndirEdge UndirEdge;69 typedef typename Parent::UEdge UEdge; 70 70 typedef typename Parent::Edge Edge; 71 71 72 72 void clear() { 73 Parent::getNotifier(U ndirEdge()).clear();73 Parent::getNotifier(UEdge()).clear(); 74 74 Parent::getNotifier(Edge()).clear(); 75 75 Parent::clear(); … … 80 80 81 81 template <typename _Base> 82 class ClearableU ndirBipartiteGraphExtender : public _Base {82 class ClearableUBipartiteGraphExtender : public _Base { 83 83 public: 84 84 85 85 typedef _Base Parent; 86 typedef ClearableU ndirBipartiteGraphExtender Graph;86 typedef ClearableUBipartiteGraphExtender Graph; 87 87 88 88 typedef typename Parent::Node Node; … … 90 90 typedef typename Parent::UpperNode UpperNode; 91 91 typedef typename Parent::Edge Edge; 92 typedef typename Parent::U ndirEdge UndirEdge;92 typedef typename Parent::UEdge UEdge; 93 93 94 94 void clear() { 95 95 Parent::getNotifier(Edge()).clear(); 96 Parent::getNotifier(U ndirEdge()).clear();96 Parent::getNotifier(UEdge()).clear(); 97 97 Parent::getNotifier(Node()).clear(); 98 98 Parent::getNotifier(LowerNode()).clear(); -
lemon/bits/default_map.h
r1875 r1909 267 267 /// \e 268 268 template <typename _Base> 269 class MappableU ndirGraphExtender :269 class MappableUGraphExtender : 270 270 public MappableGraphExtender<_Base> { 271 271 public: 272 272 273 typedef MappableU ndirGraphExtender Graph;273 typedef MappableUGraphExtender Graph; 274 274 typedef MappableGraphExtender<_Base> Parent; 275 275 276 typedef typename Parent::U ndirEdge UndirEdge;277 278 template <typename _Value> 279 class U ndirEdgeMap280 : public IterableMapExtender<DefaultMap<Graph, U ndirEdge, _Value> > {281 public: 282 typedef MappableU ndirGraphExtender Graph;276 typedef typename Parent::UEdge UEdge; 277 278 template <typename _Value> 279 class UEdgeMap 280 : public IterableMapExtender<DefaultMap<Graph, UEdge, _Value> > { 281 public: 282 typedef MappableUGraphExtender Graph; 283 283 typedef IterableMapExtender< 284 DefaultMap<Graph, U ndirEdge, _Value> > Parent;285 286 U ndirEdgeMap(const Graph& _g)287 : Parent(_g) {} 288 U ndirEdgeMap(const Graph& _g, const _Value& _v)289 : Parent(_g, _v) {} 290 291 U ndirEdgeMap& operator=(const UndirEdgeMap& cmap) {292 return operator=<U ndirEdgeMap>(cmap);293 } 294 295 template <typename CMap> 296 U ndirEdgeMap& operator=(const CMap& cmap) {297 checkConcept<concept::ReadMap<U ndirEdge, _Value>, CMap>();298 const typename Parent::Graph* graph = Parent::getGraph(); 299 U ndirEdge it;284 DefaultMap<Graph, UEdge, _Value> > Parent; 285 286 UEdgeMap(const Graph& _g) 287 : Parent(_g) {} 288 UEdgeMap(const Graph& _g, const _Value& _v) 289 : Parent(_g, _v) {} 290 291 UEdgeMap& operator=(const UEdgeMap& cmap) { 292 return operator=<UEdgeMap>(cmap); 293 } 294 295 template <typename CMap> 296 UEdgeMap& operator=(const CMap& cmap) { 297 checkConcept<concept::ReadMap<UEdge, _Value>, CMap>(); 298 const typename Parent::Graph* graph = Parent::getGraph(); 299 UEdge it; 300 300 for (graph->first(it); it != INVALID; graph->next(it)) { 301 301 Parent::set(it, cmap[it]); … … 310 310 /// \e 311 311 template <typename _Base> 312 class MappableU ndirEdgeSetExtender :312 class MappableUEdgeSetExtender : 313 313 public MappableEdgeSetExtender<_Base> { 314 314 public: 315 315 316 typedef MappableU ndirEdgeSetExtender Graph;316 typedef MappableUEdgeSetExtender Graph; 317 317 typedef MappableEdgeSetExtender<_Base> Parent; 318 318 319 typedef typename Parent::U ndirEdge UndirEdge;320 321 template <typename _Value> 322 class U ndirEdgeMap323 : public IterableMapExtender<DefaultMap<Graph, U ndirEdge, _Value> > {324 public: 325 typedef MappableU ndirEdgeSetExtender Graph;319 typedef typename Parent::UEdge UEdge; 320 321 template <typename _Value> 322 class UEdgeMap 323 : public IterableMapExtender<DefaultMap<Graph, UEdge, _Value> > { 324 public: 325 typedef MappableUEdgeSetExtender Graph; 326 326 typedef IterableMapExtender< 327 DefaultMap<Graph, U ndirEdge, _Value> > Parent;328 329 U ndirEdgeMap(const Graph& _g)330 : Parent(_g) {} 331 U ndirEdgeMap(const Graph& _g, const _Value& _v)332 : Parent(_g, _v) {} 333 334 U ndirEdgeMap& operator=(const UndirEdgeMap& cmap) {335 return operator=<U ndirEdgeMap>(cmap);336 } 337 338 template <typename CMap> 339 U ndirEdgeMap& operator=(const CMap& cmap) {340 checkConcept<concept::ReadMap<U ndirEdge, _Value>, CMap>();341 const typename Parent::Graph* graph = Parent::getGraph(); 342 U ndirEdge it;327 DefaultMap<Graph, UEdge, _Value> > Parent; 328 329 UEdgeMap(const Graph& _g) 330 : Parent(_g) {} 331 UEdgeMap(const Graph& _g, const _Value& _v) 332 : Parent(_g, _v) {} 333 334 UEdgeMap& operator=(const UEdgeMap& cmap) { 335 return operator=<UEdgeMap>(cmap); 336 } 337 338 template <typename CMap> 339 UEdgeMap& operator=(const CMap& cmap) { 340 checkConcept<concept::ReadMap<UEdge, _Value>, CMap>(); 341 const typename Parent::Graph* graph = Parent::getGraph(); 342 UEdge it; 343 343 for (graph->first(it); it != INVALID; graph->next(it)) { 344 344 Parent::set(it, cmap[it]); … … 353 353 354 354 template <typename _Base> 355 class MappableU ndirBipartiteGraphExtender : public _Base {355 class MappableUBipartiteGraphExtender : public _Base { 356 356 public: 357 357 358 358 typedef _Base Parent; 359 typedef MappableU ndirBipartiteGraphExtender Graph;359 typedef MappableUBipartiteGraphExtender Graph; 360 360 361 361 typedef typename Parent::Node Node; … … 363 363 typedef typename Parent::LowerNode LowerNode; 364 364 typedef typename Parent::Edge Edge; 365 typedef typename Parent::U ndirEdge UndirEdge;365 typedef typename Parent::UEdge UEdge; 366 366 367 367 template <typename _Value> … … 369 369 : public IterableMapExtender<DefaultMap<Graph, UpperNode, _Value> > { 370 370 public: 371 typedef MappableU ndirBipartiteGraphExtender Graph;371 typedef MappableUBipartiteGraphExtender Graph; 372 372 typedef IterableMapExtender<DefaultMap<Graph, UpperNode, _Value> > 373 373 Parent; … … 406 406 : public IterableMapExtender<DefaultMap<Graph, LowerNode, _Value> > { 407 407 public: 408 typedef MappableU ndirBipartiteGraphExtender Graph;408 typedef MappableUBipartiteGraphExtender Graph; 409 409 typedef IterableMapExtender<DefaultMap<Graph, LowerNode, _Value> > 410 410 Parent; … … 444 444 class NodeMapBase : public Parent::NodeNotifier::ObserverBase { 445 445 public: 446 typedef MappableU ndirBipartiteGraphExtender Graph;446 typedef MappableUBipartiteGraphExtender Graph; 447 447 448 448 typedef Node Key; … … 524 524 : public IterableMapExtender<NodeMapBase<_Value> > { 525 525 public: 526 typedef MappableU ndirBipartiteGraphExtender Graph;526 typedef MappableUBipartiteGraphExtender Graph; 527 527 typedef IterableMapExtender< NodeMapBase<_Value> > Parent; 528 528 … … 562 562 : public IterableMapExtender<DefaultMap<Graph, Edge, _Value> > { 563 563 public: 564 typedef MappableU ndirBipartiteGraphExtender Graph;564 typedef MappableUBipartiteGraphExtender Graph; 565 565 typedef IterableMapExtender<DefaultMap<Graph, Edge, _Value> > Parent; 566 566 … … 587 587 588 588 template <typename _Value> 589 class U ndirEdgeMap590 : public IterableMapExtender<DefaultMap<Graph, U ndirEdge, _Value> > {591 public: 592 typedef MappableU ndirBipartiteGraphExtender Graph;593 typedef IterableMapExtender<DefaultMap<Graph, U ndirEdge, _Value> >589 class UEdgeMap 590 : public IterableMapExtender<DefaultMap<Graph, UEdge, _Value> > { 591 public: 592 typedef MappableUBipartiteGraphExtender Graph; 593 typedef IterableMapExtender<DefaultMap<Graph, UEdge, _Value> > 594 594 Parent; 595 595 596 U ndirEdgeMap(const Graph& _g)597 : Parent(_g) {} 598 U ndirEdgeMap(const Graph& _g, const _Value& _v)599 : Parent(_g, _v) {} 600 601 U ndirEdgeMap& operator=(const UndirEdgeMap& cmap) {602 return operator=<U ndirEdgeMap>(cmap);603 } 604 605 template <typename CMap> 606 U ndirEdgeMap& operator=(const CMap& cmap) {607 checkConcept<concept::ReadMap<U ndirEdge, _Value>, CMap>();608 const typename Parent::Graph* graph = Parent::getGraph(); 609 U ndirEdge it;596 UEdgeMap(const Graph& _g) 597 : Parent(_g) {} 598 UEdgeMap(const Graph& _g, const _Value& _v) 599 : Parent(_g, _v) {} 600 601 UEdgeMap& operator=(const UEdgeMap& cmap) { 602 return operator=<UEdgeMap>(cmap); 603 } 604 605 template <typename CMap> 606 UEdgeMap& operator=(const CMap& cmap) { 607 checkConcept<concept::ReadMap<UEdge, _Value>, CMap>(); 608 const typename Parent::Graph* graph = Parent::getGraph(); 609 UEdge it; 610 610 for (graph->first(it); it != INVALID; graph->next(it)) { 611 611 Parent::set(it, cmap[it]); -
lemon/bits/erasable_graph_extender.h
r1842 r1909 63 63 64 64 template <typename _Base> 65 class ErasableU ndirGraphExtender : public _Base {65 class ErasableUGraphExtender : public _Base { 66 66 public: 67 67 68 typedef ErasableU ndirGraphExtender Graph;68 typedef ErasableUGraphExtender Graph; 69 69 typedef _Base Parent; 70 70 71 71 typedef typename Parent::Node Node; 72 typedef typename Parent::U ndirEdge UndirEdge;72 typedef typename Parent::UEdge UEdge; 73 73 typedef typename Parent::Edge Edge; 74 74 … … 85 85 } 86 86 87 void erase(const U ndirEdge& uedge) {87 void erase(const UEdge& uedge) { 88 88 std::vector<Edge> edges; 89 89 edges.push_back(Parent::direct(uedge,true)); 90 90 edges.push_back(Parent::direct(uedge,false)); 91 91 Parent::getNotifier(Edge()).erase(edges); 92 Parent::getNotifier(U ndirEdge()).erase(uedge);92 Parent::getNotifier(UEdge()).erase(uedge); 93 93 Parent::erase(uedge); 94 94 } … … 97 97 98 98 template <typename _Base> 99 class ErasableU ndirEdgeSetExtender : public _Base {99 class ErasableUEdgeSetExtender : public _Base { 100 100 public: 101 101 102 typedef ErasableU ndirEdgeSetExtender Graph;102 typedef ErasableUEdgeSetExtender Graph; 103 103 typedef _Base Parent; 104 104 105 105 typedef typename Parent::Node Node; 106 typedef typename Parent::U ndirEdge UndirEdge;106 typedef typename Parent::UEdge UEdge; 107 107 typedef typename Parent::Edge Edge; 108 108 109 void erase(const U ndirEdge& uedge) {109 void erase(const UEdge& uedge) { 110 110 std::vector<Edge> edges; 111 111 edges.push_back(Parent::direct(uedge,true)); 112 112 edges.push_back(Parent::direct(uedge,false)); 113 113 Parent::getNotifier(Edge()).erase(edges); 114 Parent::getNotifier(U ndirEdge()).erase(uedge);114 Parent::getNotifier(UEdge()).erase(uedge); 115 115 Parent::erase(uedge); 116 116 } -
lemon/bits/extendable_graph_extender.h
r1842 r1909 49 49 50 50 template <typename _Base> 51 class ExtendableU ndirGraphExtender : public _Base {51 class ExtendableUGraphExtender : public _Base { 52 52 public: 53 53 54 typedef ExtendableU ndirGraphExtender Graph;54 typedef ExtendableUGraphExtender Graph; 55 55 typedef _Base Parent; 56 56 57 57 typedef typename Parent::Node Node; 58 58 typedef typename Parent::Edge Edge; 59 typedef typename Parent::U ndirEdge UndirEdge;59 typedef typename Parent::UEdge UEdge; 60 60 61 61 Node addNode() { … … 65 65 } 66 66 67 U ndirEdge addEdge(const Node& from, const Node& to) {68 U ndirEdge uedge = Parent::addEdge(from, to);69 Parent::getNotifier(U ndirEdge()).add(uedge);67 UEdge addEdge(const Node& from, const Node& to) { 68 UEdge uedge = Parent::addEdge(from, to); 69 Parent::getNotifier(UEdge()).add(uedge); 70 70 71 71 std::vector<Edge> edges; … … 80 80 81 81 template <typename _Base> 82 class ExtendableU ndirEdgeSetExtender : public _Base {82 class ExtendableUEdgeSetExtender : public _Base { 83 83 public: 84 84 85 typedef ExtendableU ndirEdgeSetExtender Graph;85 typedef ExtendableUEdgeSetExtender Graph; 86 86 typedef _Base Parent; 87 87 88 88 typedef typename Parent::Node Node; 89 89 typedef typename Parent::Edge Edge; 90 typedef typename Parent::U ndirEdge UndirEdge;90 typedef typename Parent::UEdge UEdge; 91 91 92 U ndirEdge addEdge(const Node& from, const Node& to) {93 U ndirEdge uedge = Parent::addEdge(from, to);94 Parent::getNotifier(U ndirEdge()).add(uedge);92 UEdge addEdge(const Node& from, const Node& to) { 93 UEdge uedge = Parent::addEdge(from, to); 94 Parent::getNotifier(UEdge()).add(uedge); 95 95 96 96 std::vector<Edge> edges; … … 106 106 107 107 template <typename _Base> 108 class ExtendableU ndirBipartiteGraphExtender : public _Base {108 class ExtendableUBipartiteGraphExtender : public _Base { 109 109 public: 110 110 111 111 typedef _Base Parent; 112 typedef ExtendableU ndirBipartiteGraphExtender Graph;112 typedef ExtendableUBipartiteGraphExtender Graph; 113 113 114 114 typedef typename Parent::Node Node; … … 116 116 typedef typename Parent::UpperNode UpperNode; 117 117 typedef typename Parent::Edge Edge; 118 typedef typename Parent::U ndirEdge UndirEdge;118 typedef typename Parent::UEdge UEdge; 119 119 120 120 Node addUpperNode() { … … 132 132 } 133 133 134 U ndirEdge addEdge(const Node& source, const Node& target) {135 U ndirEdge undiredge = Parent::addEdge(source, target);136 Parent::getNotifier(U ndirEdge()).add(undiredge);134 UEdge addEdge(const Node& source, const Node& target) { 135 UEdge uedge = Parent::addEdge(source, target); 136 Parent::getNotifier(UEdge()).add(uedge); 137 137 138 138 std::vector<Edge> edges; 139 edges.push_back(Parent::direct(u ndiredge, true));140 edges.push_back(Parent::direct(u ndiredge, false));139 edges.push_back(Parent::direct(uedge, true)); 140 edges.push_back(Parent::direct(uedge, false)); 141 141 Parent::getNotifier(Edge()).add(edges); 142 142 143 return u ndiredge;143 return uedge; 144 144 } 145 145 -
lemon/bits/graph_extender.h
r1875 r1909 62 62 63 63 template <typename _Base> 64 class U ndirGraphExtender : public _Base {64 class UGraphExtender : public _Base { 65 65 typedef _Base Parent; 66 typedef U ndirGraphExtender Graph;66 typedef UGraphExtender Graph; 67 67 68 68 public: 69 69 70 typedef typename Parent::Edge U ndirEdge;70 typedef typename Parent::Edge UEdge; 71 71 typedef typename Parent::Node Node; 72 72 73 class Edge : public U ndirEdge {74 friend class U ndirGraphExtender;73 class Edge : public UEdge { 74 friend class UGraphExtender; 75 75 76 76 protected: … … 79 79 bool forward; 80 80 81 Edge(const U ndirEdge &ue, bool _forward) :82 U ndirEdge(ue), forward(_forward) {}81 Edge(const UEdge &ue, bool _forward) : 82 UEdge(ue), forward(_forward) {} 83 83 84 84 public: … … 86 86 87 87 /// Invalid edge constructor 88 Edge(Invalid i) : U ndirEdge(i), forward(true) {}88 Edge(Invalid i) : UEdge(i), forward(true) {} 89 89 90 90 bool operator==(const Edge &that) const { 91 return forward==that.forward && U ndirEdge(*this)==UndirEdge(that);91 return forward==that.forward && UEdge(*this)==UEdge(that); 92 92 } 93 93 bool operator!=(const Edge &that) const { 94 return forward!=that.forward || U ndirEdge(*this)!=UndirEdge(that);94 return forward!=that.forward || UEdge(*this)!=UEdge(that); 95 95 } 96 96 bool operator<(const Edge &that) const { 97 97 return forward<that.forward || 98 (!(that.forward<forward) && U ndirEdge(*this)<UndirEdge(that));98 (!(that.forward<forward) && UEdge(*this)<UEdge(that)); 99 99 } 100 100 }; … … 127 127 } 128 128 129 Node oppositeNode(const Node &n, const U ndirEdge &e) const {129 Node oppositeNode(const Node &n, const UEdge &e) const { 130 130 if( n == Parent::source(e)) 131 131 return Parent::target(e); … … 138 138 /// \brief Directed edge from an undirected edge and a source node. 139 139 /// 140 /// Returns a (directed) Edge corresponding to the specified U ndirEdge140 /// Returns a (directed) Edge corresponding to the specified UEdge 141 141 /// and source Node. 142 142 /// 143 Edge direct(const U ndirEdge &ue, const Node &s) const {143 Edge direct(const UEdge &ue, const Node &s) const { 144 144 return Edge(ue, s == source(ue)); 145 145 } … … 147 147 /// \brief Directed edge from an undirected edge. 148 148 /// 149 /// Returns a directed edge corresponding to the specified U ndirEdge.149 /// Returns a directed edge corresponding to the specified UEdge. 150 150 /// If the given bool is true the given undirected edge and the 151 151 /// returned edge have the same source node. 152 Edge direct(const U ndirEdge &ue, bool d) const {152 Edge direct(const UEdge &ue, bool d) const { 153 153 return Edge(ue, d); 154 154 } … … 183 183 void firstOut(Edge &e, const Node &n) const { 184 184 Parent::firstIn(e,n); 185 if( U ndirEdge(e) != INVALID ) {185 if( UEdge(e) != INVALID ) { 186 186 e.forward = false; 187 187 } … … 195 195 Node n = Parent::target(e); 196 196 Parent::nextIn(e); 197 if( U ndirEdge(e) == INVALID ) {197 if( UEdge(e) == INVALID ) { 198 198 Parent::firstOut(e, n); 199 199 e.forward = true; … … 207 207 void firstIn(Edge &e, const Node &n) const { 208 208 Parent::firstOut(e,n); 209 if( U ndirEdge(e) != INVALID ) {209 if( UEdge(e) != INVALID ) { 210 210 e.forward = false; 211 211 } … … 219 219 Node n = Parent::source(e); 220 220 Parent::nextOut(e); 221 if( U ndirEdge(e) == INVALID ) {221 if( UEdge(e) == INVALID ) { 222 222 Parent::firstIn(e, n); 223 223 e.forward = true; … … 229 229 } 230 230 231 void firstInc(U ndirEdge &e, const Node &n) const {231 void firstInc(UEdge &e, const Node &n) const { 232 232 Parent::firstOut(e, n); 233 233 if (e != INVALID) return; 234 234 Parent::firstIn(e, n); 235 235 } 236 void nextInc(U ndirEdge &e, const Node &n) const {236 void nextInc(UEdge &e, const Node &n) const { 237 237 if (Parent::source(e) == n) { 238 238 Parent::nextOut(e); … … 244 244 } 245 245 246 void firstInc(U ndirEdge &e, bool &d, const Node &n) const {246 void firstInc(UEdge &e, bool &d, const Node &n) const { 247 247 d = true; 248 248 Parent::firstOut(e, n); … … 251 251 Parent::firstIn(e, n); 252 252 } 253 void nextInc(U ndirEdge &e, bool &d) const {253 void nextInc(UEdge &e, bool &d) const { 254 254 if (d) { 255 255 Node s = Parent::source(e); … … 276 276 } 277 277 278 int id(const U ndirEdge &e) const {278 int id(const UEdge &e) const { 279 279 return Parent::id(e); 280 280 } … … 292 292 } 293 293 294 int maxU ndirEdgeId() const {294 int maxUEdgeId() const { 295 295 return Parent::maxEdgeId(); 296 296 } … … 303 303 return maxEdgeId(); 304 304 } 305 int maxId(U ndirEdge) const {306 return maxU ndirEdgeId();305 int maxId(UEdge) const { 306 return maxUEdgeId(); 307 307 } 308 308 … … 311 311 } 312 312 313 int u ndirEdgeNum() const {313 int uEdgeNum() const { 314 314 return Parent::edgeNum(); 315 315 } … … 323 323 } 324 324 325 U ndirEdge undirEdgeFromId(int id) const {325 UEdge uEdgeFromId(int id) const { 326 326 return Parent::edgeFromId(id >> 1); 327 327 } … … 335 335 } 336 336 337 U ndirEdge fromId(int id, UndirEdge) const {338 return u ndirEdgeFromId(id);337 UEdge fromId(int id, UEdge) const { 338 return uEdgeFromId(id); 339 339 } 340 340 … … 342 342 Edge findEdge(Node source, Node target, Edge prev) const { 343 343 if (prev == INVALID) { 344 U ndirEdge edge = Parent::findEdge(source, target);344 UEdge edge = Parent::findEdge(source, target); 345 345 if (edge != INVALID) return direct(edge, true); 346 346 edge = Parent::findEdge(target, source); 347 347 if (edge != INVALID) return direct(edge, false); 348 348 } else if (direction(prev)) { 349 U ndirEdge edge = Parent::findEdge(source, target, prev);349 UEdge edge = Parent::findEdge(source, target, prev); 350 350 if (edge != INVALID) return direct(edge, true); 351 351 edge = Parent::findEdge(target, source); 352 352 if (edge != INVALID) return direct(edge, false); 353 353 } else { 354 U ndirEdge edge = Parent::findEdge(target, source, prev);354 UEdge edge = Parent::findEdge(target, source, prev); 355 355 if (edge != INVALID) return direct(edge, false); 356 356 } … … 358 358 } 359 359 360 U ndirEdge findUndirEdge(Node source, Node target, UndirEdge prev) const {360 UEdge findUEdge(Node source, Node target, UEdge prev) const { 361 361 if (prev == INVALID) { 362 U ndirEdge edge = Parent::findEdge(source, target);362 UEdge edge = Parent::findEdge(source, target); 363 363 if (edge != INVALID) return edge; 364 364 edge = Parent::findEdge(target, source); 365 365 if (edge != INVALID) return edge; 366 366 } else if (Parent::source(prev) == source) { 367 U ndirEdge edge = Parent::findEdge(source, target, prev);367 UEdge edge = Parent::findEdge(source, target, prev); 368 368 if (edge != INVALID) return edge; 369 369 edge = Parent::findEdge(target, source); 370 370 if (edge != INVALID) return edge; 371 371 } else { 372 U ndirEdge edge = Parent::findEdge(target, source, prev);372 UEdge edge = Parent::findEdge(target, source, prev); 373 373 if (edge != INVALID) return edge; 374 374 } … … 380 380 381 381 template <typename _Base> 382 class U ndirBipartiteGraphExtender : public _Base {382 class UBipartiteGraphExtender : public _Base { 383 383 public: 384 384 typedef _Base Parent; 385 typedef U ndirBipartiteGraphExtender Graph;385 typedef UBipartiteGraphExtender Graph; 386 386 387 387 typedef typename Parent::Node Node; 388 typedef typename Parent::Edge U ndirEdge;388 typedef typename Parent::Edge UEdge; 389 389 390 390 using Parent::first; … … 393 393 using Parent::id; 394 394 395 Node source(const U ndirEdge& edge) const {395 Node source(const UEdge& edge) const { 396 396 return upperNode(edge); 397 397 } 398 Node target(const U ndirEdge& edge) const {398 Node target(const UEdge& edge) const { 399 399 return lowerNode(edge); 400 400 } 401 401 402 void firstInc(U ndirEdge& edge, bool& direction, const Node& node) const {402 void firstInc(UEdge& edge, bool& direction, const Node& node) const { 403 403 if (Parent::upper(node)) { 404 404 Parent::firstDown(edge, node); … … 406 406 } else { 407 407 Parent::firstUp(edge, node); 408 direction = static_cast<U ndirEdge&>(edge) == INVALID;409 } 410 } 411 void nextInc(U ndirEdge& edge, bool& direction) const {408 direction = static_cast<UEdge&>(edge) == INVALID; 409 } 410 } 411 void nextInc(UEdge& edge, bool& direction) const { 412 412 if (direction) { 413 413 Parent::nextDown(edge); … … 418 418 } 419 419 420 int maxU ndirEdgeId() const {420 int maxUEdgeId() const { 421 421 return Parent::maxEdgeId(); 422 422 } 423 423 424 U ndirEdge undirEdgeFromId(int id) const {424 UEdge uEdgeFromId(int id) const { 425 425 return Parent::edgeFromId(id); 426 426 } 427 427 428 class Edge : public U ndirEdge {429 friend class U ndirBipartiteGraphExtender;428 class Edge : public UEdge { 429 friend class UBipartiteGraphExtender; 430 430 protected: 431 431 bool forward; 432 432 433 Edge(const U ndirEdge& edge, bool _forward)434 : U ndirEdge(edge), forward(_forward) {}433 Edge(const UEdge& edge, bool _forward) 434 : UEdge(edge), forward(_forward) {} 435 435 436 436 public: 437 437 Edge() {} 438 Edge (Invalid) : U ndirEdge(INVALID), forward(true) {}438 Edge (Invalid) : UEdge(INVALID), forward(true) {} 439 439 bool operator==(const Edge& i) const { 440 return U ndirEdge::operator==(i) && forward == i.forward;440 return UEdge::operator==(i) && forward == i.forward; 441 441 } 442 442 bool operator!=(const Edge& i) const { 443 return U ndirEdge::operator!=(i) || forward != i.forward;443 return UEdge::operator!=(i) || forward != i.forward; 444 444 } 445 445 bool operator<(const Edge& i) const { 446 return U ndirEdge::operator<(i) ||447 (!(i.forward<forward) && U ndirEdge(*this)<UndirEdge(i));446 return UEdge::operator<(i) || 447 (!(i.forward<forward) && UEdge(*this)<UEdge(i)); 448 448 } 449 449 }; 450 450 451 451 void first(Edge& edge) const { 452 Parent::first(static_cast<U ndirEdge&>(edge));452 Parent::first(static_cast<UEdge&>(edge)); 453 453 edge.forward = true; 454 454 } … … 456 456 void next(Edge& edge) const { 457 457 if (!edge.forward) { 458 Parent::next(static_cast<U ndirEdge&>(edge));458 Parent::next(static_cast<UEdge&>(edge)); 459 459 } 460 460 edge.forward = !edge.forward; … … 467 467 } else { 468 468 Parent::firstUp(edge, node); 469 edge.forward = static_cast<U ndirEdge&>(edge) == INVALID;469 edge.forward = static_cast<UEdge&>(edge) == INVALID; 470 470 } 471 471 } … … 475 475 } else { 476 476 Parent::nextUp(edge); 477 edge.forward = static_cast<U ndirEdge&>(edge) == INVALID;477 edge.forward = static_cast<UEdge&>(edge) == INVALID; 478 478 } 479 479 } … … 485 485 } else { 486 486 Parent::firstDown(edge, node); 487 edge.forward = static_cast<U ndirEdge&>(edge) == INVALID;487 edge.forward = static_cast<UEdge&>(edge) == INVALID; 488 488 } 489 489 } … … 493 493 } else { 494 494 Parent::nextDown(edge); 495 edge.forward = static_cast<U ndirEdge&>(edge) == INVALID;495 edge.forward = static_cast<UEdge&>(edge) == INVALID; 496 496 } 497 497 } … … 508 508 } 509 509 510 Edge direct(const U ndirEdge& edge, const Node& node) const {510 Edge direct(const UEdge& edge, const Node& node) const { 511 511 return Edge(edge, node == Parent::source(edge)); 512 512 } 513 513 514 Edge direct(const U ndirEdge& edge, bool direction) const {514 Edge direct(const UEdge& edge, bool direction) const { 515 515 return Edge(edge, direction); 516 516 } 517 517 518 Node oppositeNode(const U ndirEdge& edge, const Node& node) const {518 Node oppositeNode(const UEdge& edge, const Node& node) const { 519 519 return source(edge) == node ? 520 520 target(edge) : source(edge); … … 529 529 } 530 530 Edge edgeFromId(int id) const { 531 return Edge(Parent::fromId(id >> 1, U ndirEdge()), (id & 1) == 0);531 return Edge(Parent::fromId(id >> 1, UEdge()), (id & 1) == 0); 532 532 } 533 533 int maxEdgeId() const { 534 return (Parent::maxId(U ndirEdge()) << 1) + 1;534 return (Parent::maxId(UEdge()) << 1) + 1; 535 535 } 536 536 537 537 class UpperNode : public Node { 538 friend class U ndirBipartiteGraphExtender;538 friend class UBipartiteGraphExtender; 539 539 public: 540 540 UpperNode() {} … … 558 558 559 559 class LowerNode : public Node { 560 friend class U ndirBipartiteGraphExtender;560 friend class UBipartiteGraphExtender; 561 561 public: 562 562 LowerNode() {} … … 593 593 return maxEdgeId(); 594 594 } 595 int maxId(U ndirEdge) const {596 return maxU ndirEdgeId();595 int maxId(UEdge) const { 596 return maxUEdgeId(); 597 597 } 598 598 … … 610 610 return edgeFromId(id); 611 611 } 612 U ndirEdge fromId(int id, UndirEdge) const {613 return u ndirEdgeFromId(id);612 UEdge fromId(int id, UEdge) const { 613 return uEdgeFromId(id); 614 614 } 615 615 -
lemon/bits/iterable_graph_extender.h
r1820 r1909 17 17 /// 18 18 ///\bug Should it be here? 19 typedef False U ndirTag;19 typedef False UTag; 20 20 21 21 typedef _Base Parent; … … 175 175 176 176 template <typename _Base> 177 class IterableU ndirGraphExtender : public IterableGraphExtender<_Base> {177 class IterableUGraphExtender : public IterableGraphExtender<_Base> { 178 178 public: 179 179 … … 185 185 ///\bug Should be tested in the concept checker whether it is defined 186 186 ///correctly. 187 typedef True U ndirTag;187 typedef True UTag; 188 188 189 189 typedef IterableGraphExtender<_Base> Parent; 190 typedef IterableU ndirGraphExtender<_Base> Graph;190 typedef IterableUGraphExtender<_Base> Graph; 191 191 typedef typename Parent::Node Node; 192 192 typedef typename Parent::Edge Edge; 193 typedef typename Parent::U ndirEdge UndirEdge;194 195 class U ndirEdgeIt : public Parent::UndirEdge {196 const Graph* graph; 197 public: 198 199 U ndirEdgeIt() { }200 201 U ndirEdgeIt(Invalid i) : UndirEdge(i) { }202 203 explicit U ndirEdgeIt(const Graph& _graph) : graph(&_graph) {204 _graph.first(*static_cast<U ndirEdge*>(this));205 } 206 207 U ndirEdgeIt(const Graph& _graph, const UndirEdge& e) :208 U ndirEdge(e), graph(&_graph) { }209 210 U ndirEdgeIt& operator++() {193 typedef typename Parent::UEdge UEdge; 194 195 class UEdgeIt : public Parent::UEdge { 196 const Graph* graph; 197 public: 198 199 UEdgeIt() { } 200 201 UEdgeIt(Invalid i) : UEdge(i) { } 202 203 explicit UEdgeIt(const Graph& _graph) : graph(&_graph) { 204 _graph.first(*static_cast<UEdge*>(this)); 205 } 206 207 UEdgeIt(const Graph& _graph, const UEdge& e) : 208 UEdge(e), graph(&_graph) { } 209 210 UEdgeIt& operator++() { 211 211 graph->next(*this); 212 212 return *this; … … 215 215 }; 216 216 217 class IncEdgeIt : public Parent::U ndirEdge {217 class IncEdgeIt : public Parent::UEdge { 218 218 const Graph* graph; 219 219 bool direction; 220 friend class IterableU ndirGraphExtender;220 friend class IterableUGraphExtender; 221 221 public: 222 222 223 223 IncEdgeIt() { } 224 224 225 IncEdgeIt(Invalid i) : U ndirEdge(i), direction(false) { }225 IncEdgeIt(Invalid i) : UEdge(i), direction(false) { } 226 226 227 227 IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) { … … 229 229 } 230 230 231 IncEdgeIt(const Graph& _graph, const U ndirEdge &ue, const Node &n)232 : graph(&_graph), U ndirEdge(ue) {231 IncEdgeIt(const Graph& _graph, const UEdge &ue, const Node &n) 232 : graph(&_graph), UEdge(ue) { 233 233 direction = (_graph.source(ue) == n); 234 234 } … … 259 259 /// 260 260 /// Gives back the opposite on the given undirected edge. 261 Node oppositeNode(const Node& n, const U ndirEdge& e) const {261 Node oppositeNode(const Node& n, const UEdge& e) const { 262 262 if (Parent::source(e) == n) { 263 263 return Parent::target(e); … … 271 271 272 272 template <typename _Base> 273 class IterableU ndirBipartiteGraphExtender : public _Base {273 class IterableUBipartiteGraphExtender : public _Base { 274 274 public: 275 275 typedef _Base Parent; 276 typedef IterableU ndirBipartiteGraphExtender Graph;276 typedef IterableUBipartiteGraphExtender Graph; 277 277 278 278 typedef typename Parent::Node Node; … … 280 280 typedef typename Parent::LowerNode LowerNode; 281 281 typedef typename Parent::Edge Edge; 282 typedef typename Parent::U ndirEdge UndirEdge;282 typedef typename Parent::UEdge UEdge; 283 283 284 284 class NodeIt : public Node { … … 305 305 306 306 class UpperNodeIt : public Node { 307 friend class IterableU ndirBipartiteGraphExtender;307 friend class IterableUBipartiteGraphExtender; 308 308 const Graph* graph; 309 309 public: … … 327 327 328 328 class LowerNodeIt : public Node { 329 friend class IterableU ndirBipartiteGraphExtender;329 friend class IterableUBipartiteGraphExtender; 330 330 const Graph* graph; 331 331 public: … … 349 349 350 350 class EdgeIt : public Edge { 351 friend class IterableU ndirBipartiteGraphExtender;351 friend class IterableUBipartiteGraphExtender; 352 352 const Graph* graph; 353 353 public: … … 371 371 }; 372 372 373 class U ndirEdgeIt : public UndirEdge {374 friend class IterableU ndirBipartiteGraphExtender;375 const Graph* graph; 376 public: 377 378 U ndirEdgeIt() { }379 380 U ndirEdgeIt(Invalid i) : UndirEdge(INVALID) { }381 382 explicit U ndirEdgeIt(const Graph& _graph) : graph(&_graph) {383 graph->first(static_cast<U ndirEdge&>(*this));384 } 385 386 U ndirEdgeIt(const Graph& _graph, const UndirEdge& edge)387 : U ndirEdge(edge), graph(&_graph) { }388 389 U ndirEdgeIt& operator++() {373 class UEdgeIt : public UEdge { 374 friend class IterableUBipartiteGraphExtender; 375 const Graph* graph; 376 public: 377 378 UEdgeIt() { } 379 380 UEdgeIt(Invalid i) : UEdge(INVALID) { } 381 382 explicit UEdgeIt(const Graph& _graph) : graph(&_graph) { 383 graph->first(static_cast<UEdge&>(*this)); 384 } 385 386 UEdgeIt(const Graph& _graph, const UEdge& edge) 387 : UEdge(edge), graph(&_graph) { } 388 389 UEdgeIt& operator++() { 390 390 graph->next(*this); 391 391 return *this; … … 394 394 395 395 class OutEdgeIt : public Edge { 396 friend class IterableU ndirBipartiteGraphExtender;396 friend class IterableUBipartiteGraphExtender; 397 397 const Graph* graph; 398 398 public: … … 419 419 420 420 class InEdgeIt : public Edge { 421 friend class IterableU ndirBipartiteGraphExtender;421 friend class IterableUBipartiteGraphExtender; 422 422 const Graph* graph; 423 423 public: … … 470 470 } 471 471 472 class IncEdgeIt : public Parent::U ndirEdge {473 friend class IterableU ndirBipartiteGraphExtender;472 class IncEdgeIt : public Parent::UEdge { 473 friend class IterableUBipartiteGraphExtender; 474 474 const Graph* graph; 475 475 bool direction; … … 478 478 IncEdgeIt() { } 479 479 480 IncEdgeIt(Invalid i) : U ndirEdge(i), direction(true) { }480 IncEdgeIt(Invalid i) : UEdge(i), direction(true) { } 481 481 482 482 IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) { … … 484 484 } 485 485 486 IncEdgeIt(const Graph& _graph, const U ndirEdge &ue, const Node &n)487 : graph(&_graph), U ndirEdge(ue) {486 IncEdgeIt(const Graph& _graph, const UEdge &ue, const Node &n) 487 : graph(&_graph), UEdge(ue) { 488 488 direction = (graph->source(ue) == n); 489 489 } -
lemon/bits/static_map.h
r1875 r1909 306 306 /// \e 307 307 template <typename _Base> 308 class StaticMappableU ndirGraphExtender :308 class StaticMappableUGraphExtender : 309 309 public StaticMappableGraphExtender<_Base> { 310 310 public: 311 311 312 typedef StaticMappableU ndirGraphExtender Graph;312 typedef StaticMappableUGraphExtender Graph; 313 313 typedef StaticMappableGraphExtender<_Base> Parent; 314 314 315 typedef typename Parent::U ndirEdge UndirEdge;316 317 template <typename _Value> 318 class U ndirEdgeMap319 : public IterableMapExtender<StaticMap<Graph, U ndirEdge, _Value> > {320 public: 321 typedef StaticMappableU ndirGraphExtender Graph;315 typedef typename Parent::UEdge UEdge; 316 317 template <typename _Value> 318 class UEdgeMap 319 : public IterableMapExtender<StaticMap<Graph, UEdge, _Value> > { 320 public: 321 typedef StaticMappableUGraphExtender Graph; 322 322 typedef IterableMapExtender< 323 StaticMap<Graph, U ndirEdge, _Value> > Parent;324 325 U ndirEdgeMap(const Graph& _g)326 : Parent(_g) {} 327 U ndirEdgeMap(const Graph& _g, const _Value& _v)328 : Parent(_g, _v) {} 329 330 U ndirEdgeMap& operator=(const UndirEdgeMap& cmap) {331 return operator=<U ndirEdgeMap>(cmap);332 } 333 334 template <typename CMap> 335 U ndirEdgeMap& operator=(const CMap& cmap) {336 checkConcept<concept::ReadMap<U ndirEdge, _Value>, CMap>();337 const typename Parent::Graph* graph = Parent::getGraph(); 338 U ndirEdge it;323 StaticMap<Graph, UEdge, _Value> > Parent; 324 325 UEdgeMap(const Graph& _g) 326 : Parent(_g) {} 327 UEdgeMap(const Graph& _g, const _Value& _v) 328 : Parent(_g, _v) {} 329 330 UEdgeMap& operator=(const UEdgeMap& cmap) { 331 return operator=<UEdgeMap>(cmap); 332 } 333 334 template <typename CMap> 335 UEdgeMap& operator=(const CMap& cmap) { 336 checkConcept<concept::ReadMap<UEdge, _Value>, CMap>(); 337 const typename Parent::Graph* graph = Parent::getGraph(); 338 UEdge it; 339 339 for (graph->first(it); it != INVALID; graph->next(it)) { 340 340 Parent::set(it, cmap[it]); … … 347 347 348 348 template <typename _Base> 349 class StaticMappableU ndirBipartiteGraphExtender : public _Base {349 class StaticMappableUBipartiteGraphExtender : public _Base { 350 350 public: 351 351 352 352 typedef _Base Parent; 353 typedef StaticMappableU ndirBipartiteGraphExtender Graph;353 typedef StaticMappableUBipartiteGraphExtender Graph; 354 354 355 355 typedef typename Parent::Node Node; … … 357 357 typedef typename Parent::LowerNode LowerNode; 358 358 typedef typename Parent::Edge Edge; 359 typedef typename Parent::U ndirEdge UndirEdge;359 typedef typename Parent::UEdge UEdge; 360 360 361 361 template <typename _Value> … … 363 363 : public IterableMapExtender<StaticMap<Graph, UpperNode, _Value> > { 364 364 public: 365 typedef StaticMappableU ndirBipartiteGraphExtender Graph;365 typedef StaticMappableUBipartiteGraphExtender Graph; 366 366 typedef IterableMapExtender<StaticMap<Graph, UpperNode, _Value> > 367 367 Parent; … … 400 400 : public IterableMapExtender<StaticMap<Graph, LowerNode, _Value> > { 401 401 public: 402 typedef StaticMappableU ndirBipartiteGraphExtender Graph;402 typedef StaticMappableUBipartiteGraphExtender Graph; 403 403 typedef IterableMapExtender<StaticMap<Graph, LowerNode, _Value> > 404 404 Parent; … … 438 438 class NodeMapBase : public Parent::NodeNotifier::ObserverBase { 439 439 public: 440 typedef StaticMappableU ndirBipartiteGraphExtender Graph;440 typedef StaticMappableUBipartiteGraphExtender Graph; 441 441 442 442 typedef Node Key; … … 518 518 : public IterableMapExtender<NodeMapBase<_Value> > { 519 519 public: 520 typedef StaticMappableU ndirBipartiteGraphExtender Graph;520 typedef StaticMappableUBipartiteGraphExtender Graph; 521 521 typedef IterableMapExtender< NodeMapBase<_Value> > Parent; 522 522 … … 556 556 : public IterableMapExtender<StaticMap<Graph, Edge, _Value> > { 557 557 public: 558 typedef StaticMappableU ndirBipartiteGraphExtender Graph;558 typedef StaticMappableUBipartiteGraphExtender Graph; 559 559 typedef IterableMapExtender<StaticMap<Graph, Edge, _Value> > Parent; 560 560 … … 581 581 582 582 template <typename _Value> 583 class U ndirEdgeMap584 : public IterableMapExtender<StaticMap<Graph, U ndirEdge, _Value> > {585 public: 586 typedef StaticMappableU ndirBipartiteGraphExtender Graph;587 typedef IterableMapExtender<StaticMap<Graph, U ndirEdge, _Value> >583 class UEdgeMap 584 : public IterableMapExtender<StaticMap<Graph, UEdge, _Value> > { 585 public: 586 typedef StaticMappableUBipartiteGraphExtender Graph; 587 typedef IterableMapExtender<StaticMap<Graph, UEdge, _Value> > 588 588 Parent; 589 589 590 U ndirEdgeMap(const Graph& _g)591 : Parent(_g) {} 592 U ndirEdgeMap(const Graph& _g, const _Value& _v)593 : Parent(_g, _v) {} 594 595 U ndirEdgeMap& operator=(const UndirEdgeMap& cmap) {596 return operator=<U ndirEdgeMap>(cmap);597 } 598 599 template <typename CMap> 600 U ndirEdgeMap& operator=(const CMap& cmap) {601 checkConcept<concept::ReadMap<U ndirEdge, _Value>, CMap>();602 const typename Parent::Graph* graph = Parent::getGraph(); 603 U ndirEdge it;590 UEdgeMap(const Graph& _g) 591 : Parent(_g) {} 592 UEdgeMap(const Graph& _g, const _Value& _v) 593 : Parent(_g, _v) {} 594 595 UEdgeMap& operator=(const UEdgeMap& cmap) { 596 return operator=<UEdgeMap>(cmap); 597 } 598 599 template <typename CMap> 600 UEdgeMap& operator=(const CMap& cmap) { 601 checkConcept<concept::ReadMap<UEdge, _Value>, CMap>(); 602 const typename Parent::Graph* graph = Parent::getGraph(); 603 UEdge it; 604 604 for (graph->first(it); it != INVALID; graph->next(it)) { 605 605 Parent::set(it, cmap[it]); -
lemon/concept/graph.h
r1875 r1909 43 43 public: 44 44 45 typedef False U ndirTag;45 typedef False UTag; 46 46 47 47 typedef BaseGraphComponent::Node Node; … … 124 124 ///\todo undocumented 125 125 /// 126 typedef False U ndirTag;126 typedef False UTag; 127 127 128 128 /// Defalult constructor. -
lemon/concept/graph_component.h
r1875 r1909 35 35 /// Skeleton class for graph Node and Edge types 36 36 37 /// This class describes the interface of Node and Edge (and U ndirEdge37 /// This class describes the interface of Node and Edge (and UEdge 38 38 /// in undirected graphs) subtypes of graph types. 39 39 /// -
lemon/concept/ugraph.h
r1875 r1909 1 1 /* -*- C++ -*- 2 2 * 3 * lemon/concept/u ndir_graph_component.h - Part of LEMON, a generic3 * lemon/concept/ugraph_component.h - Part of LEMON, a generic 4 4 * C++ optimization library 5 5 * … … 34 34 35 35 // /// Skeleton class which describes an edge with direction in \ref 36 // /// U ndirGraph "undirected graph".37 template <typename U ndirGraph>38 class U ndirGraphEdge : public UndirGraph::UndirEdge {39 typedef typename U ndirGraph::UndirEdge UndirEdge;40 typedef typename U ndirGraph::Node Node;36 // /// UGraph "undirected graph". 37 template <typename UGraph> 38 class UGraphEdge : public UGraph::UEdge { 39 typedef typename UGraph::UEdge UEdge; 40 typedef typename UGraph::Node Node; 41 41 public: 42 42 43 43 /// \e 44 U ndirGraphEdge() {}44 UGraphEdge() {} 45 45 46 46 /// \e 47 U ndirGraphEdge(const UndirGraphEdge& e) : UndirGraph::UndirEdge(e) {}47 UGraphEdge(const UGraphEdge& e) : UGraph::UEdge(e) {} 48 48 49 49 /// \e 50 U ndirGraphEdge(Invalid) {}50 UGraphEdge(Invalid) {} 51 51 52 52 /// \brief Directed edge from undirected edge and a source node. … … 55 55 /// 56 56 /// \note You have to specify the graph for this constructor. 57 U ndirGraphEdge(const UndirGraph &g,58 U ndirEdge undir_edge, Node n) {59 ignore_unused_variable_warning(u ndir_edge);57 UGraphEdge(const UGraph &g, 58 UEdge u_edge, Node n) { 59 ignore_unused_variable_warning(u_edge); 60 60 ignore_unused_variable_warning(g); 61 61 ignore_unused_variable_warning(n); … … 63 63 64 64 /// \e 65 U ndirGraphEdge& operator=(UndirGraphEdge) { return *this; }65 UGraphEdge& operator=(UGraphEdge) { return *this; } 66 66 67 67 /// \e 68 bool operator==(U ndirGraphEdge) const { return true; }68 bool operator==(UGraphEdge) const { return true; } 69 69 /// \e 70 bool operator!=(U ndirGraphEdge) const { return false; }70 bool operator!=(UGraphEdge) const { return false; } 71 71 72 72 /// \e 73 bool operator<(U ndirGraphEdge) const { return false; }73 bool operator<(UGraphEdge) const { return false; } 74 74 75 75 template <typename Edge> … … 80 80 void const_constraints() const { 81 81 /// \bug This should be is_base_and_derived ... 82 U ndirEdge ue = e;82 UEdge ue = e; 83 83 ue = e; 84 84 … … 87 87 } 88 88 Edge e; 89 U ndirEdge ue;90 U ndirGraph graph;89 UEdge ue; 90 UGraph graph; 91 91 Node n; 92 92 }; … … 94 94 95 95 96 struct BaseIterableU ndirGraphConcept {96 struct BaseIterableUGraphConcept { 97 97 98 98 template <typename Graph> 99 99 struct Constraints { 100 100 101 typedef typename Graph::U ndirEdge UndirEdge;101 typedef typename Graph::UEdge UEdge; 102 102 typedef typename Graph::Edge Edge; 103 103 typedef typename Graph::Node Node; … … 105 105 void constraints() { 106 106 checkConcept<BaseIterableGraphComponent, Graph>(); 107 checkConcept<GraphItem<>, U ndirEdge>();108 //checkConcept<U ndirGraphEdge<Graph>, Edge>();107 checkConcept<GraphItem<>, UEdge>(); 108 //checkConcept<UGraphEdge<Graph>, Edge>(); 109 109 110 110 graph.first(ue); … … 121 121 bool b; 122 122 b = graph.direction(e); 123 Edge e = graph.direct(U ndirEdge(), true);124 e = graph.direct(U ndirEdge(), n);123 Edge e = graph.direct(UEdge(), true); 124 e = graph.direct(UEdge(), n); 125 125 126 126 ignore_unused_variable_warning(b); … … 130 130 Edge e; 131 131 Node n0; 132 U ndirEdge ue;132 UEdge ue; 133 133 }; 134 134 … … 136 136 137 137 138 struct IterableU ndirGraphConcept {138 struct IterableUGraphConcept { 139 139 140 140 template <typename Graph> … … 143 143 /// \todo we don't need the iterable component to be base iterable 144 144 /// Don't we really??? 145 //checkConcept< BaseIterableU ndirGraphConcept, Graph > ();145 //checkConcept< BaseIterableUGraphConcept, Graph > (); 146 146 147 147 checkConcept<IterableGraphComponent, Graph> (); 148 148 149 typedef typename Graph::U ndirEdge UndirEdge;150 typedef typename Graph::U ndirEdgeIt UndirEdgeIt;149 typedef typename Graph::UEdge UEdge; 150 typedef typename Graph::UEdgeIt UEdgeIt; 151 151 typedef typename Graph::IncEdgeIt IncEdgeIt; 152 152 153 checkConcept<GraphIterator<Graph, U ndirEdge>, UndirEdgeIt>();154 checkConcept<GraphIncIterator<Graph, U ndirEdge>, IncEdgeIt>();153 checkConcept<GraphIterator<Graph, UEdge>, UEdgeIt>(); 154 checkConcept<GraphIncIterator<Graph, UEdge>, IncEdgeIt>(); 155 155 } 156 156 }; … … 158 158 }; 159 159 160 struct MappableU ndirGraphConcept {160 struct MappableUGraphConcept { 161 161 162 162 template <typename Graph> … … 172 172 checkConcept<MappableGraphComponent, Graph>(); 173 173 174 typedef typename Graph::template U ndirEdgeMap<int> IntMap;175 checkConcept<GraphMap<Graph, typename Graph::U ndirEdge, int>,174 typedef typename Graph::template UEdgeMap<int> IntMap; 175 checkConcept<GraphMap<Graph, typename Graph::UEdge, int>, 176 176 IntMap >(); 177 177 178 typedef typename Graph::template U ndirEdgeMap<bool> BoolMap;179 checkConcept<GraphMap<Graph, typename Graph::U ndirEdge, bool>,178 typedef typename Graph::template UEdgeMap<bool> BoolMap; 179 checkConcept<GraphMap<Graph, typename Graph::UEdge, bool>, 180 180 BoolMap >(); 181 181 182 typedef typename Graph::template U ndirEdgeMap<Dummy> DummyMap;183 checkConcept<GraphMap<Graph, typename Graph::U ndirEdge, Dummy>,182 typedef typename Graph::template UEdgeMap<Dummy> DummyMap; 183 checkConcept<GraphMap<Graph, typename Graph::UEdge, Dummy>, 184 184 DummyMap >(); 185 185 } … … 188 188 }; 189 189 190 struct ExtendableU ndirGraphConcept {190 struct ExtendableUGraphConcept { 191 191 192 192 template <typename Graph> … … 197 197 } 198 198 typename Graph::Node node_a, node_b; 199 typename Graph::U ndirEdge uedge;199 typename Graph::UEdge uedge; 200 200 Graph graph; 201 201 }; … … 203 203 }; 204 204 205 struct ErasableU ndirGraphConcept {205 struct ErasableUGraphConcept { 206 206 207 207 template <typename Graph> … … 213 213 Graph graph; 214 214 typename Graph::Node n; 215 typename Graph::U ndirEdge e;215 typename Graph::UEdge e; 216 216 }; 217 217 … … 234 234 /// In LEMON undirected graphs also fulfill the concept of directed 235 235 /// graphs (\ref lemon::concept::StaticGraph "Graph Concept"). For 236 /// explanation of this and more see also the page \ref u ndir_graphs,236 /// explanation of this and more see also the page \ref ugraphs, 237 237 /// a tutorial about undirected graphs. 238 238 /// … … 241 241 /// to the StaticGraph concept. 242 242 243 class U ndirGraph {243 class UGraph { 244 244 public: 245 245 ///\e … … 247 247 ///\todo undocumented 248 248 /// 249 typedef True U ndirTag;249 typedef True UTag; 250 250 251 251 /// \brief The base type of node iterators, … … 330 330 /// Sets the iterator to the first node of \c g. 331 331 /// 332 NodeIt(const U ndirGraph&) { }332 NodeIt(const UGraph&) { } 333 333 /// Node -> NodeIt conversion. 334 334 … … 337 337 /// This feature necessitates that each time we 338 338 /// iterate the edge-set, the iteration order is the same. 339 NodeIt(const U ndirGraph&, const Node&) { }339 NodeIt(const UGraph&, const Node&) { } 340 340 /// Next node. 341 341 … … 350 350 /// The base type of the undirected edge iterators. 351 351 /// 352 class U ndirEdge {352 class UEdge { 353 353 public: 354 354 /// Default constructor … … 356 356 /// @warning The default constructor sets the iterator 357 357 /// to an undefined value. 358 U ndirEdge() { }359 /// Copy constructor. 360 361 /// Copy constructor. 362 /// 363 U ndirEdge(const UndirEdge&) { }364 /// Initialize the iterator to be invalid. 365 366 /// Initialize the iterator to be invalid. 367 /// 368 U ndirEdge(Invalid) { }358 UEdge() { } 359 /// Copy constructor. 360 361 /// Copy constructor. 362 /// 363 UEdge(const UEdge&) { } 364 /// Initialize the iterator to be invalid. 365 366 /// Initialize the iterator to be invalid. 367 /// 368 UEdge(Invalid) { } 369 369 /// Equality operator 370 370 371 371 /// Two iterators are equal if and only if they point to the 372 372 /// same object or both are invalid. 373 bool operator==(U ndirEdge) const { return true; }373 bool operator==(UEdge) const { return true; } 374 374 /// Inequality operator 375 375 376 /// \sa operator==(U ndirEdge n)377 /// 378 bool operator!=(U ndirEdge) const { return true; }376 /// \sa operator==(UEdge n) 377 /// 378 bool operator!=(UEdge) const { return true; } 379 379 380 380 /// Artificial ordering operator. … … 388 388 /// 389 389 /// \bug This is a technical requirement. Do we really need this? 390 bool operator<(U ndirEdge) const { return false; }390 bool operator<(UEdge) const { return false; } 391 391 }; 392 392 … … 398 398 /// \code 399 399 /// int count=0; 400 /// for(Graph::U ndirEdgeIt e(g); e!=INVALID; ++e) ++count;400 /// for(Graph::UEdgeIt e(g); e!=INVALID; ++e) ++count; 401 401 /// \endcode 402 class U ndirEdgeIt : public UndirEdge {402 class UEdgeIt : public UEdge { 403 403 public: 404 404 /// Default constructor … … 406 406 /// @warning The default constructor sets the iterator 407 407 /// to an undefined value. 408 U ndirEdgeIt() { }409 /// Copy constructor. 410 411 /// Copy constructor. 412 /// 413 U ndirEdgeIt(const UndirEdgeIt& e) : UndirEdge(e) { }414 /// Initialize the iterator to be invalid. 415 416 /// Initialize the iterator to be invalid. 417 /// 418 U ndirEdgeIt(Invalid) { }408 UEdgeIt() { } 409 /// Copy constructor. 410 411 /// Copy constructor. 412 /// 413 UEdgeIt(const UEdgeIt& e) : UEdge(e) { } 414 /// Initialize the iterator to be invalid. 415 416 /// Initialize the iterator to be invalid. 417 /// 418 UEdgeIt(Invalid) { } 419 419 /// This constructor sets the iterator to the first undirected edge. 420 420 421 421 /// This constructor sets the iterator to the first undirected edge. 422 U ndirEdgeIt(const UndirGraph&) { }423 /// U ndirEdge -> UndirEdgeIt conversion422 UEdgeIt(const UGraph&) { } 423 /// UEdge -> UEdgeIt conversion 424 424 425 425 /// Sets the iterator to the value of the trivial iterator. … … 427 427 /// iterate the undirected edge-set, the iteration order is the 428 428 /// same. 429 U ndirEdgeIt(const UndirGraph&, const UndirEdge&) { }429 UEdgeIt(const UGraph&, const UEdge&) { } 430 430 /// Next undirected edge 431 431 432 432 /// Assign the iterator to the next undirected edge. 433 U ndirEdgeIt& operator++() { return *this; }433 UEdgeIt& operator++() { return *this; } 434 434 }; 435 435 … … 448 448 /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count; 449 449 /// \endcode 450 class IncEdgeIt : public U ndirEdge {450 class IncEdgeIt : public UEdge { 451 451 public: 452 452 /// Default constructor … … 459 459 /// Copy constructor. 460 460 /// 461 IncEdgeIt(const IncEdgeIt& e) : U ndirEdge(e) { }461 IncEdgeIt(const IncEdgeIt& e) : UEdge(e) { } 462 462 /// Initialize the iterator to be invalid. 463 463 … … 469 469 /// This constructor set the iterator to the first incident edge of 470 470 /// the node. 471 IncEdgeIt(const U ndirGraph&, const Node&) { }472 /// U ndirEdge -> IncEdgeIt conversion471 IncEdgeIt(const UGraph&, const Node&) { } 472 /// UEdge -> IncEdgeIt conversion 473 473 474 474 /// Sets the iterator to the value of the trivial iterator \c e. 475 475 /// This feature necessitates that each time we 476 476 /// iterate the edge-set, the iteration order is the same. 477 IncEdgeIt(const U ndirGraph&, const UndirEdge&) { }477 IncEdgeIt(const UGraph&, const UEdge&) { } 478 478 /// Next incident edge 479 479 … … 487 487 /// The directed edge type. It can be converted to the 488 488 /// undirected edge. 489 class Edge : public U ndirEdge {489 class Edge : public UEdge { 490 490 public: 491 491 /// Default constructor … … 498 498 /// Copy constructor. 499 499 /// 500 Edge(const Edge& e) : U ndirEdge(e) { }500 Edge(const Edge& e) : UEdge(e) { } 501 501 /// Initialize the iterator to be invalid. 502 502 … … 558 558 /// This constructor sets the iterator to the first edge of \c g. 559 559 ///@param g the graph 560 EdgeIt(const U ndirGraph &g) { ignore_unused_variable_warning(g); }560 EdgeIt(const UGraph &g) { ignore_unused_variable_warning(g); } 561 561 /// Edge -> EdgeIt conversion 562 562 … … 564 564 /// This feature necessitates that each time we 565 565 /// iterate the edge-set, the iteration order is the same. 566 EdgeIt(const U ndirGraph&, const Edge&) { }566 EdgeIt(const UGraph&, const Edge&) { } 567 567 ///Next edge 568 568 … … 606 606 ///@param n the node 607 607 ///@param g the graph 608 OutEdgeIt(const U ndirGraph& n, const Node& g) {608 OutEdgeIt(const UGraph& n, const Node& g) { 609 609 ignore_unused_variable_warning(n); 610 610 ignore_unused_variable_warning(g); … … 615 615 /// This feature necessitates that each time we 616 616 /// iterate the edge-set, the iteration order is the same. 617 OutEdgeIt(const U ndirGraph&, const Edge&) { }617 OutEdgeIt(const UGraph&, const Edge&) { } 618 618 ///Next outgoing edge 619 619 … … 658 658 ///@param n the node 659 659 ///@param g the graph 660 InEdgeIt(const U ndirGraph& g, const Node& n) {660 InEdgeIt(const UGraph& g, const Node& n) { 661 661 ignore_unused_variable_warning(n); 662 662 ignore_unused_variable_warning(g); … … 667 667 /// This feature necessitates that each time we 668 668 /// iterate the edge-set, the iteration order is the same. 669 InEdgeIt(const U ndirGraph&, const Edge&) { }669 InEdgeIt(const UGraph&, const Edge&) { } 670 670 /// Next incoming edge 671 671 … … 688 688 689 689 ///\e 690 NodeMap(const U ndirGraph&) { }690 NodeMap(const UGraph&) { } 691 691 ///\e 692 NodeMap(const U ndirGraph&, T) { }692 NodeMap(const UGraph&, T) { } 693 693 694 694 ///Copy constructor … … 712 712 713 713 ///\e 714 EdgeMap(const U ndirGraph&) { }714 EdgeMap(const UGraph&) { } 715 715 ///\e 716 EdgeMap(const U ndirGraph&, T) { }716 EdgeMap(const UGraph&, T) { } 717 717 ///Copy constructor 718 718 EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { } … … 726 726 /// Reference map of the edges to type \c T. 727 727 /// \sa Reference 728 /// \warning Making maps that can handle bool type (U ndirEdgeMap<bool>)728 /// \warning Making maps that can handle bool type (UEdgeMap<bool>) 729 729 /// needs some extra attention! 730 730 /// \todo Wrong documentation 731 731 template<class T> 732 class U ndirEdgeMap : public ReadWriteMap<UndirEdge,T>732 class UEdgeMap : public ReadWriteMap<UEdge,T> 733 733 { 734 734 public: 735 735 736 736 ///\e 737 U ndirEdgeMap(const UndirGraph&) { }737 UEdgeMap(const UGraph&) { } 738 738 ///\e 739 U ndirEdgeMap(const UndirGraph&, T) { }739 UEdgeMap(const UGraph&, T) { } 740 740 ///Copy constructor 741 U ndirEdgeMap(const UndirEdgeMap& em) : ReadWriteMap<UndirEdge,T>(em) {}741 UEdgeMap(const UEdgeMap& em) : ReadWriteMap<UEdge,T>(em) {} 742 742 ///Assignment operator 743 U ndirEdgeMap &operator=(const UndirEdgeMap&) { return *this; }743 UEdgeMap &operator=(const UEdgeMap&) { return *this; } 744 744 // \todo fix this concept 745 745 }; … … 749 749 /// Direct the given undirected edge. The returned edge source 750 750 /// will be the given edge. 751 Edge direct(const U ndirEdge&, const Node&) const {751 Edge direct(const UEdge&, const Node&) const { 752 752 return INVALID; 753 753 } … … 758 758 /// will be the source of the undirected edge if the given bool 759 759 /// is true. 760 Edge direct(const U ndirEdge&, bool) const {760 Edge direct(const UEdge&, bool) const { 761 761 return INVALID; 762 762 } … … 776 776 /// 777 777 /// \return the opposite of the given Node on the given Edge 778 Node oppositeNode(Node, U ndirEdge) const { return INVALID; }778 Node oppositeNode(Node, UEdge) const { return INVALID; } 779 779 780 780 /// \brief First node of the undirected edge. 781 781 /// 782 /// \return the first node of the given U ndirEdge.783 /// 784 /// Naturally u ndirectected edges don't have direction and thus782 /// \return the first node of the given UEdge. 783 /// 784 /// Naturally uectected edges don't have direction and thus 785 785 /// don't have source and target node. But we use these two methods 786 786 /// to query the two endnodes of the edge. The direction of the edge … … 789 789 /// of the directed versions of the edges. 790 790 /// \sa direction 791 Node source(U ndirEdge) const { return INVALID; }791 Node source(UEdge) const { return INVALID; } 792 792 793 793 /// \brief Second node of the undirected edge. 794 Node target(U ndirEdge) const { return INVALID; }794 Node target(UEdge) const { return INVALID; } 795 795 796 796 /// \brief Source node of the directed edge. … … 818 818 // /// developpers_interface "Developpers' interface", so it shouldn't 819 819 // /// be used in an end-user program. 820 void first(U ndirEdge&) const {}820 void first(UEdge&) const {} 821 821 // /// \brief Next undirected edge of the graph 822 822 // /// … … 824 824 // /// developpers_interface "Developpers' interface", so it shouldn't 825 825 // /// be used in an end-user program. 826 void next(U ndirEdge&) const {}826 void next(UEdge&) const {} 827 827 828 828 // /// \brief First directed edge of the graph … … 911 911 struct Constraints { 912 912 void constraints() { 913 checkConcept<BaseIterableU ndirGraphConcept, Graph>();914 checkConcept<IterableU ndirGraphConcept, Graph>();915 checkConcept<MappableU ndirGraphConcept, Graph>();913 checkConcept<BaseIterableUGraphConcept, Graph>(); 914 checkConcept<IterableUGraphConcept, Graph>(); 915 checkConcept<MappableUGraphConcept, Graph>(); 916 916 } 917 917 }; … … 921 921 /// \brief An empty non-static undirected graph class. 922 922 /// 923 /// This class provides everything that \ref U ndirGraph does.923 /// This class provides everything that \ref UGraph does. 924 924 /// Additionally it enables building graphs from scratch. 925 class ExtendableU ndirGraph : public UndirGraph {925 class ExtendableUGraph : public UGraph { 926 926 public: 927 927 … … 936 936 /// Add a new undirected edge to the graph. 937 937 /// \return the new edge. 938 U ndirEdge addEdge(const Node& from, const Node& to);938 UEdge addEdge(const Node& from, const Node& to); 939 939 940 940 /// \brief Resets the graph. … … 947 947 struct Constraints { 948 948 void constraints() { 949 checkConcept<BaseIterableU ndirGraphConcept, Graph>();950 checkConcept<IterableU ndirGraphConcept, Graph>();951 checkConcept<MappableU ndirGraphConcept, Graph>();952 953 checkConcept<U ndirGraph, Graph>();954 checkConcept<ExtendableU ndirGraphConcept, Graph>();949 checkConcept<BaseIterableUGraphConcept, Graph>(); 950 checkConcept<IterableUGraphConcept, Graph>(); 951 checkConcept<MappableUGraphConcept, Graph>(); 952 953 checkConcept<UGraph, Graph>(); 954 checkConcept<ExtendableUGraphConcept, Graph>(); 955 955 checkConcept<ClearableGraphComponent, Graph>(); 956 956 } … … 961 961 /// \brief An empty erasable undirected graph class. 962 962 /// 963 /// This class is an extension of \ref ExtendableU ndirGraph. It makes it963 /// This class is an extension of \ref ExtendableUGraph. It makes it 964 964 /// possible to erase undirected edges or nodes. 965 class ErasableU ndirGraph : public ExtendableUndirGraph {965 class ErasableUGraph : public ExtendableUGraph { 966 966 public: 967 967 … … 975 975 /// Deletes an undirected edge. 976 976 /// 977 void erase(U ndirEdge) { }977 void erase(UEdge) { } 978 978 979 979 template <typename Graph> 980 980 struct Constraints { 981 981 void constraints() { 982 checkConcept<ExtendableU ndirGraph, Graph>();983 checkConcept<ErasableU ndirGraphConcept, Graph>();982 checkConcept<ExtendableUGraph, Graph>(); 983 checkConcept<ErasableUGraphConcept, Graph>(); 984 984 } 985 985 }; -
lemon/edge_set.h
r1875 r1909 295 295 /// 296 296 /// \brief Graph using a node set of another graph and an 297 /// own u ndiredge set.297 /// own uedge set. 298 298 /// 299 299 /// This structure can be used to establish another graph over a node set … … 308 308 /// \ref concept::ExtendableGraph "ExtendableGraph" concept. 309 309 template <typename _Graph> 310 class ListU ndirEdgeSet :311 public ErasableU ndirEdgeSetExtender<312 ClearableU ndirEdgeSetExtender<313 ExtendableU ndirEdgeSetExtender<314 MappableU ndirEdgeSetExtender<315 IterableU ndirGraphExtender<316 AlterableU ndirEdgeSetExtender<317 U ndirGraphExtender<310 class ListUEdgeSet : 311 public ErasableUEdgeSetExtender< 312 ClearableUEdgeSetExtender< 313 ExtendableUEdgeSetExtender< 314 MappableUEdgeSetExtender< 315 IterableUGraphExtender< 316 AlterableUEdgeSetExtender< 317 UGraphExtender< 318 318 ListEdgeSetBase<_Graph> > > > > > > > { 319 319 320 320 public: 321 321 322 typedef ErasableU ndirEdgeSetExtender<323 ClearableU ndirEdgeSetExtender<324 ExtendableU ndirEdgeSetExtender<325 MappableU ndirEdgeSetExtender<326 IterableU ndirGraphExtender<327 AlterableU ndirEdgeSetExtender<328 U ndirGraphExtender<322 typedef ErasableUEdgeSetExtender< 323 ClearableUEdgeSetExtender< 324 ExtendableUEdgeSetExtender< 325 MappableUEdgeSetExtender< 326 IterableUGraphExtender< 327 AlterableUEdgeSetExtender< 328 UGraphExtender< 329 329 ListEdgeSetBase<_Graph> > > > > > > > Parent; 330 330 … … 355 355 typedef NodesImplBase Parent; 356 356 357 NodesImpl(const Graph& graph, ListU ndirEdgeSet& edgeset)357 NodesImpl(const Graph& graph, ListUEdgeSet& edgeset) 358 358 : Parent(graph), _edgeset(edgeset) {} 359 359 … … 376 376 377 377 private: 378 ListU ndirEdgeSet& _edgeset;378 ListUEdgeSet& _edgeset; 379 379 }; 380 380 … … 386 386 /// 387 387 /// Constructor of the adaptor. 388 ListU ndirEdgeSet(const Graph& graph) : nodes(graph, *this) {388 ListUEdgeSet(const Graph& graph) : nodes(graph, *this) { 389 389 Parent::initalize(graph, nodes); 390 390 } -
lemon/euler.h
r1875 r1909 125 125 ///Euler tour of \c g. 126 126 ///\code 127 /// for(U ndirEulerIt<UndirListGraph> e(g),e!=INVALID;++e) {128 /// std::cout << g.id(U ndirEdge(e)) << std::eol;127 /// for(UEulerIt<ListUGraph> e(g),e!=INVALID;++e) { 128 /// std::cout << g.id(UEdge(e)) << std::eol; 129 129 /// } 130 130 ///\endcode 131 131 ///Although the iterator provides an Euler tour of an undirected graph, 132 ///in order to indicate the direction of the tour, U ndirEulerIt132 ///in order to indicate the direction of the tour, UEulerIt 133 133 ///returns directed edges (that convert to the undirected ones, of course). 134 134 /// … … 136 136 ///\todo Test required 137 137 template<class Graph> 138 class U ndirEulerIt138 class UEulerIt 139 139 { 140 140 typedef typename Graph::Node Node; … … 147 147 const Graph &g; 148 148 typename Graph::NodeMap<OutEdgeIt> nedge; 149 typename Graph::U ndirEdgeMap<bool> visited;149 typename Graph::UEdgeMap<bool> visited; 150 150 std::list<Edge> euler; 151 151 … … 157 157 ///\param start The starting point of the tour. If it is not given 158 158 /// the tour will start from the first node. 159 U ndirEulerIt(const Graph &_g,typename Graph::Node start=INVALID)159 UEulerIt(const Graph &_g,typename Graph::Node start=INVALID) 160 160 : g(_g), nedge(g), visited(g,false) 161 161 { … … 176 176 177 177 ///Next edge of the tour 178 U ndirEulerIt &operator++() {178 UEulerIt &operator++() { 179 179 Node s=g.target(euler.front()); 180 180 euler.pop_front(); … … 197 197 198 198 ///\warning This incrementation 199 ///returns an \c Edge, not an \ref U ndirEulerIt, as one may199 ///returns an \c Edge, not an \ref UEulerIt, as one may 200 200 ///expect. 201 201 Edge operator++(int) … … 225 225 bool 226 226 #else 227 typename enable_if<typename Graph::U ndirTag,bool>::type227 typename enable_if<typename Graph::UTag,bool>::type 228 228 euler(const Graph &g) 229 229 { … … 233 233 } 234 234 template<class Graph> 235 typename disable_if<typename Graph::U ndirTag,bool>::type235 typename disable_if<typename Graph::UTag,bool>::type 236 236 #endif 237 237 euler(const Graph &g) -
lemon/full_graph.h
r1875 r1909 32 32 ///\ingroup graphs 33 33 ///\file 34 ///\brief FullGraph and UndirFullGraph classes.34 ///\brief FullGraph and FullUGraph classes. 35 35 36 36 … … 214 214 215 215 216 class UndirFullGraphBase {216 class FullUGraphBase { 217 217 int _nodeNum; 218 218 int _edgeNum; 219 219 public: 220 220 221 typedef UndirFullGraphBase Graph;221 typedef FullUGraphBase Graph; 222 222 223 223 class Node; … … 226 226 public: 227 227 228 UndirFullGraphBase() {}228 FullUGraphBase() {} 229 229 230 230 … … 302 302 303 303 class Node { 304 friend class UndirFullGraphBase;304 friend class FullUGraphBase; 305 305 306 306 protected: … … 318 318 319 319 class Edge { 320 friend class UndirFullGraphBase;320 friend class FullUGraphBase; 321 321 322 322 protected: … … 378 378 }; 379 379 380 typedef StaticMappableU ndirGraphExtender<381 IterableU ndirGraphExtender<382 AlterableU ndirGraphExtender<383 U ndirGraphExtender<UndirFullGraphBase> > > > ExtendedUndirFullGraphBase;380 typedef StaticMappableUGraphExtender< 381 IterableUGraphExtender< 382 AlterableUGraphExtender< 383 UGraphExtender<FullUGraphBase> > > > ExtendedFullUGraphBase; 384 384 385 385 /// \ingroup graphs … … 391 391 /// edges or nodes. 392 392 /// 393 /// The main difference beetween the \e FullGraph and \e UndirFullGraph class393 /// The main difference beetween the \e FullGraph and \e FullUGraph class 394 394 /// is that this class conforms to the undirected graph concept and 395 395 /// it does not contain the loop edges. … … 398 398 /// 399 399 /// \author Balazs Dezso 400 class UndirFullGraph : public ExtendedUndirFullGraphBase {401 public: 402 UndirFullGraph(int n) { construct(n); }400 class FullUGraph : public ExtendedFullUGraphBase { 401 public: 402 FullUGraph(int n) { construct(n); } 403 403 }; 404 404 405 405 406 class FullU ndirBipartiteGraphBase {406 class FullUBipartiteGraphBase { 407 407 protected: 408 408 … … 416 416 class NodeSetError : public LogicError { 417 417 virtual const char* exceptionName() const { 418 return "lemon::FullU ndirBipartiteGraph::NodeSetError";418 return "lemon::FullUBipartiteGraph::NodeSetError"; 419 419 } 420 420 }; 421 421 422 422 class Node { 423 friend class FullU ndirBipartiteGraphBase;423 friend class FullUBipartiteGraphBase; 424 424 protected: 425 425 int id; … … 435 435 436 436 class Edge { 437 friend class FullU ndirBipartiteGraphBase;437 friend class FullUBipartiteGraphBase; 438 438 protected: 439 439 int id; … … 576 576 577 577 578 typedef StaticMappableU ndirBipartiteGraphExtender<579 IterableU ndirBipartiteGraphExtender<580 AlterableU ndirBipartiteGraphExtender<581 U ndirBipartiteGraphExtender <582 FullU ndirBipartiteGraphBase> > > >583 ExtendedFullU ndirBipartiteGraphBase;584 585 586 class FullU ndirBipartiteGraph :587 public ExtendedFullU ndirBipartiteGraphBase {588 public: 589 typedef ExtendedFullU ndirBipartiteGraphBase Parent;590 FullU ndirBipartiteGraph(int upperNodeNum, int lowerNodeNum) {578 typedef StaticMappableUBipartiteGraphExtender< 579 IterableUBipartiteGraphExtender< 580 AlterableUBipartiteGraphExtender< 581 UBipartiteGraphExtender < 582 FullUBipartiteGraphBase> > > > 583 ExtendedFullUBipartiteGraphBase; 584 585 586 class FullUBipartiteGraph : 587 public ExtendedFullUBipartiteGraphBase { 588 public: 589 typedef ExtendedFullUBipartiteGraphBase Parent; 590 FullUBipartiteGraph(int upperNodeNum, int lowerNodeNum) { 591 591 Parent::construct(upperNodeNum, lowerNodeNum); 592 592 } -
lemon/graph_adaptor.h
r1875 r1909 673 673 674 674 template <typename _Graph> 675 class U ndirGraphAdaptorBase :676 public U ndirGraphExtender<GraphAdaptorBase<_Graph> > {675 class UGraphAdaptorBase : 676 public UGraphExtender<GraphAdaptorBase<_Graph> > { 677 677 public: 678 678 typedef _Graph Graph; 679 typedef U ndirGraphExtender<GraphAdaptorBase<_Graph> > Parent;679 typedef UGraphExtender<GraphAdaptorBase<_Graph> > Parent; 680 680 protected: 681 U ndirGraphAdaptorBase() : Parent() { }682 public: 683 typedef typename Parent::U ndirEdge UndirEdge;681 UGraphAdaptorBase() : Parent() { } 682 public: 683 typedef typename Parent::UEdge UEdge; 684 684 typedef typename Parent::Edge Edge; 685 685 … … 687 687 class EdgeMap { 688 688 protected: 689 const U ndirGraphAdaptorBase<_Graph>* g;689 const UGraphAdaptorBase<_Graph>* g; 690 690 template <typename TT> friend class EdgeMap; 691 691 typename _Graph::template EdgeMap<T> forward_map, backward_map; … … 694 694 typedef Edge Key; 695 695 696 EdgeMap(const U ndirGraphAdaptorBase<_Graph>& _g) : g(&_g),696 EdgeMap(const UGraphAdaptorBase<_Graph>& _g) : g(&_g), 697 697 forward_map(*(g->graph)), backward_map(*(g->graph)) { } 698 698 699 EdgeMap(const U ndirGraphAdaptorBase<_Graph>& _g, T a) : g(&_g),699 EdgeMap(const UGraphAdaptorBase<_Graph>& _g, T a) : g(&_g), 700 700 forward_map(*(g->graph), a), backward_map(*(g->graph), a) { } 701 701 … … 716 716 717 717 template <typename T> 718 class U ndirEdgeMap {719 template <typename TT> friend class U ndirEdgeMap;718 class UEdgeMap { 719 template <typename TT> friend class UEdgeMap; 720 720 typename _Graph::template EdgeMap<T> map; 721 721 public: 722 722 typedef T Value; 723 typedef U ndirEdge Key;724 725 U ndirEdgeMap(const UndirGraphAdaptorBase<_Graph>& g) :723 typedef UEdge Key; 724 725 UEdgeMap(const UGraphAdaptorBase<_Graph>& g) : 726 726 map(*(g.graph)) { } 727 727 728 U ndirEdgeMap(const UndirGraphAdaptorBase<_Graph>& g, T a) :728 UEdgeMap(const UGraphAdaptorBase<_Graph>& g, T a) : 729 729 map(*(g.graph), a) { } 730 730 731 void set(U ndirEdge e, T a) {731 void set(UEdge e, T a) { 732 732 map.set(e, a); 733 733 } 734 734 735 T operator[](U ndirEdge e) const {735 T operator[](UEdge e) const { 736 736 return map[e]; 737 737 } … … 747 747 /// \author Marton Makai 748 748 template<typename _Graph> 749 class U ndirGraphAdaptor :750 public IterableU ndirGraphExtender<751 U ndirGraphAdaptorBase<_Graph> > {749 class UGraphAdaptor : 750 public IterableUGraphExtender< 751 UGraphAdaptorBase<_Graph> > { 752 752 public: 753 753 typedef _Graph Graph; 754 typedef IterableU ndirGraphExtender<755 U ndirGraphAdaptorBase<_Graph> > Parent;754 typedef IterableUGraphExtender< 755 UGraphAdaptorBase<_Graph> > Parent; 756 756 protected: 757 U ndirGraphAdaptor() { }758 public: 759 U ndirGraphAdaptor(_Graph& _graph) {757 UGraphAdaptor() { } 758 public: 759 UGraphAdaptor(_Graph& _graph) { 760 760 setGraph(_graph); 761 761 } -
lemon/graph_reader.h
r1901 r1909 379 379 /// \brief The undirected graph reader class. 380 380 /// 381 /// The \c U ndirGraphReader class provides the graph input.381 /// The \c UGraphReader class provides the graph input. 382 382 /// Before you read this documentation it might be useful to read the general 383 383 /// description of \ref graph-io-page "Graph Input-Output". … … 391 391 /// 392 392 /// If you read a graph you need not read all the maps and items just those 393 /// that you need. The interface of the \c U ndirGraphReader is very similar394 /// to the U ndirGraphWriter but the reading method does not depend on the393 /// that you need. The interface of the \c UGraphReader is very similar 394 /// to the UGraphWriter but the reading method does not depend on the 395 395 /// order of the given commands. 396 396 /// … … 400 400 /// 401 401 /// \code 402 /// U ndirGraphReader<UndirListGraph> reader(std::cin, graph);402 /// UGraphReader<ListUGraph> reader(std::cin, graph); 403 403 /// \endcode 404 404 /// … … 417 417 /// \endcode 418 418 /// 419 /// With the \c readU ndirEdgeMap() member function you can give an420 /// u ndiredge map reading command similar to the NodeMaps.421 /// 422 /// \code 423 /// reader.readU ndirEdgeMap("capacity", capacityMap);419 /// With the \c readUEdgeMap() member function you can give an 420 /// uedge map reading command similar to the NodeMaps. 421 /// 422 /// \code 423 /// reader.readUEdgeMap("capacity", capacityMap); 424 424 /// \endcode 425 425 /// … … 433 433 /// \endcode 434 434 /// 435 /// With \c readNode() and \c readU ndirEdge() functions you can read436 /// labeled Nodes and U ndirEdges.435 /// With \c readNode() and \c readUEdge() functions you can read 436 /// labeled Nodes and UEdges. 437 437 /// 438 438 /// \code … … 440 440 /// reader.readNode("target", targetNode); 441 441 /// 442 /// reader.readU ndirEdge("observed", undirEdge);442 /// reader.readUEdge("observed", uEdge); 443 443 /// \endcode 444 444 /// … … 456 456 /// \see GraphReader 457 457 /// \see DefaultReaderTraits 458 /// \see \ref U ndirGraphWriter458 /// \see \ref UGraphWriter 459 459 /// \see \ref graph-io-page 460 460 /// 461 461 /// \author Balazs Dezso 462 462 template <typename _Graph, typename _ReaderTraits = DefaultReaderTraits> 463 class U ndirGraphReader {463 class UGraphReader { 464 464 public: 465 465 … … 467 467 typedef typename Graph::Node Node; 468 468 typedef typename Graph::Edge Edge; 469 typedef typename Graph::U ndirEdge UndirEdge;469 typedef typename Graph::UEdge UEdge; 470 470 471 471 typedef _ReaderTraits ReaderTraits; 472 472 typedef typename ReaderTraits::Skipper DefaultSkipper; 473 473 474 /// \brief Construct a new U ndirGraphReader.475 /// 476 /// Construct a new U ndirGraphReader. It reads into the given graph474 /// \brief Construct a new UGraphReader. 475 /// 476 /// Construct a new UGraphReader. It reads into the given graph 477 477 /// and it use the given reader as the default skipper. 478 U ndirGraphReader(std::istream& _is, Graph& _graph,478 UGraphReader(std::istream& _is, Graph& _graph, 479 479 const DefaultSkipper& _skipper = DefaultSkipper()) 480 480 : reader(new LemonReader(_is)), own_reader(true), skipper(_skipper), 481 481 nodeset_reader(*reader, _graph, std::string(), skipper), 482 u ndir_edgeset_reader(*reader, _graph, nodeset_reader,482 u_edgeset_reader(*reader, _graph, nodeset_reader, 483 483 std::string(), skipper), 484 484 node_reader(*reader, nodeset_reader, std::string()), 485 u ndir_edge_reader(*reader, undir_edgeset_reader, std::string()),485 u_edge_reader(*reader, u_edgeset_reader, std::string()), 486 486 attribute_reader(*reader, std::string()) {} 487 487 488 /// \brief Construct a new U ndirGraphReader.489 /// 490 /// Construct a new U ndirGraphReader. It reads into the given graph488 /// \brief Construct a new UGraphReader. 489 /// 490 /// Construct a new UGraphReader. It reads into the given graph 491 491 /// and it use the given reader as the default skipper. 492 U ndirGraphReader(const std::string& _filename, Graph& _graph,492 UGraphReader(const std::string& _filename, Graph& _graph, 493 493 const DefaultSkipper& _skipper = DefaultSkipper()) 494 494 : reader(new LemonReader(_filename)), own_reader(true), 495 495 skipper(_skipper), 496 496 nodeset_reader(*reader, _graph, std::string(), skipper), 497 u ndir_edgeset_reader(*reader, _graph, nodeset_reader,497 u_edgeset_reader(*reader, _graph, nodeset_reader, 498 498 std::string(), skipper), 499 499 node_reader(*reader, nodeset_reader, std::string()), 500 u ndir_edge_reader(*reader, undir_edgeset_reader, std::string()),500 u_edge_reader(*reader, u_edgeset_reader, std::string()), 501 501 attribute_reader(*reader, std::string()) {} 502 502 503 /// \brief Construct a new U ndirGraphReader.504 /// 505 /// Construct a new U ndirGraphReader. It reads into the given graph503 /// \brief Construct a new UGraphReader. 504 /// 505 /// Construct a new UGraphReader. It reads into the given graph 506 506 /// and it use the given reader as the default skipper. 507 U ndirGraphReader(LemonReader& _reader, Graph& _graph,507 UGraphReader(LemonReader& _reader, Graph& _graph, 508 508 const DefaultSkipper& _skipper = DefaultSkipper()) 509 509 : reader(_reader), own_reader(false), skipper(_skipper), 510 510 nodeset_reader(*reader, _graph, std::string(), skipper), 511 u ndir_edgeset_reader(*reader, _graph, nodeset_reader,511 u_edgeset_reader(*reader, _graph, nodeset_reader, 512 512 std::string(), skipper), 513 513 node_reader(*reader, nodeset_reader, std::string()), 514 u ndir_edge_reader(*reader, undir_edgeset_reader, std::string()),514 u_edge_reader(*reader, u_edgeset_reader, std::string()), 515 515 attribute_reader(*reader, std::string()) {} 516 516 … … 518 518 /// 519 519 /// Destruct the graph reader. 520 ~U ndirGraphReader() {520 ~UGraphReader() { 521 521 if (own_reader) 522 522 delete reader; … … 527 527 /// Give a new node map reading command to the reader. 528 528 template <typename Map> 529 U ndirGraphReader& readNodeMap(std::string name, Map& map) {529 UGraphReader& readNodeMap(std::string name, Map& map) { 530 530 nodeset_reader.readNodeMap(name, map); 531 531 return *this; … … 533 533 534 534 template <typename Map> 535 U ndirGraphReader& readNodeMap(std::string name, const Map& map) {535 UGraphReader& readNodeMap(std::string name, const Map& map) { 536 536 nodeset_reader.readNodeMap(name, map); 537 537 return *this; … … 542 542 /// Give a new node map reading command to the reader. 543 543 template <typename Reader, typename Map> 544 U ndirGraphReader& readNodeMap(std::string name, Map& map,544 UGraphReader& readNodeMap(std::string name, Map& map, 545 545 const Reader& reader = Reader()) { 546 546 nodeset_reader.readNodeMap(name, map, reader); … … 549 549 550 550 template <typename Reader, typename Map> 551 U ndirGraphReader& readNodeMap(std::string name, const Map& map,551 UGraphReader& readNodeMap(std::string name, const Map& map, 552 552 const Reader& reader = Reader()) { 553 553 nodeset_reader.readNodeMap(name, map, reader); … … 559 559 /// Give a new node map skipping command to the reader. 560 560 template <typename Reader> 561 U ndirGraphReader& skipNodeMap(std::string name,561 UGraphReader& skipNodeMap(std::string name, 562 562 const Reader& reader = Reader()) { 563 563 nodeset_reader.skipNodeMap(name, reader); … … 569 569 /// Give a new undirected edge map reading command to the reader. 570 570 template <typename Map> 571 U ndirGraphReader& readUndirEdgeMap(std::string name, Map& map) {572 u ndir_edgeset_reader.readUndirEdgeMap(name, map);573 return *this; 574 } 575 576 template <typename Map> 577 U ndirGraphReader& readUndirEdgeMap(std::string name, const Map& map) {578 u ndir_edgeset_reader.readUndirEdgeMap(name, map);571 UGraphReader& readUEdgeMap(std::string name, Map& map) { 572 u_edgeset_reader.readUEdgeMap(name, map); 573 return *this; 574 } 575 576 template <typename Map> 577 UGraphReader& readUEdgeMap(std::string name, const Map& map) { 578 u_edgeset_reader.readUEdgeMap(name, map); 579 579 return *this; 580 580 } … … 585 585 /// Give a new undirected edge map reading command to the reader. 586 586 template <typename Reader, typename Map> 587 U ndirGraphReader& readUndirEdgeMap(std::string name, Map& map,587 UGraphReader& readUEdgeMap(std::string name, Map& map, 588 588 const Reader& reader = Reader()) { 589 u ndir_edgeset_reader.readUndirEdgeMap(name, map, reader);590 return *this; 591 } 592 593 template <typename Reader, typename Map> 594 U ndirGraphReader& readUndirEdgeMap(std::string name, const Map& map,589 u_edgeset_reader.readUEdgeMap(name, map, reader); 590 return *this; 591 } 592 593 template <typename Reader, typename Map> 594 UGraphReader& readUEdgeMap(std::string name, const Map& map, 595 595 const Reader& reader = Reader()) { 596 u ndir_edgeset_reader.readUndirEdgeMap(name, map, reader);596 u_edgeset_reader.readUEdgeMap(name, map, reader); 597 597 return *this; 598 598 } … … 602 602 /// Give a new undirected edge map skipping command to the reader. 603 603 template <typename Reader> 604 U ndirGraphReader& skipUndirEdgeMap(std::string name,604 UGraphReader& skipUEdgeMap(std::string name, 605 605 const Reader& reader = Reader()) { 606 u ndir_edgeset_reader.skipUndirMap(name, reader);606 u_edgeset_reader.skipUMap(name, reader); 607 607 return *this; 608 608 } … … 613 613 /// Give a new edge map reading command to the reader. 614 614 template <typename Map> 615 U ndirGraphReader& readEdgeMap(std::string name, Map& map) {616 u ndir_edgeset_reader.readEdgeMap(name, map);617 return *this; 618 } 619 620 template <typename Map> 621 U ndirGraphReader& readEdgeMap(std::string name, const Map& map) {622 u ndir_edgeset_reader.readEdgeMap(name, map);615 UGraphReader& readEdgeMap(std::string name, Map& map) { 616 u_edgeset_reader.readEdgeMap(name, map); 617 return *this; 618 } 619 620 template <typename Map> 621 UGraphReader& readEdgeMap(std::string name, const Map& map) { 622 u_edgeset_reader.readEdgeMap(name, map); 623 623 return *this; 624 624 } … … 629 629 /// Give a new edge map reading command to the reader. 630 630 template <typename Reader, typename Map> 631 U ndirGraphReader& readEdgeMap(std::string name, Map& map,631 UGraphReader& readEdgeMap(std::string name, Map& map, 632 632 const Reader& reader = Reader()) { 633 u ndir_edgeset_reader.readEdgeMap(name, map, reader);634 return *this; 635 } 636 637 template <typename Reader, typename Map> 638 U ndirGraphReader& readEdgeMap(std::string name, const Map& map,633 u_edgeset_reader.readEdgeMap(name, map, reader); 634 return *this; 635 } 636 637 template <typename Reader, typename Map> 638 UGraphReader& readEdgeMap(std::string name, const Map& map, 639 639 const Reader& reader = Reader()) { 640 u ndir_edgeset_reader.readEdgeMap(name, map, reader);640 u_edgeset_reader.readEdgeMap(name, map, reader); 641 641 return *this; 642 642 } … … 646 646 /// Give a new edge map skipping command to the reader. 647 647 template <typename Reader> 648 U ndirGraphReader& skipEdgeMap(std::string name,648 UGraphReader& skipEdgeMap(std::string name, 649 649 const Reader& reader = Reader()) { 650 u ndir_edgeset_reader.skipEdgeMap(name, reader);650 u_edgeset_reader.skipEdgeMap(name, reader); 651 651 return *this; 652 652 } … … 655 655 /// 656 656 /// Give a new labeled node reading command to the reader. 657 U ndirGraphReader& readNode(std::string name, Node& node) {657 UGraphReader& readNode(std::string name, Node& node) { 658 658 node_reader.readNode(name, node); 659 659 return *this; … … 663 663 /// 664 664 /// Give a new labeled edge reading command to the reader. 665 U ndirGraphReader& readEdge(std::string name, Edge& edge) {666 u ndir_edge_reader.readEdge(name, edge);665 UGraphReader& readEdge(std::string name, Edge& edge) { 666 u_edge_reader.readEdge(name, edge); 667 667 } 668 668 … … 671 671 /// 672 672 /// Give a new labeled undirected edge reading command to the reader. 673 U ndirGraphReader& readUndirEdge(std::string name, UndirEdge& edge) {674 u ndir_edge_reader.readUndirEdge(name, edge);673 UGraphReader& readUEdge(std::string name, UEdge& edge) { 674 u_edge_reader.readUEdge(name, edge); 675 675 } 676 676 … … 679 679 /// Give a new attribute reading command. 680 680 template <typename Value> 681 U ndirGraphReader& readAttribute(std::string name, Value& value) {681 UGraphReader& readAttribute(std::string name, Value& value) { 682 682 attribute_reader.readAttribute(name, value); 683 683 return *this; … … 688 688 /// Give a new attribute reading command. 689 689 template <typename Reader, typename Value> 690 U ndirGraphReader& readAttribute(std::string name, Value& value,690 UGraphReader& readAttribute(std::string name, Value& value, 691 691 const Reader& reader) { 692 692 attribute_reader.readAttribute<Reader>(name, value, reader); … … 717 717 bool isLabelReader() const { 718 718 return nodeset_reader.isLabelReader() && 719 u ndir_edgeset_reader.isLabelReader();719 u_edgeset_reader.isLabelReader(); 720 720 } 721 721 … … 733 733 /// it. It is possible only if there was read an "label" named edge map. 734 734 void readLabel(std::istream& is, Edge& edge) const { 735 return u ndir_edgeset_reader.readLabel(is, edge);735 return u_edgeset_reader.readLabel(is, edge); 736 736 } 737 737 … … 741 741 /// belongs to it. It is possible only if there was read an "label" named 742 742 /// edge map. 743 void readLabel(std::istream& is, U ndirEdge& uedge) const {744 return u ndir_edgeset_reader.readLabel(is, uedge);743 void readLabel(std::istream& is, UEdge& uedge) const { 744 return u_edgeset_reader.readLabel(is, uedge); 745 745 } 746 746 … … 754 754 755 755 NodeSetReader<Graph, ReaderTraits> nodeset_reader; 756 U ndirEdgeSetReader<Graph, ReaderTraits> undir_edgeset_reader;756 UEdgeSetReader<Graph, ReaderTraits> u_edgeset_reader; 757 757 758 758 NodeReader<Graph> node_reader; 759 U ndirEdgeReader<Graph> undir_edge_reader;759 UEdgeReader<Graph> u_edge_reader; 760 760 761 761 AttributeReader<ReaderTraits> attribute_reader; … … 765 765 /// 766 766 /// It is a helper function to read an undirected graph from the given input 767 /// stream. It gives back an U ndirGraphReader object and this object767 /// stream. It gives back an UGraphReader object and this object 768 768 /// can read more maps, labeled nodes, edges, undirected edges and 769 769 /// attributes. … … 774 774 /// \param g The graph. 775 775 template<typename Graph> 776 U ndirGraphReader<Graph> undirGraphReader(std::istream& is, Graph &g) {776 UGraphReader<Graph> uGraphReader(std::istream& is, Graph &g) { 777 777 return GraphReader<Graph>(is, g); 778 778 } … … 781 781 /// 782 782 /// It is a helper function to read an undirected graph from the given input 783 /// file. It gives back an U ndirGraphReader object and this object783 /// file. It gives back an UGraphReader object and this object 784 784 /// can read more maps, labeled nodes, edges, undirected edges and 785 785 /// attributes. … … 790 790 /// \param g The graph. 791 791 template<typename Graph> 792 U ndirGraphReader<Graph> undirGraphReader(const std::string& fn, Graph &g) {792 UGraphReader<Graph> uGraphReader(const std::string& fn, Graph &g) { 793 793 return GraphReader<Graph>(fn, g); 794 794 } -
lemon/graph_to_eps.h
r1907 r1909 235 235 char *_nodePsTextsPreamble; 236 236 237 bool _u ndir;237 bool _u; 238 238 bool _pleaseRemoveOsStream; 239 239 … … 273 273 _showNodeText(false), _nodeTexts(false), _nodeTextSize(1), 274 274 _showNodePsText(false), _nodePsTexts(false), _nodePsTextsPreamble(0), 275 _u ndir(false),275 _u(false), 276 276 _pleaseRemoveOsStream(_pros), _scaleToA4(false), 277 277 _nodeTextColorType(SAME_COL), _nodeTextColors(Color(0,0,0)), … … 330 330 using T::_nodePsTextsPreamble; 331 331 332 using T::_u ndir;332 using T::_u; 333 333 using T::_pleaseRemoveOsStream; 334 334 … … 735 735 ///Sets whether the the graph is undirected 736 736 /// 737 GraphToEps<T> &u ndir(bool b=true) {_undir=b;return *this;}737 GraphToEps<T> &u(bool b=true) {_u=b;return *this;} 738 738 ///Sets whether the the graph is directed 739 739 740 740 ///Sets whether the the graph is directed. 741 741 ///Use it to show the undirected edges as a pair of directed ones. 742 GraphToEps<T> &bidir(bool b=true) {_u ndir=!b;return *this;}742 GraphToEps<T> &bidir(bool b=true) {_u=!b;return *this;} 743 743 744 744 ///Sets the title. … … 959 959 std::vector<Edge> el; 960 960 for(EdgeIt e(g);e!=INVALID;++e) 961 if((!_u ndir||g.source(e)<g.target(e))&&_edgeWidths[e]>0)961 if((!_u||g.source(e)<g.target(e))&&_edgeWidths[e]>0) 962 962 el.push_back(e); 963 963 std::sort(el.begin(),el.end(),edgeLess(g)); … … 1047 1047 } 1048 1048 else for(EdgeIt e(g);e!=INVALID;++e) 1049 if((!_u ndir||g.source(e)<g.target(e))&&_edgeWidths[e]>0)1049 if((!_u||g.source(e)<g.target(e))&&_edgeWidths[e]>0) 1050 1050 if(_drawArrows) { 1051 1051 xy<double> d(mycoords[g.target(e)]-mycoords[g.source(e)]); -
lemon/graph_utils.h
r1875 r1909 72 72 ///This \c \#define creates the same convenience typedefs as defined by 73 73 ///\ref GRAPH_TYPEDEFS(Graph) and three more, namely it creates 74 ///\c U ndirEdge, \c UndirEdgeIt, \c IncEdgeIt,75 ///\c BoolU ndirEdgeMap, \c IntUndirEdgeMap, \c DoubleUndirEdgeMap.74 ///\c UEdge, \c UEdgeIt, \c IncEdgeIt, 75 ///\c BoolUEdgeMap, \c IntUEdgeMap, \c DoubleUEdgeMap. 76 76 /// 77 77 ///\note If \c G it a template parameter, it should be used in this way. … … 84 84 #define UNDIRGRAPH_TYPEDEFS(Graph) \ 85 85 GRAPH_TYPEDEFS(Graph) \ 86 typedef Graph:: U ndirEdge UndirEdge; \87 typedef Graph:: U ndirEdgeIt UndirEdgeIt; \86 typedef Graph:: UEdge UEdge; \ 87 typedef Graph:: UEdgeIt UEdgeIt; \ 88 88 typedef Graph:: IncEdgeIt IncEdgeIt; 89 // typedef Graph::template U ndirEdgeMap<bool> BoolUndirEdgeMap;90 // typedef Graph::template U ndirEdgeMap<int> IntUndirEdgeMap;91 // typedef Graph::template U ndirEdgeMap<double> DoubleUndirEdgeMap;89 // typedef Graph::template UEdgeMap<bool> BoolUEdgeMap; 90 // typedef Graph::template UEdgeMap<int> IntUEdgeMap; 91 // typedef Graph::template UEdgeMap<double> DoubleUEdgeMap; 92 92 93 93 … … 163 163 inline 164 164 typename enable_if<typename Graph::EdgeNumTag, int>::type 165 _countU ndirEdges(const Graph &g) {166 return g.u ndirEdgeNum();167 } 168 169 template <typename Graph> 170 inline int _countU ndirEdges(Wrap<Graph> w) {171 return countItems<Graph, typename Graph::U ndirEdgeIt>(w.value);165 _countUEdges(const Graph &g) { 166 return g.uEdgeNum(); 167 } 168 169 template <typename Graph> 170 inline int _countUEdges(Wrap<Graph> w) { 171 return countItems<Graph, typename Graph::UEdgeIt>(w.value); 172 172 } 173 173 … … 179 179 180 180 template <typename Graph> 181 inline int countU ndirEdges(const Graph& g) {182 return _countU ndirEdges<Graph>(g);181 inline int countUEdges(const Graph& g) { 182 return _countUEdges<Graph>(g); 183 183 } 184 184 … … 326 326 typename enable_if< 327 327 typename Graph::FindEdgeTag, 328 typename Graph::U ndirEdge>::type329 _findU ndirEdge(const Graph &g,328 typename Graph::UEdge>::type 329 _findUEdge(const Graph &g, 330 330 typename Graph::Node u, typename Graph::Node v, 331 typename Graph::U ndirEdge prev = INVALID) {332 return g.findU ndirEdge(u, v, prev);333 } 334 335 template <typename Graph> 336 inline typename Graph::U ndirEdge337 _findU ndirEdge(Wrap<Graph> w,331 typename Graph::UEdge prev = INVALID) { 332 return g.findUEdge(u, v, prev); 333 } 334 335 template <typename Graph> 336 inline typename Graph::UEdge 337 _findUEdge(Wrap<Graph> w, 338 338 typename Graph::Node u, 339 339 typename Graph::Node v, 340 typename Graph::U ndirEdge prev = INVALID) {340 typename Graph::UEdge prev = INVALID) { 341 341 const Graph& g = w.value; 342 342 if (prev == INVALID) { … … 351 351 } 352 352 353 /// \brief Finds an u ndiredge between two nodes of a graph.354 /// 355 /// Finds an u ndiredge from node \c u to node \c v in graph \c g.353 /// \brief Finds an uedge between two nodes of a graph. 354 /// 355 /// Finds an uedge from node \c u to node \c v in graph \c g. 356 356 /// 357 357 /// If \c prev is \ref INVALID (this is the default value), then … … 362 362 /// Thus you can iterate through each edge from \c u to \c v as it follows. 363 363 /// \code 364 /// for(U ndirEdge e = findUndirEdge(g,u,v); e != INVALID;365 /// e = findU ndirEdge(g,u,v,e)) {364 /// for(UEdge e = findUEdge(g,u,v); e != INVALID; 365 /// e = findUEdge(g,u,v,e)) { 366 366 /// ... 367 367 /// } … … 370 370 // /// interface here... 371 371 template <typename Graph> 372 inline typename Graph::U ndirEdge373 findU ndirEdge(const Graph &g,372 inline typename Graph::UEdge 373 findUEdge(const Graph &g, 374 374 typename Graph::Node u, 375 375 typename Graph::Node v, 376 typename Graph::U ndirEdge prev = INVALID) {377 return _findU ndirEdge<Graph>(g, u, v, prev);378 } 379 380 /// \brief Iterator for iterating on u ndiredges connected the same nodes.381 /// 382 /// Iterator for iterating on u ndiredges connected the same nodes. It is383 /// higher level interface for the findU ndirEdge() function. You can376 typename Graph::UEdge prev = INVALID) { 377 return _findUEdge<Graph>(g, u, v, prev); 378 } 379 380 /// \brief Iterator for iterating on uedges connected the same nodes. 381 /// 382 /// Iterator for iterating on uedges connected the same nodes. It is 383 /// higher level interface for the findUEdge() function. You can 384 384 /// use it the following way: 385 385 /// \code 386 /// for (ConU ndirEdgeIt<Graph> it(g, src, trg); it != INVALID; ++it) {386 /// for (ConUEdgeIt<Graph> it(g, src, trg); it != INVALID; ++it) { 387 387 /// ... 388 388 /// } … … 391 391 /// \author Balazs Dezso 392 392 template <typename _Graph> 393 class ConU ndirEdgeIt : public _Graph::UndirEdge {393 class ConUEdgeIt : public _Graph::UEdge { 394 394 public: 395 395 396 396 typedef _Graph Graph; 397 typedef typename Graph::U ndirEdge Parent;398 399 typedef typename Graph::U ndirEdge UndirEdge;397 typedef typename Graph::UEdge Parent; 398 399 typedef typename Graph::UEdge UEdge; 400 400 typedef typename Graph::Node Node; 401 401 402 402 /// \brief Constructor. 403 403 /// 404 /// Construct a new ConU ndirEdgeIt iterating on the edges which404 /// Construct a new ConUEdgeIt iterating on the edges which 405 405 /// connects the \c u and \c v node. 406 ConU ndirEdgeIt(const Graph& g, Node u, Node v) : graph(g) {407 Parent::operator=(findU ndirEdge(graph, u, v));406 ConUEdgeIt(const Graph& g, Node u, Node v) : graph(g) { 407 Parent::operator=(findUEdge(graph, u, v)); 408 408 } 409 409 410 410 /// \brief Constructor. 411 411 /// 412 /// Construct a new ConU ndirEdgeIt which continues the iterating from412 /// Construct a new ConUEdgeIt which continues the iterating from 413 413 /// the \c e edge. 414 ConU ndirEdgeIt(const Graph& g, UndirEdge e) : Parent(e), graph(g) {}414 ConUEdgeIt(const Graph& g, UEdge e) : Parent(e), graph(g) {} 415 415 416 416 /// \brief Increment operator. 417 417 /// 418 418 /// It increments the iterator and gives back the next edge. 419 ConU ndirEdgeIt& operator++() {420 Parent::operator=(findU ndirEdge(graph, graph.source(*this),419 ConUEdgeIt& operator++() { 420 Parent::operator=(findUEdge(graph, graph.source(*this), 421 421 graph.target(*this), *this)); 422 422 return *this; … … 597 597 /// 598 598 /// Class to copy an undirected graph to an other graph (duplicate a graph). 599 /// The simplest way of using it is through the \c copyU ndirGraph() function.599 /// The simplest way of using it is through the \c copyUGraph() function. 600 600 template <typename Target, typename Source> 601 class U ndirGraphCopy {601 class UGraphCopy { 602 602 public: 603 603 typedef typename Source::Node Node; … … 605 605 typedef typename Source::Edge Edge; 606 606 typedef typename Source::EdgeIt EdgeIt; 607 typedef typename Source::U ndirEdge UndirEdge;608 typedef typename Source::U ndirEdgeIt UndirEdgeIt;607 typedef typename Source::UEdge UEdge; 608 typedef typename Source::UEdgeIt UEdgeIt; 609 609 610 610 typedef typename Source:: … … 612 612 613 613 typedef typename Source:: 614 template U ndirEdgeMap<typename Target::UndirEdge> UndirEdgeRefMap;614 template UEdgeMap<typename Target::UEdge> UEdgeRefMap; 615 615 616 616 private: 617 617 618 618 struct EdgeRefMap { 619 EdgeRefMap(U ndirGraphCopy& _gc) : gc(_gc) {}619 EdgeRefMap(UGraphCopy& _gc) : gc(_gc) {} 620 620 typedef typename Source::Edge Key; 621 621 typedef typename Target::Edge Value; 622 622 623 623 Value operator[](const Key& key) { 624 return gc.target.direct(gc.u ndirEdgeRef[key],624 return gc.target.direct(gc.uEdgeRef[key], 625 625 gc.target.direction(key)); 626 626 } 627 627 628 U ndirGraphCopy& gc;628 UGraphCopy& gc; 629 629 }; 630 630 631 631 public: 632 632 633 /// \brief Constructor for the U ndirGraphCopy.633 /// \brief Constructor for the UGraphCopy. 634 634 /// 635 635 /// It copies the content of the \c _source graph into the 636 636 /// \c _target graph. It creates also two references, one beetween 637 637 /// the two nodeset and one beetween the two edgesets. 638 U ndirGraphCopy(Target& _target, const Source& _source)638 UGraphCopy(Target& _target, const Source& _source) 639 639 : source(_source), target(_target), 640 nodeRefMap(_source), edgeRefMap(*this), u ndirEdgeRefMap(_source) {640 nodeRefMap(_source), edgeRefMap(*this), uEdgeRefMap(_source) { 641 641 for (NodeIt it(source); it != INVALID; ++it) { 642 642 nodeRefMap[it] = target.addNode(); 643 643 } 644 for (U ndirEdgeIt it(source); it != INVALID; ++it) {645 u ndirEdgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)],644 for (UEdgeIt it(source); it != INVALID; ++it) { 645 uEdgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)], 646 646 nodeRefMap[source.target(it)]); 647 647 } … … 652 652 /// Copies the node references into the given map. 653 653 template <typename NodeRef> 654 const U ndirGraphCopy& nodeRef(NodeRef& map) const {654 const UGraphCopy& nodeRef(NodeRef& map) const { 655 655 for (NodeIt it(source); it != INVALID; ++it) { 656 656 map.set(it, nodeRefMap[it]); … … 663 663 /// Reverse and copies the node references into the given map. 664 664 template <typename NodeRef> 665 const U ndirGraphCopy& nodeCrossRef(NodeRef& map) const {665 const UGraphCopy& nodeCrossRef(NodeRef& map) const { 666 666 for (NodeIt it(source); it != INVALID; ++it) { 667 667 map.set(nodeRefMap[it], it); … … 674 674 /// Copies the edge references into the given map. 675 675 template <typename EdgeRef> 676 const U ndirGraphCopy& edgeRef(EdgeRef& map) const {676 const UGraphCopy& edgeRef(EdgeRef& map) const { 677 677 for (EdgeIt it(source); it != INVALID; ++it) { 678 678 map.set(edgeRefMap[it], it); … … 686 686 /// Reverse and copies the undirected edge references into the given map. 687 687 template <typename EdgeRef> 688 const U ndirGraphCopy& edgeCrossRef(EdgeRef& map) const {688 const UGraphCopy& edgeCrossRef(EdgeRef& map) const { 689 689 for (EdgeIt it(source); it != INVALID; ++it) { 690 690 map.set(it, edgeRefMap[it]); … … 697 697 /// Copies the undirected edge references into the given map. 698 698 template <typename EdgeRef> 699 const U ndirGraphCopy& undirEdgeRef(EdgeRef& map) const {700 for (U ndirEdgeIt it(source); it != INVALID; ++it) {701 map.set(it, u ndirEdgeRefMap[it]);699 const UGraphCopy& uEdgeRef(EdgeRef& map) const { 700 for (UEdgeIt it(source); it != INVALID; ++it) { 701 map.set(it, uEdgeRefMap[it]); 702 702 } 703 703 return *this; … … 709 709 /// Reverse and copies the undirected edge references into the given map. 710 710 template <typename EdgeRef> 711 const U ndirGraphCopy& undirEdgeCrossRef(EdgeRef& map) const {712 for (U ndirEdgeIt it(source); it != INVALID; ++it) {713 map.set(u ndirEdgeRefMap[it], it);711 const UGraphCopy& uEdgeCrossRef(EdgeRef& map) const { 712 for (UEdgeIt it(source); it != INVALID; ++it) { 713 map.set(uEdgeRefMap[it], it); 714 714 } 715 715 return *this; … … 723 723 /// type. 724 724 template <typename TargetMap, typename SourceMap> 725 const U ndirGraphCopy& nodeMap(TargetMap& tMap,725 const UGraphCopy& nodeMap(TargetMap& tMap, 726 726 const SourceMap& sMap) const { 727 727 copyMap(tMap, sMap, NodeIt(source), nodeRefMap); … … 736 736 /// type. 737 737 template <typename TargetMap, typename SourceMap> 738 const U ndirGraphCopy& edgeMap(TargetMap& tMap,738 const UGraphCopy& edgeMap(TargetMap& tMap, 739 739 const SourceMap& sMap) const { 740 740 copyMap(tMap, sMap, EdgeIt(source), edgeRefMap); … … 749 749 /// type. 750 750 template <typename TargetMap, typename SourceMap> 751 const U ndirGraphCopy& undirEdgeMap(TargetMap& tMap,751 const UGraphCopy& uEdgeMap(TargetMap& tMap, 752 752 const SourceMap& sMap) const { 753 copyMap(tMap, sMap, U ndirEdgeIt(source), undirEdgeRefMap);753 copyMap(tMap, sMap, UEdgeIt(source), uEdgeRefMap); 754 754 return *this; 755 755 } … … 769 769 } 770 770 771 /// \brief Gives back the stored u ndiredge references.772 /// 773 /// Gives back the stored u ndiredge references.774 const U ndirEdgeRefMap& undirEdgeRef() const {775 return u ndirEdgeRefMap;771 /// \brief Gives back the stored uedge references. 772 /// 773 /// Gives back the stored uedge references. 774 const UEdgeRefMap& uEdgeRef() const { 775 return uEdgeRefMap; 776 776 } 777 777 … … 785 785 NodeRefMap nodeRefMap; 786 786 EdgeRefMap edgeRefMap; 787 U ndirEdgeRefMap undirEdgeRefMap;787 UEdgeRefMap uEdgeRefMap; 788 788 }; 789 789 … … 802 802 /// edges. 803 803 template <typename Target, typename Source> 804 U ndirGraphCopy<Target, Source>805 copyU ndirGraph(Target& target, const Source& source) {806 return U ndirGraphCopy<Target, Source>(target, source);804 UGraphCopy<Target, Source> 805 copyUGraph(Target& target, const Source& source) { 806 return UGraphCopy<Target, Source>(target, source); 807 807 } 808 808 … … 906 906 typedef _Graph Graph; 907 907 908 /// The key type of InvertableMap (Node, Edge, U ndirEdge).908 /// The key type of InvertableMap (Node, Edge, UEdge). 909 909 typedef typename _Map::Key Key; 910 910 /// The value type of the InvertableMap. … … 1037 1037 /// \param _Graph The graph class the \c DescriptorMap belongs to. 1038 1038 /// \param _Item The Item is the Key of the Map. It may be Node, Edge or 1039 /// U ndirEdge.1039 /// UEdge. 1040 1040 #ifndef DOXYGEN 1041 1041 /// \param _Map A ReadWriteMap mapping from the item type to integer. … … 1056 1056 typedef _Graph Graph; 1057 1057 1058 /// The key type of DescriptorMap (Node, Edge, U ndirEdge).1058 /// The key type of DescriptorMap (Node, Edge, UEdge). 1059 1059 typedef typename _Map::Key Key; 1060 1060 /// The value type of DescriptorMap. … … 1297 1297 1298 1298 typedef typename Graph::Edge Value; 1299 typedef typename Graph::U ndirEdge Key;1299 typedef typename Graph::UEdge Key; 1300 1300 1301 1301 /// \brief Constructor … … 1336 1336 1337 1337 typedef typename Graph::Edge Value; 1338 typedef typename Graph::U ndirEdge Key;1338 typedef typename Graph::UEdge Key; 1339 1339 1340 1340 /// \brief Constructor -
lemon/graph_writer.h
r1901 r1909 316 316 /// \brief The undirected graph writer class. 317 317 /// 318 /// The \c U ndirGraphWriter class provides the undirgraph output. To write318 /// The \c UGraphWriter class provides the ugraph output. To write 319 319 /// a graph you should first give writing commands to the writer. You can 320 /// declare write command as \c NodeMap, \c EdgeMap or \c U ndirEdgeMap321 /// writing and labeled Node, Edge or U ndirEdge writing.322 /// 323 /// \code 324 /// U ndirGraphWriter<UndirListGraph> writer(std::cout, graph);320 /// declare write command as \c NodeMap, \c EdgeMap or \c UEdgeMap 321 /// writing and labeled Node, Edge or UEdge writing. 322 /// 323 /// \code 324 /// UGraphWriter<ListUGraph> writer(std::cout, graph); 325 325 /// \endcode 326 326 /// 327 327 /// The \c writeNodeMap() function declares a \c NodeMap writing 328 /// command in the \c U ndirGraphWriter. You should give as parameter328 /// command in the \c UGraphWriter. You should give as parameter 329 329 /// the name of the map and the map object. The NodeMap writing 330 330 /// command with name "label" should write a unique map because it … … 332 332 /// 333 333 /// \code 334 /// IdMap< UndirListGraph, Node> nodeLabelMap;334 /// IdMap<ListUGraph, Node> nodeLabelMap; 335 335 /// writer.writeNodeMap("label", nodeLabelMap); 336 336 /// … … 339 339 /// \endcode 340 340 /// 341 /// With the \c writeU ndirEdgeMap() member function you can give an341 /// With the \c writeUEdgeMap() member function you can give an 342 342 /// undirected edge map writing command similar to the NodeMaps. 343 343 /// … … 345 345 /// DescriptorMap<ListGraph, Edge, ListGraph::EdgeMap<int> > 346 346 /// edgeDescMap(graph); 347 /// writer.writeU ndirEdgeMap("descriptor", edgeDescMap);348 /// 349 /// writer.writeU ndirEdgeMap("weight", weightMap);350 /// writer.writeU ndirEdgeMap("label", labelMap);347 /// writer.writeUEdgeMap("descriptor", edgeDescMap); 348 /// 349 /// writer.writeUEdgeMap("weight", weightMap); 350 /// writer.writeUEdgeMap("label", labelMap); 351 351 /// \endcode 352 352 /// … … 359 359 /// 360 360 /// 361 /// With \c writeNode() and \c writeU ndirEdge() functions you can361 /// With \c writeNode() and \c writeUEdge() functions you can 362 362 /// designate nodes and undirected edges in the graph. For example, you can 363 363 /// write out the source and target of the graph. … … 367 367 /// writer.writeNode("target", targetNode); 368 368 /// 369 /// writer.writeU ndirEdge("observed", undirEdge);369 /// writer.writeUEdge("observed", uEdge); 370 370 /// \endcode 371 371 /// … … 385 385 /// \author Balazs Dezso 386 386 template <typename _Graph, typename _WriterTraits = DefaultWriterTraits> 387 class U ndirGraphWriter {387 class UGraphWriter { 388 388 public: 389 389 … … 391 391 typedef typename Graph::Node Node; 392 392 typedef typename Graph::Edge Edge; 393 typedef typename Graph::U ndirEdge UndirEdge;393 typedef typename Graph::UEdge UEdge; 394 394 395 395 typedef _WriterTraits WriterTraits; 396 396 397 /// \brief Construct a new U ndirGraphWriter.398 /// 399 /// Construct a new U ndirGraphWriter. It writes the given graph397 /// \brief Construct a new UGraphWriter. 398 /// 399 /// Construct a new UGraphWriter. It writes the given graph 400 400 /// to the given stream. 401 U ndirGraphWriter(std::ostream& _os, const Graph& _graph)401 UGraphWriter(std::ostream& _os, const Graph& _graph) 402 402 : writer(new LemonWriter(_os)), own_writer(true), 403 403 nodeset_writer(*writer, _graph, std::string()), 404 u ndir_edgeset_writer(*writer, _graph, nodeset_writer, std::string()),404 u_edgeset_writer(*writer, _graph, nodeset_writer, std::string()), 405 405 node_writer(*writer, nodeset_writer, std::string()), 406 u ndir_edge_writer(*writer, undir_edgeset_writer, std::string()),406 u_edge_writer(*writer, u_edgeset_writer, std::string()), 407 407 attribute_writer(*writer, std::string()) {} 408 408 409 /// \brief Construct a new U ndirGraphWriter.410 /// 411 /// Construct a new U ndirGraphWriter. It writes the given graph409 /// \brief Construct a new UGraphWriter. 410 /// 411 /// Construct a new UGraphWriter. It writes the given graph 412 412 /// to the given file. 413 U ndirGraphWriter(const std::string& _filename, const Graph& _graph)413 UGraphWriter(const std::string& _filename, const Graph& _graph) 414 414 : writer(new LemonWriter(_filename)), own_writer(true), 415 415 nodeset_writer(*writer, _graph, std::string()), 416 u ndir_edgeset_writer(*writer, _graph, nodeset_writer, std::string()),416 u_edgeset_writer(*writer, _graph, nodeset_writer, std::string()), 417 417 node_writer(*writer, nodeset_writer, std::string()), 418 u ndir_edge_writer(*writer, undir_edgeset_writer, std::string()),418 u_edge_writer(*writer, u_edgeset_writer, std::string()), 419 419 attribute_writer(*writer, std::string()) {} 420 420 421 /// \brief Construct a new U ndirGraphWriter.422 /// 423 /// Construct a new U ndirGraphWriter. It writes the given graph421 /// \brief Construct a new UGraphWriter. 422 /// 423 /// Construct a new UGraphWriter. It writes the given graph 424 424 /// to given LemonReader. 425 U ndirGraphWriter(LemonWriter& _writer, const Graph& _graph)425 UGraphWriter(LemonWriter& _writer, const Graph& _graph) 426 426 : writer(_writer), own_writer(false), 427 427 nodeset_writer(*writer, _graph, std::string()), 428 u ndir_edgeset_writer(*writer, _graph, nodeset_writer, std::string()),428 u_edgeset_writer(*writer, _graph, nodeset_writer, std::string()), 429 429 node_writer(*writer, nodeset_writer, std::string()), 430 u ndir_edge_writer(*writer, undir_edgeset_writer, std::string()),430 u_edge_writer(*writer, u_edgeset_writer, std::string()), 431 431 attribute_writer(*writer, std::string()) {} 432 432 … … 434 434 /// 435 435 /// Destruct the graph writer. 436 ~U ndirGraphWriter() {436 ~UGraphWriter() { 437 437 if (own_writer) 438 438 delete writer; … … 443 443 /// This function issues a new <i> node map writing command</i> to the writer. 444 444 template <typename Map> 445 U ndirGraphWriter& writeNodeMap(std::string name, const Map& map) {445 UGraphWriter& writeNodeMap(std::string name, const Map& map) { 446 446 nodeset_writer.writeNodeMap(name, map); 447 447 return *this; … … 452 452 /// This function issues a new <i> node map writing command</i> to the writer. 453 453 template <typename Writer, typename Map> 454 U ndirGraphWriter& writeNodeMap(std::string name, const Map& map,454 UGraphWriter& writeNodeMap(std::string name, const Map& map, 455 455 const Writer& writer = Writer()) { 456 456 nodeset_writer.writeNodeMap(name, map, writer); … … 462 462 /// This function issues a new <i> edge map writing command</i> to the writer. 463 463 template <typename Map> 464 U ndirGraphWriter& writeEdgeMap(std::string name, const Map& map) {465 u ndir_edgeset_writer.writeEdgeMap(name, map);464 UGraphWriter& writeEdgeMap(std::string name, const Map& map) { 465 u_edgeset_writer.writeEdgeMap(name, map); 466 466 return *this; 467 467 } … … 471 471 /// This function issues a new <i> edge map writing command</i> to the writer. 472 472 template <typename Writer, typename Map> 473 U ndirGraphWriter& writeEdgeMap(std::string name, const Map& map,473 UGraphWriter& writeEdgeMap(std::string name, const Map& map, 474 474 const Writer& writer = Writer()) { 475 u ndir_edgeset_writer.writeEdgeMap(name, map, writer);475 u_edgeset_writer.writeEdgeMap(name, map, writer); 476 476 return *this; 477 477 } … … 482 482 /// command</i> to the writer. 483 483 template <typename Map> 484 U ndirGraphWriter& writeUndirEdgeMap(std::string name, const Map& map) {485 u ndir_edgeset_writer.writeUndirEdgeMap(name, map);484 UGraphWriter& writeUEdgeMap(std::string name, const Map& map) { 485 u_edgeset_writer.writeUEdgeMap(name, map); 486 486 return *this; 487 487 } … … 492 492 /// command</i> to the writer. 493 493 template <typename Writer, typename Map> 494 U ndirGraphWriter& writeUndirEdgeMap(std::string name, const Map& map,494 UGraphWriter& writeUEdgeMap(std::string name, const Map& map, 495 495 const Writer& writer = Writer()) { 496 u ndir_edgeset_writer.writeUndirEdgeMap(name, map, writer);496 u_edgeset_writer.writeUEdgeMap(name, map, writer); 497 497 return *this; 498 498 } … … 502 502 /// This function issues a new <i> labeled node writing 503 503 /// command</i> to the writer. 504 U ndirGraphWriter& writeNode(std::string name, const Node& node) {504 UGraphWriter& writeNode(std::string name, const Node& node) { 505 505 node_writer.writeNode(name, node); 506 506 return *this; … … 511 511 /// This function issues a new <i> labeled edge writing 512 512 /// command</i> to the writer. 513 U ndirGraphWriter& writeEdge(std::string name, const Edge& edge) {514 u ndir_edge_writer.writeEdge(name, edge);513 UGraphWriter& writeEdge(std::string name, const Edge& edge) { 514 u_edge_writer.writeEdge(name, edge); 515 515 } 516 516 … … 520 520 /// Issue a new <i>labeled undirected edge writing command</i> to 521 521 /// the writer. 522 U ndirGraphWriter& writeUndirEdge(std::string name, const UndirEdge& edge) {523 u ndir_edge_writer.writeUndirEdge(name, edge);522 UGraphWriter& writeUEdge(std::string name, const UEdge& edge) { 523 u_edge_writer.writeUEdge(name, edge); 524 524 } 525 525 … … 529 529 /// command</i> to the writer. 530 530 template <typename Value> 531 U ndirGraphWriter& writeAttribute(std::string name, const Value& value) {531 UGraphWriter& writeAttribute(std::string name, const Value& value) { 532 532 attribute_writer.writeAttribute(name, value); 533 533 return *this; … … 539 539 /// command</i> to the writer. 540 540 template <typename Writer, typename Value> 541 U ndirGraphWriter& writeAttribute(std::string name, const Value& value,541 UGraphWriter& writeAttribute(std::string name, const Value& value, 542 542 const Writer& writer) { 543 543 attribute_writer.writeAttribute<Writer>(name, value, writer); … … 575 575 /// named edge map then it will write the map value belonging to the edge. 576 576 void writeLabel(std::ostream& os, const Edge& item) const { 577 u ndir_edgeset_writer.writeLabel(os, item);577 u_edgeset_writer.writeLabel(os, item); 578 578 } 579 579 … … 583 583 /// an "label" named edge map then it will write the map value belonging to 584 584 /// the edge. 585 void writeLabel(std::ostream& os, const U ndirEdge& item) const {586 u ndir_edgeset_writer.writeLabel(os, item);585 void writeLabel(std::ostream& os, const UEdge& item) const { 586 u_edgeset_writer.writeLabel(os, item); 587 587 } 588 588 … … 594 594 595 595 NodeSetWriter<Graph, WriterTraits> nodeset_writer; 596 U ndirEdgeSetWriter<Graph, WriterTraits> undir_edgeset_writer;596 UEdgeSetWriter<Graph, WriterTraits> u_edgeset_writer; 597 597 598 598 NodeWriter<Graph> node_writer; 599 U ndirEdgeWriter<Graph> undir_edge_writer;599 UEdgeWriter<Graph> u_edge_writer; 600 600 601 601 AttributeWriter<WriterTraits> attribute_writer; … … 605 605 /// 606 606 /// It is a helper function to write an undirected graph to the given output 607 /// stream. It gives back an U ndirGraphWriter object and this object607 /// stream. It gives back an UGraphWriter object and this object 608 608 /// can write more maps, labeled nodes and edges and attributes. 609 609 /// \warning Do not forget to call the \c run() function. … … 612 612 /// \param g The graph. 613 613 template <typename Graph> 614 U ndirGraphWriter<Graph> undirGraphWriter(std::ostream& os, const Graph &g) {615 return U ndirGraphWriter<Graph>(os, g);614 UGraphWriter<Graph> uGraphWriter(std::ostream& os, const Graph &g) { 615 return UGraphWriter<Graph>(os, g); 616 616 } 617 617 … … 619 619 /// 620 620 /// It is a helper function to write an undirected graph to the given output 621 /// file. It gives back an U ndirGraphWriter object and this object621 /// file. It gives back an UGraphWriter object and this object 622 622 /// can write more maps, labeled nodes, edges, undirected edges and 623 623 /// attributes. … … 628 628 /// \param g The graph. 629 629 template <typename Graph> 630 U ndirGraphWriter<Graph> undirGraphWriter(const std::string& fn,630 UGraphWriter<Graph> uGraphWriter(const std::string& fn, 631 631 const Graph &g) { 632 return U ndirGraphWriter<Graph>(fn, g);632 return UGraphWriter<Graph>(fn, g); 633 633 } 634 634 -
lemon/grid_graph.h
r1875 r1909 339 339 340 340 341 typedef StaticMappableU ndirGraphExtender<342 IterableU ndirGraphExtender<343 AlterableU ndirGraphExtender<344 U ndirGraphExtender<GridGraphBase> > > > ExtendedGridGraphBase;341 typedef StaticMappableUGraphExtender< 342 IterableUGraphExtender< 343 AlterableUGraphExtender< 344 UGraphExtender<GridGraphBase> > > > ExtendedGridGraphBase; 345 345 346 346 /// \ingroup graphs … … 365 365 /// \endcode 366 366 /// 367 /// The graph type is fully conform to the \ref concept::U ndirGraph367 /// The graph type is fully conform to the \ref concept::UGraph 368 368 /// "Undirected Graph" concept. 369 369 /// … … 464 464 /// outgoing edge then it gives back INVALID. 465 465 Edge down(Node n) const { 466 U ndirEdge ue = _down(n);466 UEdge ue = _down(n); 467 467 return ue != INVALID ? direct(ue, true) : INVALID; 468 468 } … … 473 473 /// outgoing edge then it gives back INVALID. 474 474 Edge up(Node n) const { 475 U ndirEdge ue = _up(n);475 UEdge ue = _up(n); 476 476 return ue != INVALID ? direct(ue, false) : INVALID; 477 477 } … … 482 482 /// outgoing edge then it gives back INVALID. 483 483 Edge right(Node n) const { 484 U ndirEdge ue = _right(n);484 UEdge ue = _right(n); 485 485 return ue != INVALID ? direct(ue, true) : INVALID; 486 486 } … … 491 491 /// outgoing edge then it gives back INVALID. 492 492 Edge left(Node n) const { 493 U ndirEdge ue = _left(n);493 UEdge ue = _left(n); 494 494 return ue != INVALID ? direct(ue, false) : INVALID; 495 495 } -
lemon/hypercube_graph.h
r1875 r1909 255 255 /// 256 256 /// The graph type is fully conform to the \ref concept::StaticGraph 257 /// concept but it does not conform to the \ref concept::U ndirGraph.257 /// concept but it does not conform to the \ref concept::UGraph. 258 258 /// 259 259 /// \see HyperCubeGraphBase -
lemon/kruskal.h
r1875 r1909 52 52 /// \param g The graph the algorithm runs on. 53 53 /// It can be either \ref concept::StaticGraph "directed" or 54 /// \ref concept::U ndirGraph "undirected".54 /// \ref concept::UGraph "undirected". 55 55 /// If the graph is directed, the algorithm consider it to be 56 56 /// undirected by disregarding the direction of the edges. … … 90 90 /// 91 91 /// \warning If kruskal is run on an 92 /// \ref lemon::concept::U ndirGraph "undirected graph", be sure that the92 /// \ref lemon::concept::UGraph "undirected graph", be sure that the 93 93 /// map storing the tree is also undirected 94 /// (e.g. UndirListGraph::UndirEdgeMap<bool>, otherwise the values of the94 /// (e.g. ListUGraph::UEdgeMap<bool>, otherwise the values of the 95 95 /// half of the edges will not be set. 96 96 /// 97 97 /// \todo Discuss the case of undirected graphs: In this case the algorithm 98 /// also require <tt>Edge</tt>s instead of <tt>U ndirEdge</tt>s, as some98 /// also require <tt>Edge</tt>s instead of <tt>UEdge</tt>s, as some 99 99 /// people would expect. So, one should be careful not to add both of the 100 /// <tt>Edge</tt>s belonging to a certain <tt>U ndirEdge</tt>.100 /// <tt>Edge</tt>s belonging to a certain <tt>UEdge</tt>. 101 101 /// (\ref kruskal() and \ref KruskalMapInput are kind enough to do so.) 102 102 … … 226 226 227 227 template<class _GR> 228 typename enable_if<typename _GR::U ndirTag,void>::type228 typename enable_if<typename _GR::UTag,void>::type 229 229 fillWithEdges(const _GR& g, const Map& m,dummy<0> = 0) 230 230 { 231 for(typename GR::U ndirEdgeIt e(g);e!=INVALID;++e)231 for(typename GR::UEdgeIt e(g);e!=INVALID;++e) 232 232 push_back(value_type(g.direct(e, true), m[e])); 233 233 } 234 234 235 235 template<class _GR> 236 typename disable_if<typename _GR::U ndirTag,void>::type236 typename disable_if<typename _GR::UTag,void>::type 237 237 fillWithEdges(const _GR& g, const Map& m,dummy<1> = 1) 238 238 { -
lemon/lemon_reader.h
r1901 r1909 105 105 class ForwardComposeMap { 106 106 public: 107 typedef typename Graph::U ndirEdge Key;107 typedef typename Graph::UEdge Key; 108 108 typedef typename Map::Value Value; 109 109 … … 135 135 class BackwardComposeMap { 136 136 public: 137 typedef typename Graph::U ndirEdge Key;137 typedef typename Graph::UEdge Key; 138 138 typedef typename Map::Value Value; 139 139 … … 1168 1168 /// 1169 1169 /// The lemon format can store multiple undirected edgesets with several 1170 /// maps. The undirected edgeset section's header line is \c \@u ndiredgeset1171 /// \c u ndiredgeset_name, but the \c undiredgeset_name may be empty.1170 /// maps. The undirected edgeset section's header line is \c \@uedgeset 1171 /// \c uedgeset_name, but the \c uedgeset_name may be empty. 1172 1172 /// 1173 1173 /// The first line of the section contains the names of the maps separated … … 1184 1184 /// as id map. This map should contain only unique values and when the 1185 1185 /// \c readLabel() member will read a value from the given stream it will 1186 /// give back that u ndiricted edge which is mapped to this value.1186 /// give back that uicted edge which is mapped to this value. 1187 1187 /// 1188 1188 /// The undirected edgeset reader needs a node id reader to identify which … … 1192 1192 /// \relates LemonReader 1193 1193 template <typename _Graph, typename _Traits = DefaultReaderTraits> 1194 class U ndirEdgeSetReader : public LemonReader::SectionReader {1194 class UEdgeSetReader : public LemonReader::SectionReader { 1195 1195 typedef LemonReader::SectionReader Parent; 1196 1196 public: … … 1200 1200 typedef typename Graph::Node Node; 1201 1201 typedef typename Graph::Edge Edge; 1202 typedef typename Graph::U ndirEdge UndirEdge;1202 typedef typename Graph::UEdge UEdge; 1203 1203 typedef typename Traits::Skipper DefaultSkipper; 1204 1204 1205 1205 /// \brief Constructor. 1206 1206 /// 1207 /// Constructor for U ndirEdgeSetReader. It creates the UndirEdgeSetReader1207 /// Constructor for UEdgeSetReader. It creates the UEdgeSetReader 1208 1208 /// and attach it into the given LemonReader. The undirected edgeset 1209 1209 /// reader will add the readed undirected edges to the given Graph. It 1210 1210 /// will use the given node id reader to read the source and target 1211 1211 /// nodes of the edges. The reader will read the section only if the 1212 /// \c _name and the \c u ndiredgset_name are the same.1212 /// \c _name and the \c uedgset_name are the same. 1213 1213 template <typename NodeLabelReader> 1214 U ndirEdgeSetReader(LemonReader& _reader,1214 UEdgeSetReader(LemonReader& _reader, 1215 1215 Graph& _graph, 1216 1216 const NodeLabelReader& _nodeLabelReader, … … 1224 1224 /// \brief Destructor. 1225 1225 /// 1226 /// Destructor for U ndirEdgeSetReader.1227 virtual ~U ndirEdgeSetReader() {1226 /// Destructor for UEdgeSetReader. 1227 virtual ~UEdgeSetReader() { 1228 1228 for (typename MapReaders::iterator it = readers.begin(); 1229 1229 it != readers.end(); ++it) { … … 1233 1233 1234 1234 private: 1235 U ndirEdgeSetReader(const UndirEdgeSetReader&);1236 void operator=(const U ndirEdgeSetReader&);1235 UEdgeSetReader(const UEdgeSetReader&); 1236 void operator=(const UEdgeSetReader&); 1237 1237 1238 1238 public: … … 1242 1242 /// Add a new edge undirected map reader command for the reader. 1243 1243 template <typename Map> 1244 U ndirEdgeSetReader& readUndirEdgeMap(std::string name, Map& map) {1244 UEdgeSetReader& readUEdgeMap(std::string name, Map& map) { 1245 1245 return _readMap< 1246 1246 typename Traits::template Reader<typename Map::Value>, Map, … … 1249 1249 1250 1250 template <typename Map> 1251 U ndirEdgeSetReader& readUndirEdgeMap(std::string name, const Map& map) {1251 UEdgeSetReader& readUEdgeMap(std::string name, const Map& map) { 1252 1252 return _readMap< 1253 1253 typename Traits::template Reader<typename Map::Value>, Map, … … 1259 1259 /// Add a new edge undirected map reader command for the reader. 1260 1260 template <typename Reader, typename Map> 1261 U ndirEdgeSetReader& readUndirEdgeMap(std::string name, Map& map,1261 UEdgeSetReader& readUEdgeMap(std::string name, Map& map, 1262 1262 const Reader& reader = Reader()) { 1263 1263 return _readMap<Reader, Map, typename _reader_bits::Arg<Map>::Type> … … 1266 1266 1267 1267 template <typename Reader, typename Map> 1268 U ndirEdgeSetReader& readUndirEdgeMap(std::string name, const Map& map,1268 UEdgeSetReader& readUEdgeMap(std::string name, const Map& map, 1269 1269 const Reader& reader = Reader()) { 1270 1270 return _readMap<Reader, Map, typename _reader_bits::Arg<Map>::Type > … … 1275 1275 1276 1276 template <typename Reader, typename Map, typename MapParameter> 1277 U ndirEdgeSetReader& _readMap(std::string name, MapParameter map,1277 UEdgeSetReader& _readMap(std::string name, MapParameter map, 1278 1278 const Reader& reader = Reader()) { 1279 checkConcept<concept::WriteMap<U ndirEdge, typename Map::Value>, Map>();1279 checkConcept<concept::WriteMap<UEdge, typename Map::Value>, Map>(); 1280 1280 checkConcept<_reader_bits::ItemReader<typename Map::Value>, Reader>(); 1281 1281 if (readers.find(name) != readers.end()) { … … 1286 1286 readers.insert( 1287 1287 make_pair(name, new _reader_bits:: 1288 MapReader<U ndirEdge, Map, Reader>(map, reader)));1288 MapReader<UEdge, Map, Reader>(map, reader))); 1289 1289 return *this; 1290 1290 } … … 1296 1296 /// Add a new undirected edge map skipper command for the reader. 1297 1297 template <typename Reader> 1298 U ndirEdgeSetReader& skipUndirEdgeMap(std::string name,1298 UEdgeSetReader& skipUEdgeMap(std::string name, 1299 1299 const Reader& reader = Reader()) { 1300 1300 if (readers.find(name) != readers.end()) { … … 1304 1304 } 1305 1305 readers.insert(make_pair(name, new _reader_bits:: 1306 SkipReader<U ndirEdge, Reader>(reader)));1306 SkipReader<UEdge, Reader>(reader))); 1307 1307 return *this; 1308 1308 } … … 1312 1312 /// Add a new directed edge map reader command for the reader. 1313 1313 template <typename Map> 1314 U ndirEdgeSetReader& readEdgeMap(std::string name, Map& map) {1314 UEdgeSetReader& readEdgeMap(std::string name, Map& map) { 1315 1315 return _readDirMap< 1316 1316 typename Traits::template Reader<typename Map::Value>, Map, … … 1319 1319 1320 1320 template <typename Map> 1321 U ndirEdgeSetReader& readEdgeMap(std::string name, const Map& map) {1321 UEdgeSetReader& readEdgeMap(std::string name, const Map& map) { 1322 1322 return _readDirMap< 1323 1323 typename Traits::template Reader<typename Map::Value>, Map, … … 1329 1329 /// Add a new directed edge map reader command for the reader. 1330 1330 template <typename Reader, typename Map> 1331 U ndirEdgeSetReader& readEdgeMap(std::string name, Map& map,1331 UEdgeSetReader& readEdgeMap(std::string name, Map& map, 1332 1332 const Reader& reader = Reader()) { 1333 1333 return _readDirMap<Reader, Map, typename _reader_bits::Arg<Map>::Type> … … 1336 1336 1337 1337 template <typename Reader, typename Map> 1338 U ndirEdgeSetReader& readEdgeMap(std::string name, const Map& map,1338 UEdgeSetReader& readEdgeMap(std::string name, const Map& map, 1339 1339 const Reader& reader = Reader()) { 1340 1340 return _readDirMap<Reader, Map, typename _reader_bits::Arg<Map>::Type> … … 1345 1345 1346 1346 template <typename Reader, typename Map, typename MapParameter> 1347 U ndirEdgeSetReader& _readDirMap(std::string name, MapParameter map,1347 UEdgeSetReader& _readDirMap(std::string name, MapParameter map, 1348 1348 const Reader& reader = Reader()) { 1349 1349 checkConcept<_reader_bits::ItemReader<typename Map::Value>, Reader>(); … … 1362 1362 /// Add a new directed edge map skipper command for the reader. 1363 1363 template <typename Reader> 1364 U ndirEdgeSetReader& skipEdgeMap(std::string name,1364 UEdgeSetReader& skipEdgeMap(std::string name, 1365 1365 const Reader& reader = Reader()) { 1366 1366 skipMap("+" + name, reader); … … 1374 1374 /// the section with the given header line. 1375 1375 /// 1376 /// It gives back true when the header line starts with \c \@u ndiredgeset,1376 /// It gives back true when the header line starts with \c \@uedgeset, 1377 1377 /// and the header line's name and the edgeset's name are the same. 1378 1378 virtual bool header(const std::string& line) { … … 1381 1381 std::string id; 1382 1382 ls >> command >> name; 1383 return command == "@u ndiredgeset" && name == id;1383 return command == "@uedgeset" && name == id; 1384 1384 } 1385 1385 … … 1391 1391 throw DataFormatError("Cannot find nodeset or label map"); 1392 1392 } 1393 std::vector<_reader_bits::MapReaderBase<U ndirEdge>* > index;1393 std::vector<_reader_bits::MapReaderBase<UEdge>* > index; 1394 1394 std::string line; 1395 1395 … … 1422 1422 Node from = nodeLabelReader->read(ls); 1423 1423 Node to = nodeLabelReader->read(ls); 1424 U ndirEdge edge = graph.addEdge(from, to);1424 UEdge edge = graph.addEdge(from, to); 1425 1425 for (int i = 0; i < (int)index.size(); ++i) { 1426 1426 index[i]->read(ls, edge); … … 1443 1443 /// It reads an id from the stream and gives back which undirected edge 1444 1444 /// belongs to it. It is possible only if there was read an "label" named map. 1445 void readLabel(std::istream& is, U ndirEdge& undirEdge) const {1446 u ndirEdge = inverter->read(is);1445 void readLabel(std::istream& is, UEdge& uEdge) const { 1446 uEdge = inverter->read(is); 1447 1447 } 1448 1448 … … 1456 1456 char c; 1457 1457 is >> c; 1458 U ndirEdge undirEdge = inverter->read(is);1458 UEdge uEdge = inverter->read(is); 1459 1459 if (c == '+') { 1460 edge = graph.direct(u ndirEdge, true);1460 edge = graph.direct(uEdge, true); 1461 1461 } else if (c == '-') { 1462 edge = graph.direct(u ndirEdge, false);1462 edge = graph.direct(uEdge, false); 1463 1463 } else { 1464 1464 throw DataFormatError("Wrong id format for edge " … … 1470 1470 1471 1471 typedef std::map<std::string, 1472 _reader_bits::MapReaderBase<U ndirEdge>*> MapReaders;1472 _reader_bits::MapReaderBase<UEdge>*> MapReaders; 1473 1473 MapReaders readers; 1474 1474 1475 1475 Graph& graph; 1476 1476 std::string name; 1477 _reader_bits::SkipReader<U ndirEdge, DefaultSkipper> skipper;1478 1479 std::auto_ptr<_reader_bits::MapInverterBase<U ndirEdge> > inverter;1477 _reader_bits::SkipReader<UEdge, DefaultSkipper> skipper; 1478 1479 std::auto_ptr<_reader_bits::MapInverterBase<UEdge> > inverter; 1480 1480 std::auto_ptr<_reader_bits::LabelReaderBase<Node> > nodeLabelReader; 1481 1481 }; … … 1697 1697 /// \brief SectionReader for reading labeled undirected edges. 1698 1698 /// 1699 /// The undirected edges section's header line is \c \@u ndiredges1700 /// \c u ndiredges_name, but the \c undiredges_name may be empty.1699 /// The undirected edges section's header line is \c \@uedges 1700 /// \c uedges_name, but the \c uedges_name may be empty. 1701 1701 /// 1702 1702 /// Each line in the section contains the name of the undirected edge … … 1705 1705 /// \relates LemonReader 1706 1706 template <typename _Graph> 1707 class U ndirEdgeReader : public LemonReader::SectionReader {1707 class UEdgeReader : public LemonReader::SectionReader { 1708 1708 typedef LemonReader::SectionReader Parent; 1709 1709 typedef _Graph Graph; 1710 1710 typedef typename Graph::Edge Edge; 1711 typedef typename Graph::U ndirEdge UndirEdge;1711 typedef typename Graph::UEdge UEdge; 1712 1712 public: 1713 1713 1714 1714 /// \brief Constructor. 1715 1715 /// 1716 /// Constructor for U ndirEdgeReader. It creates the UndirEdgeReader and1716 /// Constructor for UEdgeReader. It creates the UEdgeReader and 1717 1717 /// attach it into the given LemonReader. It will use the given 1718 1718 /// undirected edge id reader to give back the edges. The reader will 1719 /// read the section only if the \c _name and the \c u ndiredges_name are1719 /// read the section only if the \c _name and the \c uedges_name are 1720 1720 /// the same. 1721 1721 template <typename _LabelReader> 1722 U ndirEdgeReader(LemonReader& _reader, const _LabelReader& _labelReader,1722 UEdgeReader(LemonReader& _reader, const _LabelReader& _labelReader, 1723 1723 const std::string& _name = std::string()) 1724 1724 : Parent(_reader), name(_name) { 1725 checkConcept<_reader_bits::ItemLabelReader<U ndirEdge>, _LabelReader>();1725 checkConcept<_reader_bits::ItemLabelReader<UEdge>, _LabelReader>(); 1726 1726 checkConcept<_reader_bits::ItemLabelReader<Edge>, _LabelReader>(); 1727 u ndirEdgeLabelReader.reset(new _reader_bits::1728 LabelReader<U ndirEdge, _LabelReader>(_labelReader));1727 uEdgeLabelReader.reset(new _reader_bits:: 1728 LabelReader<UEdge, _LabelReader>(_labelReader)); 1729 1729 edgeLabelReader.reset(new _reader_bits:: 1730 1730 LabelReader<Edge, _LabelReader>(_labelReader)); … … 1733 1733 /// \brief Destructor. 1734 1734 /// 1735 /// Destructor for U ndirEdgeReader.1736 virtual ~U ndirEdgeReader() {}1735 /// Destructor for UEdgeReader. 1736 virtual ~UEdgeReader() {} 1737 1737 private: 1738 U ndirEdgeReader(const UndirEdgeReader&);1739 void operator=(const U ndirEdgeReader&);1740 1741 public: 1742 1743 /// \brief Add an undirected edge reader command for the U ndirEdgeReader.1744 /// 1745 /// Add an undirected edge reader command for the U ndirEdgeReader.1746 void readU ndirEdge(const std::string& name, UndirEdge& item) {1747 if (u ndirEdgeReaders.find(name) != undirEdgeReaders.end()) {1738 UEdgeReader(const UEdgeReader&); 1739 void operator=(const UEdgeReader&); 1740 1741 public: 1742 1743 /// \brief Add an undirected edge reader command for the UEdgeReader. 1744 /// 1745 /// Add an undirected edge reader command for the UEdgeReader. 1746 void readUEdge(const std::string& name, UEdge& item) { 1747 if (uEdgeReaders.find(name) != uEdgeReaders.end()) { 1748 1748 ErrorMessage msg; 1749 1749 msg << "Multiple read rule for undirected edge: " << name; 1750 1750 throw IOParameterError(msg.message()); 1751 1751 } 1752 u ndirEdgeReaders.insert(make_pair(name, _reader_bits::1753 ItemStore<U ndirEdge>(item)));1754 } 1755 1756 /// \brief Add an edge reader command for the U ndirEdgeReader.1757 /// 1758 /// Add an edge reader command for the U ndirEdgeReader.1752 uEdgeReaders.insert(make_pair(name, _reader_bits:: 1753 ItemStore<UEdge>(item))); 1754 } 1755 1756 /// \brief Add an edge reader command for the UEdgeReader. 1757 /// 1758 /// Add an edge reader command for the UEdgeReader. 1759 1759 void readEdge(const std::string& name, Edge& item) { 1760 1760 if (edgeReaders.find(name) != edgeReaders.end()) { … … 1778 1778 std::string id; 1779 1779 ls >> command >> name; 1780 return command == "@u ndiredges" && name == id;1780 return command == "@uedges" && name == id; 1781 1781 } 1782 1782 … … 1788 1788 throw DataFormatError("Cannot find undirected edgeset or label map"); 1789 1789 } 1790 if (!u ndirEdgeLabelReader->isLabelReader()) {1790 if (!uEdgeLabelReader->isLabelReader()) { 1791 1791 throw DataFormatError("Cannot find undirected edgeset or label map"); 1792 1792 } … … 1797 1797 ls >> id; 1798 1798 { 1799 typename U ndirEdgeReaders::iterator it = undirEdgeReaders.find(id);1800 if (it != u ndirEdgeReaders.end()) {1801 it->second.read(u ndirEdgeLabelReader->read(ls));1799 typename UEdgeReaders::iterator it = uEdgeReaders.find(id); 1800 if (it != uEdgeReaders.end()) { 1801 it->second.read(uEdgeLabelReader->read(ls)); 1802 1802 it->second.touch(); 1803 1803 continue; … … 1820 1820 } 1821 1821 } 1822 for (typename U ndirEdgeReaders::iterator it = undirEdgeReaders.begin();1823 it != u ndirEdgeReaders.end(); ++it) {1822 for (typename UEdgeReaders::iterator it = uEdgeReaders.begin(); 1823 it != uEdgeReaders.end(); ++it) { 1824 1824 if (!it->second.touched()) { 1825 1825 ErrorMessage msg; 1826 msg << "U ndirEdge not found in file: " << it->first;1826 msg << "UEdge not found in file: " << it->first; 1827 1827 throw IOParameterError(msg.message()); 1828 1828 } … … 1835 1835 1836 1836 typedef std::map<std::string, 1837 _reader_bits::ItemStore<U ndirEdge> > UndirEdgeReaders;1838 U ndirEdgeReaders undirEdgeReaders;1839 std::auto_ptr<_reader_bits::LabelReaderBase<U ndirEdge> > undirEdgeLabelReader;1837 _reader_bits::ItemStore<UEdge> > UEdgeReaders; 1838 UEdgeReaders uEdgeReaders; 1839 std::auto_ptr<_reader_bits::LabelReaderBase<UEdge> > uEdgeLabelReader; 1840 1840 1841 1841 typedef std::map<std::string, _reader_bits::ItemStore<Edge> > EdgeReaders; … … 2026 2026 /// 2027 2027 /// Gives back how many undirected edgesets are in the file. 2028 int u ndirEdgeSetNum() const {2029 return u ndiredgesets.size();2028 int uEdgeSetNum() const { 2029 return uedgesets.size(); 2030 2030 } 2031 2031 … … 2034 2034 /// 2035 2035 /// Gives back the name of undirected edgeset on the indiced position. 2036 std::string u ndirEdgeSetName(int index) const {2037 return u ndiredgesets[index].name;2036 std::string uEdgeSetName(int index) const { 2037 return uedgesets[index].name; 2038 2038 } 2039 2039 … … 2042 2042 /// 2043 2043 /// Gives back the map names of undirected edgeset on the indiced position. 2044 const std::vector<std::string>& u ndirEdgeSetMaps(int index) const {2045 return u ndiredgesets[index].items;2044 const std::vector<std::string>& uEdgeSetMaps(int index) const { 2045 return uedgesets[index].items; 2046 2046 } 2047 2047 … … 2096 2096 /// 2097 2097 /// Gives back how many labeled undirected edges section are in the file. 2098 int u ndirEdgesNum() const {2099 return u ndiredges.size();2098 int uEdgesNum() const { 2099 return uedges.size(); 2100 2100 } 2101 2101 … … 2105 2105 /// Gives back the name of labeled undirected edges section on the 2106 2106 /// indiced position. 2107 std::string u ndirEdgesName(int index) const {2108 return u ndiredges[index].name;2107 std::string uEdgesName(int index) const { 2108 return uedges[index].name; 2109 2109 } 2110 2110 … … 2114 2114 /// Gives back the names of the labeled undirected edges in the 2115 2115 /// indiced section. 2116 const std::vector<std::string>& u ndirEdgesItems(int index) const {2117 return u ndiredges[index].items;2116 const std::vector<std::string>& uEdgesItems(int index) const { 2117 return uedges[index].items; 2118 2118 } 2119 2119 … … 2161 2161 current = command; 2162 2162 edgesets.push_back(SectionInfo(name)); 2163 } else if (command == "@u ndiredgeset") {2163 } else if (command == "@uedgeset") { 2164 2164 current = command; 2165 u ndiredgesets.push_back(SectionInfo(name));2165 uedgesets.push_back(SectionInfo(name)); 2166 2166 } else if (command == "@nodes") { 2167 2167 current = command; … … 2170 2170 current = command; 2171 2171 edges.push_back(SectionInfo(name)); 2172 } else if (command == "@u ndiredges") {2172 } else if (command == "@uedges") { 2173 2173 current = command; 2174 u ndiredges.push_back(SectionInfo(name));2174 uedges.push_back(SectionInfo(name)); 2175 2175 } else if (command == "@attributes") { 2176 2176 current = command; … … 2191 2191 } else if (current == "@edgeset") { 2192 2192 readMapNames(is, edgesets.back().items); 2193 } else if (current == "@u ndiredgeset") {2194 readMapNames(is, u ndiredgesets.back().items);2193 } else if (current == "@uedgeset") { 2194 readMapNames(is, uedgesets.back().items); 2195 2195 } else if (current == "@nodes") { 2196 2196 readItemNames(is, nodes.back().items); 2197 2197 } else if (current == "@edges") { 2198 2198 readItemNames(is, edges.back().items); 2199 } else if (current == "@u ndiredges") {2200 readItemNames(is, u ndiredges.back().items);2199 } else if (current == "@uedges") { 2200 readItemNames(is, uedges.back().items); 2201 2201 } else if (current == "@attributes") { 2202 2202 readItemNames(is, attributes.back().items); … … 2234 2234 std::vector<SectionInfo> nodesets; 2235 2235 std::vector<SectionInfo> edgesets; 2236 std::vector<SectionInfo> u ndiredgesets;2236 std::vector<SectionInfo> uedgesets; 2237 2237 2238 2238 std::vector<SectionInfo> nodes; 2239 2239 std::vector<SectionInfo> edges; 2240 std::vector<SectionInfo> u ndiredges;2240 std::vector<SectionInfo> uedges; 2241 2241 2242 2242 std::vector<SectionInfo> attributes; -
lemon/lemon_writer.h
r1901 r1909 92 92 class ForwardComposeMap { 93 93 public: 94 typedef typename Graph::U ndirEdge Key;94 typedef typename Graph::UEdge Key; 95 95 typedef typename Map::Value Value; 96 96 … … 116 116 class BackwardComposeMap { 117 117 public: 118 typedef typename Graph::U ndirEdge Key;118 typedef typename Graph::UEdge Key; 119 119 typedef typename Map::Value Value; 120 120 … … 709 709 /// 710 710 /// The lemon format can store multiple undirected edgesets with several 711 /// maps. The undirected edgeset section's header line is \c \@u ndiredgeset712 /// \c u ndiredgeset_name, but the \c undiredgeset_name may be empty.711 /// maps. The undirected edgeset section's header line is \c \@uedgeset 712 /// \c uedgeset_name, but the \c uedgeset_name may be empty. 713 713 /// 714 714 /// The first line of the section contains the names of the maps separated … … 735 735 /// \relates LemonWriter 736 736 template <typename _Graph, typename _Traits = DefaultWriterTraits> 737 class U ndirEdgeSetWriter : public LemonWriter::SectionWriter {737 class UEdgeSetWriter : public LemonWriter::SectionWriter { 738 738 typedef LemonWriter::SectionWriter Parent; 739 739 public: … … 743 743 typedef typename Graph::Node Node; 744 744 typedef typename Graph::Edge Edge; 745 typedef typename Graph::U ndirEdge UndirEdge;745 typedef typename Graph::UEdge UEdge; 746 746 747 747 /// \brief Constructor. 748 748 /// 749 /// Constructor for U ndirEdgeSetWriter. It creates the UndirEdgeSetWriter749 /// Constructor for UEdgeSetWriter. It creates the UEdgeSetWriter 750 750 /// and attach it into the given LemonWriter. It will write node labels by 751 751 /// the \c _nodeLabelWriter. If the \c _forceLabelMap parameter is true … … 753 753 /// "label" named map. 754 754 template <typename NodeLabelWriter> 755 U ndirEdgeSetWriter(LemonWriter& _writer, const Graph& _graph,755 UEdgeSetWriter(LemonWriter& _writer, const Graph& _graph, 756 756 const NodeLabelWriter& _nodeLabelWriter, 757 757 const std::string& _name = std::string(), … … 766 766 /// \brief Destructor. 767 767 /// 768 /// Destructor for U ndirEdgeSetWriter.769 virtual ~U ndirEdgeSetWriter() {768 /// Destructor for UEdgeSetWriter. 769 virtual ~UEdgeSetWriter() { 770 770 typename MapWriters::iterator it; 771 771 for (it = writers.begin(); it != writers.end(); ++it) { … … 775 775 776 776 private: 777 U ndirEdgeSetWriter(const UndirEdgeSetWriter&);778 void operator=(const U ndirEdgeSetWriter&);777 UEdgeSetWriter(const UEdgeSetWriter&); 778 void operator=(const UEdgeSetWriter&); 779 779 780 780 public: … … 784 784 /// Add a new undirected map writer command for the writer. 785 785 template <typename Map> 786 U ndirEdgeSetWriter& writeUndirEdgeMap(std::string name, const Map& map) {787 return writeU ndirEdgeMap<typename Traits::786 UEdgeSetWriter& writeUEdgeMap(std::string name, const Map& map) { 787 return writeUEdgeMap<typename Traits:: 788 788 template Writer<typename Map::Value>, Map>(name, map); 789 789 } … … 793 793 /// Add a new undirected map writer command for the writer. 794 794 template <typename Writer, typename Map> 795 U ndirEdgeSetWriter& writeUndirEdgeMap(std::string name, const Map& map,795 UEdgeSetWriter& writeUEdgeMap(std::string name, const Map& map, 796 796 const Writer& writer = Writer()) { 797 checkConcept<concept::ReadMap<U ndirEdge, typename Map::Value>, Map>();797 checkConcept<concept::ReadMap<UEdge, typename Map::Value>, Map>(); 798 798 checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>(); 799 799 writers.push_back( 800 800 make_pair(name, new _writer_bits:: 801 MapWriter<U ndirEdge, Map, Writer>(map, writer)));801 MapWriter<UEdge, Map, Writer>(map, writer))); 802 802 return *this; 803 803 } … … 807 807 /// Add a new directed map writer command for the writer. 808 808 template <typename Map> 809 U ndirEdgeSetWriter& writeEdgeMap(std::string name, const Map& map) {809 UEdgeSetWriter& writeEdgeMap(std::string name, const Map& map) { 810 810 return writeEdgeMap<typename Traits:: 811 811 template Writer<typename Map::Value>, Map>(name, map); … … 816 816 /// Add a new directed map writer command for the writer. 817 817 template <typename Writer, typename Map> 818 U ndirEdgeSetWriter& writeEdgeMap(std::string name, const Map& map,818 UEdgeSetWriter& writeEdgeMap(std::string name, const Map& map, 819 819 const Writer& writer = Writer()) { 820 820 checkConcept<concept::ReadMap<Edge, typename Map::Value>, Map>(); 821 821 checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>(); 822 writeU ndirEdge("+" + name,822 writeUEdge("+" + name, 823 823 _writer_bits::forwardComposeMap(graph, map), writer); 824 writeU ndirEdge("-" + name,824 writeUEdge("-" + name, 825 825 _writer_bits::backwardComposeMap(graph, map), writer); 826 826 return *this; … … 833 833 /// It gives back the header of the section. 834 834 virtual std::string header() { 835 return "@u ndiredgeset " + name;835 return "@uedgeset " + name; 836 836 } 837 837 … … 858 858 } 859 859 os << std::endl; 860 for (typename Graph::U ndirEdgeIt it(graph); it != INVALID; ++it) {860 for (typename Graph::UEdgeIt it(graph); it != INVALID; ++it) { 861 861 nodeLabelWriter->write(os, graph.source(it)); 862 862 os << '\t'; … … 892 892 /// undirected edge. Otherwise if the \c forceLabel parameter was true it 893 893 /// will write its id in the graph. 894 void writeLabel(std::ostream& os, const U ndirEdge& item) const {894 void writeLabel(std::ostream& os, const UEdge& item) const { 895 895 if (forceLabelMap) { 896 896 os << graph.id(item); … … 923 923 924 924 typedef std::vector<std::pair<std::string, _writer_bits:: 925 MapWriterBase<U ndirEdge>*> > MapWriters;925 MapWriterBase<UEdge>*> > MapWriters; 926 926 MapWriters writers; 927 927 928 _writer_bits::MapWriterBase<U ndirEdge>* labelMap;928 _writer_bits::MapWriterBase<UEdge>* labelMap; 929 929 bool forceLabelMap; 930 930 … … 1100 1100 /// \brief SectionWriter for writing named undirected edges. 1101 1101 /// 1102 /// The undirected edges section's header line is \c \@u ndiredges1103 /// \c u ndiredges_name, but the \c undiredges_name may be empty.1102 /// The undirected edges section's header line is \c \@uedges 1103 /// \c uedges_name, but the \c uedges_name may be empty. 1104 1104 /// 1105 1105 /// Each line in the section contains the name of the undirected edge and … … 1108 1108 /// \relates LemonWriter 1109 1109 template <typename _Graph> 1110 class U ndirEdgeWriter : public LemonWriter::SectionWriter {1110 class UEdgeWriter : public LemonWriter::SectionWriter { 1111 1111 typedef LemonWriter::SectionWriter Parent; 1112 1112 typedef _Graph Graph; 1113 1113 typedef typename Graph::Node Node; 1114 1114 typedef typename Graph::Edge Edge; 1115 typedef typename Graph::U ndirEdge UndirEdge;1115 typedef typename Graph::UEdge UEdge; 1116 1116 public: 1117 1117 1118 1118 /// \brief Constructor. 1119 1119 /// 1120 /// Constructor for U ndirEdgeWriter. It creates the UndirEdgeWriter and1120 /// Constructor for UEdgeWriter. It creates the UEdgeWriter and 1121 1121 /// attach it into the given LemonWriter. The given \c _LabelWriter 1122 1122 /// will write the undirected edges' label what can be an undirected 1123 1123 /// edgeset writer. 1124 1124 template <typename _LabelWriter> 1125 U ndirEdgeWriter(LemonWriter& _writer, const _LabelWriter& _labelWriter,1125 UEdgeWriter(LemonWriter& _writer, const _LabelWriter& _labelWriter, 1126 1126 const std::string& _name = std::string()) 1127 1127 : Parent(_writer), name(_name) { 1128 1128 checkConcept<_writer_bits::ItemLabelWriter<Edge>, _LabelWriter>(); 1129 checkConcept<_writer_bits::ItemLabelWriter<U ndirEdge>, _LabelWriter>();1130 u ndirEdgeLabelWriter.reset(new _writer_bits::1131 LabelWriter<U ndirEdge, _LabelWriter>(_labelWriter));1129 checkConcept<_writer_bits::ItemLabelWriter<UEdge>, _LabelWriter>(); 1130 uEdgeLabelWriter.reset(new _writer_bits:: 1131 LabelWriter<UEdge, _LabelWriter>(_labelWriter)); 1132 1132 edgeLabelWriter.reset(new _writer_bits:: 1133 1133 LabelWriter<Edge, _LabelWriter>(_labelWriter)); … … 1136 1136 /// \brief Destructor. 1137 1137 /// 1138 /// Destructor for U ndirEdgeWriter.1139 virtual ~U ndirEdgeWriter() {}1140 private: 1141 U ndirEdgeWriter(const UndirEdgeWriter&);1142 void operator=(const U ndirEdgeWriter&);1143 1144 public: 1145 1146 /// \brief Add an edge writer command for the U ndirEdgeWriter.1147 /// 1148 /// Add an edge writer command for the U ndirEdgeWriter.1138 /// Destructor for UEdgeWriter. 1139 virtual ~UEdgeWriter() {} 1140 private: 1141 UEdgeWriter(const UEdgeWriter&); 1142 void operator=(const UEdgeWriter&); 1143 1144 public: 1145 1146 /// \brief Add an edge writer command for the UEdgeWriter. 1147 /// 1148 /// Add an edge writer command for the UEdgeWriter. 1149 1149 void writeEdge(const std::string& name, const Edge& item) { 1150 1150 edgeWriters.push_back(make_pair(name, &item)); 1151 1151 } 1152 1152 1153 /// \brief Add an undirected edge writer command for the U ndirEdgeWriter.1154 /// 1155 /// Add an undirected edge writer command for the U ndirEdgeWriter.1156 void writeU ndirEdge(const std::string& name, const UndirEdge& item) {1157 u ndirEdgeWriters.push_back(make_pair(name, &item));1153 /// \brief Add an undirected edge writer command for the UEdgeWriter. 1154 /// 1155 /// Add an undirected edge writer command for the UEdgeWriter. 1156 void writeUEdge(const std::string& name, const UEdge& item) { 1157 uEdgeWriters.push_back(make_pair(name, &item)); 1158 1158 } 1159 1159 … … 1164 1164 /// It gives back the header of the section. 1165 1165 virtual std::string header() { 1166 return "@u ndiredges " + name;1166 return "@uedges " + name; 1167 1167 } 1168 1168 … … 1174 1174 throw DataFormatError("Cannot find undirected edgeset or label map"); 1175 1175 } 1176 if (!u ndirEdgeLabelWriter->isLabelWriter()) {1176 if (!uEdgeLabelWriter->isLabelWriter()) { 1177 1177 throw DataFormatError("Cannot find undirected edgeset or label map"); 1178 1178 } 1179 for (int i = 0; i < (int)u ndirEdgeWriters.size(); ++i) {1180 os << u ndirEdgeWriters[i].first << ' ';1181 u ndirEdgeLabelWriter->write(os, *(undirEdgeWriters[i].second));1179 for (int i = 0; i < (int)uEdgeWriters.size(); ++i) { 1180 os << uEdgeWriters[i].first << ' '; 1181 uEdgeLabelWriter->write(os, *(uEdgeWriters[i].second)); 1182 1182 os << std::endl; 1183 1183 } … … 1194 1194 1195 1195 typedef std::vector<std::pair<std::string, 1196 const U ndirEdge*> > UndirEdgeWriters;1197 U ndirEdgeWriters undirEdgeWriters;1198 std::auto_ptr<_writer_bits::LabelWriterBase<U ndirEdge> > undirEdgeLabelWriter;1196 const UEdge*> > UEdgeWriters; 1197 UEdgeWriters uEdgeWriters; 1198 std::auto_ptr<_writer_bits::LabelWriterBase<UEdge> > uEdgeLabelWriter; 1199 1199 1200 1200 typedef std::vector<std::pair<std::string, const Edge*> > EdgeWriters; -
lemon/list_graph.h
r1875 r1909 20 20 ///\ingroup graphs 21 21 ///\file 22 ///\brief ListGraph, UndirListGraph classes.22 ///\brief ListGraph, ListUGraph classes. 23 23 24 24 #include <lemon/bits/erasable_graph_extender.h> … … 577 577 /**************** Undirected List Graph ****************/ 578 578 579 typedef ErasableU ndirGraphExtender<580 ClearableU ndirGraphExtender<581 ExtendableU ndirGraphExtender<582 MappableU ndirGraphExtender<583 IterableU ndirGraphExtender<584 AlterableU ndirGraphExtender<585 U ndirGraphExtender<ListGraphBase> > > > > > > ExtendedUndirListGraphBase;579 typedef ErasableUGraphExtender< 580 ClearableUGraphExtender< 581 ExtendableUGraphExtender< 582 MappableUGraphExtender< 583 IterableUGraphExtender< 584 AlterableUGraphExtender< 585 UGraphExtender<ListGraphBase> > > > > > > ExtendedListUGraphBase; 586 586 587 587 /// \addtogroup graphs … … 593 593 /// 594 594 ///It conforms to the 595 ///\ref concept::U ndirGraph "UndirGraph" concept.595 ///\ref concept::UGraph "UGraph" concept. 596 596 /// 597 ///\sa concept::U ndirGraph.597 ///\sa concept::UGraph. 598 598 /// 599 599 ///\todo Snapshot, reverseEdge(), changeTarget(), changeSource(), contract() 600 600 ///haven't been implemented yet. 601 601 /// 602 class UndirListGraph : public ExtendedUndirListGraphBase {602 class ListUGraph : public ExtendedListUGraphBase { 603 603 public: 604 typedef Extended UndirListGraphBase Parent;604 typedef ExtendedListUGraphBase Parent; 605 605 /// \brief Changes the target of \c e to \c n 606 606 /// … … 610 610 /// referencing the changed edge remain 611 611 /// valid. However <tt>InEdge</tt>'s are invalidated. 612 void changeTarget(U ndirEdge e, Node n) {612 void changeTarget(UEdge e, Node n) { 613 613 _changeTarget(e,n); 614 614 } … … 620 620 ///referencing the changed edge remain 621 621 ///valid. However <tt>OutEdge</tt>'s are invalidated. 622 void changeSource(U ndirEdge e, Node n) {622 void changeSource(UEdge e, Node n) { 623 623 _changeSource(e,n); 624 624 } -
lemon/max_matching.h
r1875 r1909 60 60 typedef typename Graph::Node Node; 61 61 typedef typename Graph::Edge Edge; 62 typedef typename Graph::U ndirEdge UndirEdge;63 typedef typename Graph::U ndirEdgeIt UndirEdgeIt;62 typedef typename Graph::UEdge UEdge; 63 typedef typename Graph::UEdgeIt UEdgeIt; 64 64 typedef typename Graph::NodeIt NodeIt; 65 65 typedef typename Graph::IncEdgeIt IncEdgeIt; … … 99 99 ///heuristic of postponing shrinks for dense graphs. 100 100 void run() { 101 if ( countU ndirEdges(g) < HEUR_density*countNodes(g) ) {101 if ( countUEdges(g) < HEUR_density*countNodes(g) ) { 102 102 greedyMatching(); 103 103 runEdmonds(0); … … 213 213 } 214 214 215 ///Reads a matching from an \c U ndirEdge valued \c Node map.216 217 ///Reads a matching from an \c U ndirEdge valued \c Node map. \c218 ///map[v] must be an \c U ndirEdge incident to \c v. This map must215 ///Reads a matching from an \c UEdge valued \c Node map. 216 217 ///Reads a matching from an \c UEdge valued \c Node map. \c 218 ///map[v] must be an \c UEdge incident to \c v. This map must 219 219 ///have the property that if \c g.oppositeNode(u,map[u])==v then 220 220 ///\c \c g.oppositeNode(v,map[v])==u holds, and now some edge … … 223 223 void readNMapEdge(NMapE& map) { 224 224 for(NodeIt v(g); v!=INVALID; ++v) { 225 U ndirEdge e=map[v];225 UEdge e=map[v]; 226 226 if ( e!=INVALID ) 227 227 _mate.set(v,g.oppositeNode(v,e)); … … 229 229 } 230 230 231 ///Writes the matching stored to an \c U ndirEdge valued \c Node map.232 233 ///Writes the stored matching to an \c U ndirEdge valued \c Node234 ///map. \c map[v] will be an \c U ndirEdge incident to \c v. This231 ///Writes the matching stored to an \c UEdge valued \c Node map. 232 233 ///Writes the stored matching to an \c UEdge valued \c Node 234 ///map. \c map[v] will be an \c UEdge incident to \c v. This 235 235 ///map will have the property that if \c g.oppositeNode(u,map[u]) 236 236 ///== v then \c map[u]==map[v] holds, and now this edge is an edge … … 264 264 template<typename EMapB> 265 265 void readEMapBool(EMapB& map) { 266 for(U ndirEdgeIt e(g); e!=INVALID; ++e) {266 for(UEdgeIt e(g); e!=INVALID; ++e) { 267 267 if ( map[e] ) { 268 268 Node u=g.source(e); … … 283 283 template<typename EMapB> 284 284 void writeEMapBool (EMapB& map) const { 285 for(U ndirEdgeIt e(g); e!=INVALID; ++e) map.set(e,false);285 for(UEdgeIt e(g); e!=INVALID; ++e) map.set(e,false); 286 286 287 287 typename Graph::template NodeMap<bool> todo(g,true); -
lemon/path.h
r1875 r1909 386 386 /// \todo May we need just path for undirected graph instead of this. 387 387 template<typename Graph> 388 class U ndirPath {388 class UPath { 389 389 public: 390 390 /// Edge type of the underlying graph. … … 404 404 /// \param _G The graph in which the path is. 405 405 /// 406 U ndirPath(const Graph &_G) : gr(&_G) {}406 UPath(const Graph &_G) : gr(&_G) {} 407 407 408 408 /// \brief Subpath constructor. … … 410 410 /// Subpath defined by two nodes. 411 411 /// \warning It is an error if the two edges are not in order! 412 U ndirPath(const UndirPath &P, const NodeIt &a, const NodeIt &b) {412 UPath(const UPath &P, const NodeIt &a, const NodeIt &b) { 413 413 gr = P.gr; 414 414 edges.insert(edges.end(), P.edges.begin()+a.idx, P.edges.begin()+b.idx); … … 419 419 /// Subpath defined by two edges. Contains edges in [a,b) 420 420 /// \warning It is an error if the two edges are not in order! 421 U ndirPath(const UndirPath &P, const EdgeIt &a, const EdgeIt &b) {421 UPath(const UPath &P, const EdgeIt &a, const EdgeIt &b) { 422 422 gr = P.gr; 423 423 edges.insert(edges.end(), P.edges.begin()+a.idx, P.edges.begin()+b.idx); … … 501 501 */ 502 502 class EdgeIt { 503 friend class U ndirPath;503 friend class UPath; 504 504 505 505 int idx; 506 const U ndirPath *p;506 const UPath *p; 507 507 public: 508 508 /// Default constructor … … 511 511 EdgeIt(Invalid) : idx(-1), p(0) {} 512 512 /// Constructor with starting point 513 EdgeIt(const U ndirPath &_p, int _idx = 0) :513 EdgeIt(const UPath &_p, int _idx = 0) : 514 514 idx(_idx), p(&_p) { validate(); } 515 515 … … 548 548 */ 549 549 class NodeIt { 550 friend class U ndirPath;550 friend class UPath; 551 551 552 552 int idx; 553 const U ndirPath *p;553 const UPath *p; 554 554 public: 555 555 /// Default constructor … … 558 558 NodeIt(Invalid) : idx(-1), p(0) {} 559 559 /// Constructor with starting point 560 NodeIt(const U ndirPath &_p, int _idx = 0) :560 NodeIt(const UPath &_p, int _idx = 0) : 561 561 idx(_idx), p(&_p) { validate(); } 562 562 … … 601 601 * operation and until the commit()) the original Path is in a 602 602 * "transitional" state (operations ot it have undefined result). But 603 * in the case of U ndirPath the original path is unchanged until the603 * in the case of UPath the original path is unchanged until the 604 604 * commit. However we don't recomend that you use this feature. 605 605 */ 606 606 class Builder { 607 U ndirPath &P;607 UPath &P; 608 608 Container front, back; 609 609 … … 611 611 ///\param _p the path you want to fill in. 612 612 /// 613 Builder(U ndirPath &_p) : P(_p) {}613 Builder(UPath &_p) : P(_p) {} 614 614 615 615 /// Sets the starting node of the path. -
lemon/smart_graph.h
r1875 r1909 20 20 ///\ingroup graphs 21 21 ///\file 22 ///\brief SmartGraph and UndirSmartGraph classes.22 ///\brief SmartGraph and SmartUGraph classes. 23 23 24 24 #include <vector> … … 354 354 /**************** Undirected List Graph ****************/ 355 355 356 typedef ClearableUndirGraphExtender< 357 ExtendableUndirGraphExtender< 358 MappableUndirGraphExtender< 359 IterableUndirGraphExtender< 360 AlterableUndirGraphExtender< 361 UndirGraphExtender<SmartGraphBase> > > > > > ExtendedUndirSmartGraphBase; 362 363 ///A smart undirected graph class. 364 365 ///This is a simple and fast undirected graph implementation. 366 ///It is also quite memory efficient, but at the price 367 ///that <b> it does support only limited (only stack-like) 368 ///node and edge deletions</b>. 369 ///Except from this it conforms to 370 ///the \ref concept::UndirGraph "UndirGraph" concept. 371 ///\sa concept::UndirGraph. 356 typedef ClearableUGraphExtender< 357 ExtendableUGraphExtender< 358 MappableUGraphExtender< 359 IterableUGraphExtender< 360 AlterableUGraphExtender< 361 UGraphExtender<SmartGraphBase> > > > > > ExtendedSmartUGraphBase; 362 363 /// \ingroup graphs 372 364 /// 373 /// \todo Snapshot hasn't been implemented yet.365 /// \brief A smart undirected graph class. 374 366 /// 375 class UndirSmartGraph : public ExtendedUndirSmartGraphBase { 367 /// This is a simple and fast undirected graph implementation. 368 /// It is also quite memory efficient, but at the price 369 /// that <b> it does support only limited (only stack-like) 370 /// node and edge deletions</b>. 371 /// Except from this it conforms to 372 /// the \ref concept::UGraph "UGraph" concept. 373 /// \sa concept::UGraph. 374 /// 375 /// \todo Snapshot hasn't been implemented yet. 376 /// 377 class SmartUGraph : public ExtendedSmartUGraphBase { 376 378 }; 377 379 378 380 379 class SmartU ndirBipartiteGraphBase {381 class SmartUBipartiteGraphBase { 380 382 public: 381 383 382 384 class NodeSetError : public LogicError { 383 385 virtual const char* exceptionName() const { 384 return "lemon::FullU ndirBipartiteGraph::NodeSetError";386 return "lemon::FullUBipartiteGraph::NodeSetError"; 385 387 } 386 388 }; … … 407 409 408 410 class Node { 409 friend class SmartU ndirBipartiteGraphBase;411 friend class SmartUBipartiteGraphBase; 410 412 protected: 411 413 int id; … … 421 423 422 424 class Edge { 423 friend class SmartU ndirBipartiteGraphBase;425 friend class SmartUBipartiteGraphBase; 424 426 protected: 425 427 int id; … … 584 586 585 587 586 typedef ClearableU ndirBipartiteGraphExtender<587 ExtendableU ndirBipartiteGraphExtender<588 MappableU ndirBipartiteGraphExtender<589 IterableU ndirBipartiteGraphExtender<590 AlterableU ndirBipartiteGraphExtender<591 U ndirBipartiteGraphExtender <592 SmartU ndirBipartiteGraphBase> > > > > >593 ExtendedSmartU ndirBipartiteGraphBase;594 595 596 class SmartU ndirBipartiteGraph :597 public ExtendedSmartU ndirBipartiteGraphBase {588 typedef ClearableUBipartiteGraphExtender< 589 ExtendableUBipartiteGraphExtender< 590 MappableUBipartiteGraphExtender< 591 IterableUBipartiteGraphExtender< 592 AlterableUBipartiteGraphExtender< 593 UBipartiteGraphExtender < 594 SmartUBipartiteGraphBase> > > > > > 595 ExtendedSmartUBipartiteGraphBase; 596 597 598 class SmartUBipartiteGraph : 599 public ExtendedSmartUBipartiteGraphBase { 598 600 }; 599 601 -
lemon/sub_graph.h
r1875 r1909 695 695 // class ResGraph 696 696 // : public IterableGraphExtender<EdgeSubGraphBase< 697 // U ndirGraphAdaptor<Graph> > > {697 // UGraphAdaptor<Graph> > > { 698 698 // public: 699 699 // typedef IterableGraphExtender<EdgeSubGraphBase< 700 // U ndirGraphAdaptor<Graph> > > Parent;700 // UGraphAdaptor<Graph> > > Parent; 701 701 702 702 // protected: 703 // U ndirGraphAdaptor<Graph> undir;703 // UGraphAdaptor<Graph> u; 704 704 705 705 // const CapacityMap* capacity; … … 719 719 // public: 720 720 721 // typedef typename U ndirGraphAdaptor<Graph>::Node Node;722 // typedef typename U ndirGraphAdaptor<Graph>::Edge Edge;723 // typedef typename U ndirGraphAdaptor<Graph>::UndirEdge UndirEdge;721 // typedef typename UGraphAdaptor<Graph>::Node Node; 722 // typedef typename UGraphAdaptor<Graph>::Edge Edge; 723 // typedef typename UGraphAdaptor<Graph>::UEdge UEdge; 724 724 725 725 // ResGraphAdaptor(Graph& _graph, 726 726 // const CapacityMap& _capacity, FlowMap& _flow) 727 // : Parent(), u ndir(_graph), capacity(&_capacity), flow(&_flow),727 // : Parent(), u(_graph), capacity(&_capacity), flow(&_flow), 728 728 // nodes(*this, _graph), edges(*this, _graph) { 729 // Parent::construct(u ndir, nodes, edges);729 // Parent::construct(u, nodes, edges); 730 730 // setFlowMap(_flow); 731 731 // setCapacityMap(_capacity); … … 771 771 // } 772 772 773 // Edge direct(const U ndirEdge& edge, bool direction) const {773 // Edge direct(const UEdge& edge, bool direction) const { 774 774 // return Parent::getGraph().direct(edge, direction); 775 775 // } 776 776 777 // Edge direct(const U ndirEdge& edge, const Node& node) const {777 // Edge direct(const UEdge& edge, const Node& node) const { 778 778 // return Parent::getGraph().direct(edge, node); 779 779 // } -
lemon/topology.h
r1875 r1909 25 25 26 26 #include <lemon/concept/graph.h> 27 #include <lemon/concept/u ndir_graph.h>27 #include <lemon/concept/ugraph.h> 28 28 #include <lemon/concept_check.h> 29 29 … … 50 50 /// \return %True when there is path between any two nodes in the graph. 51 51 /// \note By definition, the empty graph is connected. 52 template <typename U ndirGraph>53 bool connected(const U ndirGraph& graph) {54 checkConcept<concept::U ndirGraph, UndirGraph>();55 typedef typename U ndirGraph::NodeIt NodeIt;52 template <typename UGraph> 53 bool connected(const UGraph& graph) { 54 checkConcept<concept::UGraph, UGraph>(); 55 typedef typename UGraph::NodeIt NodeIt; 56 56 if (NodeIt(graph) == INVALID) return true; 57 Dfs<U ndirGraph> dfs(graph);57 Dfs<UGraph> dfs(graph); 58 58 dfs.run(NodeIt(graph)); 59 59 for (NodeIt it(graph); it != INVALID; ++it) { … … 75 75 /// \note By definition, the empty graph consists 76 76 /// of zero connected components. 77 template <typename U ndirGraph>78 int countConnectedComponents(const U ndirGraph &graph) {79 checkConcept<concept::U ndirGraph, UndirGraph>();80 typedef typename U ndirGraph::Node Node;81 typedef typename U ndirGraph::Edge Edge;77 template <typename UGraph> 78 int countConnectedComponents(const UGraph &graph) { 79 checkConcept<concept::UGraph, UGraph>(); 80 typedef typename UGraph::Node Node; 81 typedef typename UGraph::Edge Edge; 82 82 83 83 typedef NullMap<Node, Edge> PredMap; … … 85 85 86 86 int compNum = 0; 87 typename Bfs<U ndirGraph>::87 typename Bfs<UGraph>:: 88 88 template DefPredMap<PredMap>:: 89 89 template DefDistMap<DistMap>:: … … 97 97 98 98 bfs.init(); 99 for(typename U ndirGraph::NodeIt n(graph); n != INVALID; ++n) {99 for(typename UGraph::NodeIt n(graph); n != INVALID; ++n) { 100 100 if (!bfs.reached(n)) { 101 101 bfs.addSource(n); … … 123 123 /// \return The number of components 124 124 /// 125 template <class U ndirGraph, class NodeMap>126 int connectedComponents(const U ndirGraph &graph, NodeMap &compMap) {127 checkConcept<concept::U ndirGraph, UndirGraph>();128 typedef typename U ndirGraph::Node Node;129 typedef typename U ndirGraph::Edge Edge;125 template <class UGraph, class NodeMap> 126 int connectedComponents(const UGraph &graph, NodeMap &compMap) { 127 checkConcept<concept::UGraph, UGraph>(); 128 typedef typename UGraph::Node Node; 129 typedef typename UGraph::Edge Edge; 130 130 checkConcept<concept::WriteMap<Node, int>, NodeMap>(); 131 131 … … 134 134 135 135 int compNum = 0; 136 typename Bfs<U ndirGraph>::136 typename Bfs<UGraph>:: 137 137 template DefPredMap<PredMap>:: 138 138 template DefDistMap<DistMap>:: … … 146 146 147 147 bfs.init(); 148 for(typename U ndirGraph::NodeIt n(graph); n != INVALID; ++n) {148 for(typename UGraph::NodeIt n(graph); n != INVALID; ++n) { 149 149 if(!bfs.reached(n)) { 150 150 bfs.addSource(n); … … 485 485 typedef typename Graph::Node Node; 486 486 typedef typename Graph::Edge Edge; 487 typedef typename Graph::U ndirEdge UndirEdge;487 typedef typename Graph::UEdge UEdge; 488 488 489 489 CountBiNodeConnectedComponentsVisitor(const Graph& graph, int &compNum) … … 543 543 typedef typename Graph::Node Node; 544 544 typedef typename Graph::Edge Edge; 545 typedef typename Graph::U ndirEdge UndirEdge;545 typedef typename Graph::UEdge UEdge; 546 546 547 547 BiNodeConnectedComponentsVisitor(const Graph& graph, … … 613 613 typename Graph::template NodeMap<int> _retMap; 614 614 typename Graph::template NodeMap<Edge> _predMap; 615 std::stack<U ndirEdge> _edgeStack;615 std::stack<UEdge> _edgeStack; 616 616 int _num; 617 617 }; … … 623 623 typedef typename Graph::Node Node; 624 624 typedef typename Graph::Edge Edge; 625 typedef typename Graph::U ndirEdge UndirEdge;625 typedef typename Graph::UEdge UEdge; 626 626 627 627 BiNodeConnectedCutNodesVisitor(const Graph& graph, NodeMap& cutMap, … … 689 689 typename Graph::template NodeMap<int> _retMap; 690 690 typename Graph::template NodeMap<Node> _predMap; 691 std::stack<U ndirEdge> _edgeStack;691 std::stack<UEdge> _edgeStack; 692 692 int _num; 693 693 bool rootCut; … … 696 696 } 697 697 698 template <typename U ndirGraph>699 int countBiNodeConnectedComponents(const U ndirGraph& graph);698 template <typename UGraph> 699 int countBiNodeConnectedComponents(const UGraph& graph); 700 700 701 701 /// \ingroup topology … … 710 710 /// \return %True when the graph bi-node-connected. 711 711 /// \todo Make it faster. 712 template <typename U ndirGraph>713 bool biNodeConnected(const U ndirGraph& graph) {712 template <typename UGraph> 713 bool biNodeConnected(const UGraph& graph) { 714 714 return countBiNodeConnectedComponents(graph) == 1; 715 715 } … … 726 726 /// \param graph The graph. 727 727 /// \return The number of components. 728 template <typename U ndirGraph>729 int countBiNodeConnectedComponents(const U ndirGraph& graph) {730 checkConcept<concept::U ndirGraph, UndirGraph>();731 typedef typename U ndirGraph::NodeIt NodeIt;728 template <typename UGraph> 729 int countBiNodeConnectedComponents(const UGraph& graph) { 730 checkConcept<concept::UGraph, UGraph>(); 731 typedef typename UGraph::NodeIt NodeIt; 732 732 733 733 using namespace _topology_bits; 734 734 735 typedef CountBiNodeConnectedComponentsVisitor<U ndirGraph> Visitor;735 typedef CountBiNodeConnectedComponentsVisitor<UGraph> Visitor; 736 736 737 737 int compNum = 0; 738 738 Visitor visitor(graph, compNum); 739 739 740 DfsVisit<U ndirGraph, Visitor> dfs(graph, visitor);740 DfsVisit<UGraph, Visitor> dfs(graph, visitor); 741 741 dfs.init(); 742 742 … … 763 763 /// 764 764 /// \param graph The graph. 765 /// \retval compMap A writable u ndiredge map. The values will be set from 0765 /// \retval compMap A writable uedge map. The values will be set from 0 766 766 /// to the number of the biconnected components minus one. Each values 767 767 /// of the map will be set exactly once, the values of a certain component … … 769 769 /// \return The number of components. 770 770 /// 771 template <typename U ndirGraph, typename UndirEdgeMap>772 int biNodeConnectedComponents(const U ndirGraph& graph,773 U ndirEdgeMap& compMap) {774 checkConcept<concept::U ndirGraph, UndirGraph>();775 typedef typename U ndirGraph::NodeIt NodeIt;776 typedef typename U ndirGraph::UndirEdge UndirEdge;777 checkConcept<concept::WriteMap<U ndirEdge, int>, UndirEdgeMap>();771 template <typename UGraph, typename UEdgeMap> 772 int biNodeConnectedComponents(const UGraph& graph, 773 UEdgeMap& compMap) { 774 checkConcept<concept::UGraph, UGraph>(); 775 typedef typename UGraph::NodeIt NodeIt; 776 typedef typename UGraph::UEdge UEdge; 777 checkConcept<concept::WriteMap<UEdge, int>, UEdgeMap>(); 778 778 779 779 using namespace _topology_bits; 780 780 781 typedef BiNodeConnectedComponentsVisitor<U ndirGraph, UndirEdgeMap> Visitor;781 typedef BiNodeConnectedComponentsVisitor<UGraph, UEdgeMap> Visitor; 782 782 783 783 int compNum = 0; 784 784 Visitor visitor(graph, compMap, compNum); 785 785 786 DfsVisit<U ndirGraph, Visitor> dfs(graph, visitor);786 DfsVisit<UGraph, Visitor> dfs(graph, visitor); 787 787 dfs.init(); 788 788 … … 810 810 /// the node separate two or more components. 811 811 /// \return The number of the cut nodes. 812 template <typename U ndirGraph, typename NodeMap>813 int biNodeConnectedCutNodes(const U ndirGraph& graph, NodeMap& cutMap) {814 checkConcept<concept::U ndirGraph, UndirGraph>();815 typedef typename U ndirGraph::Node Node;816 typedef typename U ndirGraph::NodeIt NodeIt;812 template <typename UGraph, typename NodeMap> 813 int biNodeConnectedCutNodes(const UGraph& graph, NodeMap& cutMap) { 814 checkConcept<concept::UGraph, UGraph>(); 815 typedef typename UGraph::Node Node; 816 typedef typename UGraph::NodeIt NodeIt; 817 817 checkConcept<concept::WriteMap<Node, bool>, NodeMap>(); 818 818 819 819 using namespace _topology_bits; 820 820 821 typedef BiNodeConnectedCutNodesVisitor<U ndirGraph, NodeMap> Visitor;821 typedef BiNodeConnectedCutNodesVisitor<UGraph, NodeMap> Visitor; 822 822 823 823 int cutNum = 0; 824 824 Visitor visitor(graph, cutMap, cutNum); 825 825 826 DfsVisit<U ndirGraph, Visitor> dfs(graph, visitor);826 DfsVisit<UGraph, Visitor> dfs(graph, visitor); 827 827 dfs.init(); 828 828 … … 843 843 typedef typename Graph::Node Node; 844 844 typedef typename Graph::Edge Edge; 845 typedef typename Graph::U ndirEdge UndirEdge;845 typedef typename Graph::UEdge UEdge; 846 846 847 847 CountBiEdgeConnectedComponentsVisitor(const Graph& graph, int &compNum) … … 899 899 typedef typename Graph::Node Node; 900 900 typedef typename Graph::Edge Edge; 901 typedef typename Graph::U ndirEdge UndirEdge;901 typedef typename Graph::UEdge UEdge; 902 902 903 903 BiEdgeConnectedComponentsVisitor(const Graph& graph, … … 966 966 typedef typename Graph::Node Node; 967 967 typedef typename Graph::Edge Edge; 968 typedef typename Graph::U ndirEdge UndirEdge;968 typedef typename Graph::UEdge UEdge; 969 969 970 970 BiEdgeConnectedCutEdgesVisitor(const Graph& graph, … … 1023 1023 } 1024 1024 1025 template <typename U ndirGraph>1026 int countbiEdgeConnectedComponents(const U ndirGraph& graph);1025 template <typename UGraph> 1026 int countbiEdgeConnectedComponents(const UGraph& graph); 1027 1027 1028 1028 /// \ingroup topology … … 1037 1037 /// \return The number of components. 1038 1038 /// \todo Make it faster. 1039 template <typename U ndirGraph>1040 bool biEdgeConnected(const U ndirGraph& graph) {1039 template <typename UGraph> 1040 bool biEdgeConnected(const UGraph& graph) { 1041 1041 return countBiEdgeConnectedComponents(graph) == 1; 1042 1042 } … … 1053 1053 /// \param graph The undirected graph. 1054 1054 /// \return The number of components. 1055 template <typename U ndirGraph>1056 int countBiEdgeConnectedComponents(const U ndirGraph& graph) {1057 checkConcept<concept::U ndirGraph, UndirGraph>();1058 typedef typename U ndirGraph::NodeIt NodeIt;1055 template <typename UGraph> 1056 int countBiEdgeConnectedComponents(const UGraph& graph) { 1057 checkConcept<concept::UGraph, UGraph>(); 1058 typedef typename UGraph::NodeIt NodeIt; 1059 1059 1060 1060 using namespace _topology_bits; 1061 1061 1062 typedef CountBiEdgeConnectedComponentsVisitor<U ndirGraph> Visitor;1062 typedef CountBiEdgeConnectedComponentsVisitor<UGraph> Visitor; 1063 1063 1064 1064 int compNum = 0; 1065 1065 Visitor visitor(graph, compNum); 1066 1066 1067 DfsVisit<U ndirGraph, Visitor> dfs(graph, visitor);1067 DfsVisit<UGraph, Visitor> dfs(graph, visitor); 1068 1068 dfs.init(); 1069 1069 … … 1096 1096 /// \return The number of components. 1097 1097 /// 1098 template <typename U ndirGraph, typename NodeMap>1099 int biEdgeConnectedComponents(const U ndirGraph& graph, NodeMap& compMap) {1100 checkConcept<concept::U ndirGraph, UndirGraph>();1101 typedef typename U ndirGraph::NodeIt NodeIt;1102 typedef typename U ndirGraph::Node Node;1098 template <typename UGraph, typename NodeMap> 1099 int biEdgeConnectedComponents(const UGraph& graph, NodeMap& compMap) { 1100 checkConcept<concept::UGraph, UGraph>(); 1101 typedef typename UGraph::NodeIt NodeIt; 1102 typedef typename UGraph::Node Node; 1103 1103 checkConcept<concept::WriteMap<Node, int>, NodeMap>(); 1104 1104 1105 1105 using namespace _topology_bits; 1106 1106 1107 typedef BiEdgeConnectedComponentsVisitor<U ndirGraph, NodeMap> Visitor;1107 typedef BiEdgeConnectedComponentsVisitor<UGraph, NodeMap> Visitor; 1108 1108 1109 1109 int compNum = 0; 1110 1110 Visitor visitor(graph, compMap, compNum); 1111 1111 1112 DfsVisit<U ndirGraph, Visitor> dfs(graph, visitor);1112 DfsVisit<UGraph, Visitor> dfs(graph, visitor); 1113 1113 dfs.init(); 1114 1114 … … 1137 1137 /// edge is a cut edge. 1138 1138 /// \return The number of cut edges. 1139 template <typename U ndirGraph, typename UndirEdgeMap>1140 int biEdgeConnectedCutEdges(const U ndirGraph& graph, UndirEdgeMap& cutMap) {1141 checkConcept<concept::U ndirGraph, UndirGraph>();1142 typedef typename U ndirGraph::NodeIt NodeIt;1143 typedef typename U ndirGraph::UndirEdge UndirEdge;1144 checkConcept<concept::WriteMap<U ndirEdge, bool>, UndirEdgeMap>();1139 template <typename UGraph, typename UEdgeMap> 1140 int biEdgeConnectedCutEdges(const UGraph& graph, UEdgeMap& cutMap) { 1141 checkConcept<concept::UGraph, UGraph>(); 1142 typedef typename UGraph::NodeIt NodeIt; 1143 typedef typename UGraph::UEdge UEdge; 1144 checkConcept<concept::WriteMap<UEdge, bool>, UEdgeMap>(); 1145 1145 1146 1146 using namespace _topology_bits; 1147 1147 1148 typedef BiEdgeConnectedCutEdgesVisitor<U ndirGraph, UndirEdgeMap> Visitor;1148 typedef BiEdgeConnectedCutEdgesVisitor<UGraph, UEdgeMap> Visitor; 1149 1149 1150 1150 int cutNum = 0; 1151 1151 Visitor visitor(graph, cutMap, cutNum); 1152 1152 1153 DfsVisit<U ndirGraph, Visitor> dfs(graph, visitor);1153 DfsVisit<UGraph, Visitor> dfs(graph, visitor); 1154 1154 dfs.init(); 1155 1155 … … 1327 1327 /// \return %True when there is no circle in the graph. 1328 1328 /// \see dag 1329 template <typename U ndirGraph>1330 bool acyclic(const U ndirGraph& graph) {1331 checkConcept<concept::U ndirGraph, UndirGraph>();1332 typedef typename U ndirGraph::Node Node;1333 typedef typename U ndirGraph::NodeIt NodeIt;1334 typedef typename U ndirGraph::Edge Edge;1335 Dfs<U ndirGraph> dfs(graph);1329 template <typename UGraph> 1330 bool acyclic(const UGraph& graph) { 1331 checkConcept<concept::UGraph, UGraph>(); 1332 typedef typename UGraph::Node Node; 1333 typedef typename UGraph::NodeIt NodeIt; 1334 typedef typename UGraph::Edge Edge; 1335 Dfs<UGraph> dfs(graph); 1336 1336 dfs.init(); 1337 1337 for (NodeIt it(graph); it != INVALID; ++it) { … … 1360 1360 /// \param graph The undirected graph. 1361 1361 /// \return %True when the graph is acyclic and connected. 1362 template <typename U ndirGraph>1363 bool tree(const U ndirGraph& graph) {1364 checkConcept<concept::U ndirGraph, UndirGraph>();1365 typedef typename U ndirGraph::Node Node;1366 typedef typename U ndirGraph::NodeIt NodeIt;1367 typedef typename U ndirGraph::Edge Edge;1368 Dfs<U ndirGraph> dfs(graph);1362 template <typename UGraph> 1363 bool tree(const UGraph& graph) { 1364 checkConcept<concept::UGraph, UGraph>(); 1365 typedef typename UGraph::Node Node; 1366 typedef typename UGraph::NodeIt NodeIt; 1367 typedef typename UGraph::Edge Edge; 1368 Dfs<UGraph> dfs(graph); 1369 1369 dfs.init(); 1370 1370 dfs.addSource(NodeIt(graph)); … … 1398 1398 /// 1399 1399 /// \author Balazs Attila Mihaly 1400 template<typename U ndirGraph>1401 inline bool bipartite(const U ndirGraph &graph){1402 checkConcept<concept::U ndirGraph, UndirGraph>();1403 1404 typedef typename U ndirGraph::NodeIt NodeIt;1405 typedef typename U ndirGraph::EdgeIt EdgeIt;1406 1407 Bfs<U ndirGraph> bfs(graph);1400 template<typename UGraph> 1401 inline bool bipartite(const UGraph &graph){ 1402 checkConcept<concept::UGraph, UGraph>(); 1403 1404 typedef typename UGraph::NodeIt NodeIt; 1405 typedef typename UGraph::EdgeIt EdgeIt; 1406 1407 Bfs<UGraph> bfs(graph); 1408 1408 bfs.init(); 1409 1409 for(NodeIt i(graph);i!=INVALID;++i){ … … 1435 1435 /// \image html bipartite_partitions.png 1436 1436 /// \image latex bipartite_partitions.eps "Bipartite partititions" width=\textwidth 1437 template<typename U ndirGraph, typename NodeMap>1438 inline bool bipartitePartitions(const U ndirGraph &graph, NodeMap &partMap){1439 checkConcept<concept::U ndirGraph, UndirGraph>();1440 1441 typedef typename U ndirGraph::Node Node;1442 typedef typename U ndirGraph::NodeIt NodeIt;1443 typedef typename U ndirGraph::EdgeIt EdgeIt;1437 template<typename UGraph, typename NodeMap> 1438 inline bool bipartitePartitions(const UGraph &graph, NodeMap &partMap){ 1439 checkConcept<concept::UGraph, UGraph>(); 1440 1441 typedef typename UGraph::Node Node; 1442 typedef typename UGraph::NodeIt NodeIt; 1443 typedef typename UGraph::EdgeIt EdgeIt; 1444 1444 1445 Bfs<U ndirGraph> bfs(graph);1445 Bfs<UGraph> bfs(graph); 1446 1446 bfs.init(); 1447 1447 for(NodeIt i(graph);i!=INVALID;++i){ -
lemon/traits.h
r1875 r1909 73 73 74 74 template <typename _Graph> 75 class ItemSetTraits<_Graph, typename _Graph::U ndirEdge> {75 class ItemSetTraits<_Graph, typename _Graph::UEdge> { 76 76 public: 77 77 78 78 typedef _Graph Graph; 79 79 80 typedef typename Graph::U ndirEdge Item;81 typedef typename Graph::U ndirEdgeIt ItemIt;80 typedef typename Graph::UEdge Item; 81 typedef typename Graph::UEdgeIt ItemIt; 82 82 83 83 template <typename _Value> 84 class Map : public Graph::template U ndirEdgeMap<_Value> {84 class Map : public Graph::template UEdgeMap<_Value> { 85 85 public: 86 typedef typename Graph::template U ndirEdgeMap<_Value> Parent;86 typedef typename Graph::template UEdgeMap<_Value> Parent; 87 87 typedef typename Parent::Value Value; 88 88 -
test/Makefile.am
r1901 r1909 34 34 time_measure_test \ 35 35 unionfind_test \ 36 u ndir_graph_test \36 ugraph_test \ 37 37 xy_test \ 38 38 heap_test … … 71 71 unionfind_test_SOURCES = unionfind_test.cc 72 72 xy_test_SOURCES = xy_test.cc 73 u ndir_graph_test_SOURCES = undir_graph_test.cc73 ugraph_test_SOURCES = ugraph_test.cc 74 74 heap_test_SOURCES = heap_test.cc 75 75 -
test/graph_adaptor_test.cc
r1875 r1909 20 20 #include<lemon/smart_graph.h> 21 21 #include<lemon/concept/graph.h> 22 #include<lemon/concept/u ndir_graph.h>22 #include<lemon/concept/ugraph.h> 23 23 24 24 #include<lemon/list_graph.h> … … 66 66 67 67 /// \bug why does not compile with StaticGraph 68 checkConcept<BaseIterableU ndirGraphConcept, UndirGraphAdaptor<ListGraph> >();69 checkConcept<IterableU ndirGraphConcept, UndirGraphAdaptor<ListGraph> >();70 checkConcept<MappableU ndirGraphConcept, UndirGraphAdaptor<ListGraph> >();68 checkConcept<BaseIterableUGraphConcept, UGraphAdaptor<ListGraph> >(); 69 checkConcept<IterableUGraphConcept, UGraphAdaptor<ListGraph> >(); 70 checkConcept<MappableUGraphConcept, UGraphAdaptor<ListGraph> >(); 71 71 } 72 72 std::cout << __FILE__ ": All tests passed.\n"; -
test/max_matching_test.cc
r1875 r1909 32 32 int main() { 33 33 34 typedef UndirListGraph Graph;34 typedef ListUGraph Graph; 35 35 36 36 typedef Graph::Edge Edge; 37 typedef Graph::U ndirEdgeIt UndirEdgeIt;37 typedef Graph::UEdgeIt UEdgeIt; 38 38 typedef Graph::IncEdgeIt IncEdgeIt; 39 39 typedef Graph::NodeIt NodeIt; … … 139 139 140 140 bool noedge=true; 141 for(U ndirEdgeIt e(g); e!=INVALID; ++e) {141 for(UEdgeIt e(g); e!=INVALID; ++e) { 142 142 if ( (pos[g.target(e)]==max_matching.C && pos[g.source(e)]==max_matching.D) || 143 143 (pos[g.target(e)]==max_matching.D && pos[g.source(e)]==max_matching.C) ) -
test/path_test.cc
r1875 r1909 90 90 template void checkCompilePath< concept::Path<ListGraph> >(concept::Path<ListGraph> &); 91 91 template void checkCompilePath< DirPath<ListGraph> >(DirPath<ListGraph> &); 92 template void checkCompilePath< U ndirPath<ListGraph> >(UndirPath<ListGraph> &);92 template void checkCompilePath< UPath<ListGraph> >(UPath<ListGraph> &); 93 93 94 94 int main() -
test/test_tools.h
r1875 r1909 134 134 } 135 135 136 ///Structure returned by \ref addU ndirPetersen().136 ///Structure returned by \ref addUPetersen(). 137 137 138 ///Structure returned by \ref addU ndirPetersen().138 ///Structure returned by \ref addUPetersen(). 139 139 /// 140 template<class Graph> struct U ndirPetStruct140 template<class Graph> struct UPetStruct 141 141 { 142 142 ///Vector containing the outer nodes. … … 145 145 std::vector<typename Graph::Node> inner; 146 146 ///Vector containing the edges of the inner circle. 147 std::vector<typename Graph::U ndirEdge> incir;147 std::vector<typename Graph::UEdge> incir; 148 148 ///Vector containing the edges of the outer circle. 149 std::vector<typename Graph::U ndirEdge> outcir;149 std::vector<typename Graph::UEdge> outcir; 150 150 ///Vector containing the chord edges. 151 std::vector<typename Graph::U ndirEdge> chords;151 std::vector<typename Graph::UEdge> chords; 152 152 }; 153 153 … … 158 158 159 159 template<typename Graph> 160 U ndirPetStruct<Graph> addUndirPetersen(Graph &G,int num=5)160 UPetStruct<Graph> addUPetersen(Graph &G,int num=5) 161 161 { 162 U ndirPetStruct<Graph> n;162 UPetStruct<Graph> n; 163 163 164 164 for(int i=0;i<num;i++) { -
test/ugraph_test.cc
r1795 r1909 2 2 3 3 #include <lemon/bits/graph_extender.h> 4 #include <lemon/concept/u ndir_graph.h>4 #include <lemon/concept/ugraph.h> 5 5 #include <lemon/list_graph.h> 6 6 #include <lemon/smart_graph.h> … … 17 17 18 18 void check_concepts() { 19 typedef U ndirGraphExtender<ListGraphBase> UndirListGraphBase;20 21 typedef IterableU ndirGraphExtender<22 AlterableU ndirGraphExtender<UndirListGraphBase> > IterableUndirListGraph;23 24 typedef MappableU ndirGraphExtender<IterableUndirListGraph>25 Mappable UndirListGraph;26 27 typedef ErasableU ndirGraphExtender<28 ClearableU ndirGraphExtender<29 ExtendableU ndirGraphExtender<MappableUndirListGraph> > > Graph;30 31 checkConcept<BaseIterableU ndirGraphConcept, Graph>();32 checkConcept<IterableU ndirGraphConcept, Graph>();33 checkConcept<MappableU ndirGraphConcept, Graph>();34 35 checkConcept<U ndirGraph, Graph>();36 checkConcept<ErasableU ndirGraph, Graph>();37 38 checkConcept<U ndirGraph, UndirListGraph>();39 checkConcept<ErasableU ndirGraph, UndirListGraph>();40 41 checkConcept<U ndirGraph, UndirSmartGraph>();42 checkConcept<ExtendableU ndirGraph, UndirSmartGraph>();43 44 checkConcept<U ndirGraph, UndirFullGraph>();45 46 checkConcept<U ndirGraph, UndirGraph>();47 48 checkConcept<U ndirGraph, GridGraph>();19 typedef UGraphExtender<ListGraphBase> ListUGraphBase; 20 21 typedef IterableUGraphExtender< 22 AlterableUGraphExtender<ListUGraphBase> > IterableListUGraph; 23 24 typedef MappableUGraphExtender<IterableListUGraph> 25 MappableListUGraph; 26 27 typedef ErasableUGraphExtender< 28 ClearableUGraphExtender< 29 ExtendableUGraphExtender<MappableListUGraph> > > Graph; 30 31 checkConcept<BaseIterableUGraphConcept, Graph>(); 32 checkConcept<IterableUGraphConcept, Graph>(); 33 checkConcept<MappableUGraphConcept, Graph>(); 34 35 checkConcept<UGraph, Graph>(); 36 checkConcept<ErasableUGraph, Graph>(); 37 38 checkConcept<UGraph, ListUGraph>(); 39 checkConcept<ErasableUGraph, ListUGraph>(); 40 41 checkConcept<UGraph, SmartUGraph>(); 42 checkConcept<ExtendableUGraph, SmartUGraph>(); 43 44 checkConcept<UGraph, FullUGraph>(); 45 46 checkConcept<UGraph, UGraph>(); 47 48 checkConcept<UGraph, GridGraph>(); 49 49 } 50 50 … … 68 68 69 69 int uee = 0; 70 for (typename Graph::U ndirEdgeIt it(g); it != INVALID; ++it) {70 for (typename Graph::UEdgeIt it(g); it != INVALID; ++it) { 71 71 ++uee; 72 72 } 73 73 74 check(uee == e, "Wrong u ndiredge number.");75 check(countU ndirEdges(g) == e, "Wrong undiredge number.");74 check(uee == e, "Wrong uedge number."); 75 check(countUEdges(g) == e, "Wrong uedge number."); 76 76 } 77 77 … … 80 80 81 81 typedef typename Graph::NodeIt NodeIt; 82 typedef typename Graph::U ndirEdgeIt UEdgeIt;82 typedef typename Graph::UEdgeIt UEdgeIt; 83 83 typedef typename Graph::EdgeIt EdgeIt; 84 84 … … 89 89 } 90 90 91 std::cout << "U ndirEdge" << std::endl;91 std::cout << "UEdge" << std::endl; 92 92 i=0; 93 93 for(UEdgeIt it(g); it!=INVALID; ++it, ++i) { … … 111 111 112 112 typedef typename Graph::Node Node; 113 typedef typename Graph::U ndirEdge UEdge;113 typedef typename Graph::UEdge UEdge; 114 114 typedef typename Graph::Edge Edge; 115 115 typedef typename Graph::NodeIt NodeIt; 116 typedef typename Graph::U ndirEdgeIt UEdgeIt;116 typedef typename Graph::UEdgeIt UEdgeIt; 117 117 typedef typename Graph::EdgeIt EdgeIt; 118 118 … … 182 182 check_concepts(); 183 183 184 check_graph< UndirListGraph>();185 check_graph< UndirSmartGraph>();184 check_graph<ListUGraph>(); 185 check_graph<SmartUGraph>(); 186 186 187 187 { 188 UndirFullGraph g(5);188 FullUGraph g(5); 189 189 check_item_counts(g, 5, 10); 190 190 }
Note: See TracChangeset
for help on using the changeset viewer.