Changeset 1130:0759d974de81 in lemonmain for lemon/concepts/graph.h
 Timestamp:
 01/05/14 22:24:56 (6 years ago)
 Branch:
 default
 Phase:
 public
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/concepts/graph.h
r1093 r1130 28 28 #include <lemon/concept_check.h> 29 29 #include <lemon/core.h> 30 #include <lemon/bits/stl_iterators.h> 30 31 31 32 namespace lemon { … … 181 182 }; 182 183 184 /// \brief Gets the collection of the nodes of the graph. 185 /// 186 /// This function can be used for iterating on 187 /// the nodes of the graph. It returns a wrapped NodeIt, which looks 188 /// like an STL container (by having begin() and end()) 189 /// which you can use in rangebased for loops, STL algorithms, etc. 190 /// For example you can write: 191 ///\code 192 /// ListGraph g; 193 /// for(auto v: g.nodes()) 194 /// doSomething(v); 195 /// 196 /// //Using an STL algorithm: 197 /// copy(g.nodes().begin(), g.nodes().end(), vect.begin()); 198 ///\endcode 199 LemonRangeWrapper1<NodeIt, Graph> nodes() const { 200 return LemonRangeWrapper1<NodeIt, Graph>(*this); 201 } 202 183 203 184 204 /// The edge type of the graph … … 268 288 EdgeIt& operator++() { return *this; } 269 289 }; 290 291 /// \brief Gets the collection of the edges of the graph. 292 /// 293 /// This function can be used for iterating on the 294 /// edges of the graph. It returns a wrapped 295 /// EdgeIt, which looks like an STL container 296 /// (by having begin() and end()) which you can use in rangebased 297 /// for loops, STL algorithms, etc. 298 /// For example you can write: 299 ///\code 300 /// ListGraph g; 301 /// for(auto e: g.edges()) 302 /// doSomething(e); 303 /// 304 /// //Using an STL algorithm: 305 /// copy(g.edges().begin(), g.edges().end(), vect.begin()); 306 ///\endcode 307 LemonRangeWrapper1<EdgeIt, Graph> edges() const { 308 return LemonRangeWrapper1<EdgeIt, Graph>(*this); 309 } 310 270 311 271 312 /// Iterator class for the incident edges of a node. … … 317 358 }; 318 359 360 /// \brief Gets the collection of the incident undirected edges 361 /// of a certain node of the graph. 362 /// 363 /// This function can be used for iterating on the 364 /// incident undirected edges of a certain node of the graph. 365 /// It returns a wrapped 366 /// IncEdgeIt, which looks like an STL container 367 /// (by having begin() and end()) which you can use in rangebased 368 /// for loops, STL algorithms, etc. 369 /// For example if g is a Graph and u is a Node, you can write: 370 ///\code 371 /// for(auto e: g.incEdges(u)) 372 /// doSomething(e); 373 /// 374 /// //Using an STL algorithm: 375 /// copy(g.incEdges(u).begin(), g.incEdges(u).end(), vect.begin()); 376 ///\endcode 377 LemonRangeWrapper2<IncEdgeIt, Graph, Node> incEdges(const Node& u) const { 378 return LemonRangeWrapper2<IncEdgeIt, Graph, Node>(*this, u); 379 } 380 381 319 382 /// The arc type of the graph 320 383 … … 411 474 ArcIt& operator++() { return *this; } 412 475 }; 476 477 /// \brief Gets the collection of the directed arcs of the graph. 478 /// 479 /// This function can be used for iterating on the 480 /// arcs of the graph. It returns a wrapped 481 /// ArcIt, which looks like an STL container 482 /// (by having begin() and end()) which you can use in rangebased 483 /// for loops, STL algorithms, etc. 484 /// For example you can write: 485 ///\code 486 /// ListGraph g; 487 /// for(auto a: g.arcs()) 488 /// doSomething(a); 489 /// 490 /// //Using an STL algorithm: 491 /// copy(g.arcs().begin(), g.arcs().end(), vect.begin()); 492 ///\endcode 493 LemonRangeWrapper1<ArcIt, Graph> arcs() const { 494 return LemonRangeWrapper1<ArcIt, Graph>(*this); 495 } 496 413 497 414 498 /// Iterator class for the outgoing arcs of a node. … … 460 544 }; 461 545 546 /// \brief Gets the collection of the outgoing directed arcs of a 547 /// certain node of the graph. 548 /// 549 /// This function can be used for iterating on the 550 /// outgoing arcs of a certain node of the graph. It returns a wrapped 551 /// OutArcIt, which looks like an STL container 552 /// (by having begin() and end()) which you can use in rangebased 553 /// for loops, STL algorithms, etc. 554 /// For example if g is a Graph and u is a Node, you can write: 555 ///\code 556 /// for(auto a: g.outArcs(u)) 557 /// doSomething(a); 558 /// 559 /// //Using an STL algorithm: 560 /// copy(g.outArcs(u).begin(), g.outArcs(u).end(), vect.begin()); 561 ///\endcode 562 LemonRangeWrapper2<OutArcIt, Graph, Node> outArcs(const Node& u) const { 563 return LemonRangeWrapper2<OutArcIt, Graph, Node>(*this, u); 564 } 565 566 462 567 /// Iterator class for the incoming arcs of a node. 463 568 … … 507 612 InArcIt& operator++() { return *this; } 508 613 }; 614 615 /// \brief Gets the collection of the incoming directed arcs of 616 /// a certain node of the graph. 617 /// 618 /// This function can be used for iterating on the 619 /// incoming directed arcs of a certain node of the graph. It returns 620 /// a wrapped InArcIt, which looks like an STL container 621 /// (by having begin() and end()) which you can use in rangebased 622 /// for loops, STL algorithms, etc. 623 /// For example if g is a Graph and u is a Node, you can write: 624 ///\code 625 /// for(auto a: g.inArcs(u)) 626 /// doSomething(a); 627 /// 628 /// //Using an STL algorithm: 629 /// copy(g.inArcs(u).begin(), g.inArcs(u).end(), vect.begin()); 630 ///\endcode 631 LemonRangeWrapper2<InArcIt, Graph, Node> inArcs(const Node& u) const { 632 return LemonRangeWrapper2<InArcIt, Graph, Node>(*this, u); 633 } 509 634 510 635 /// \brief Standard graph map type for the nodes.
Note: See TracChangeset
for help on using the changeset viewer.