Changeset 2111:ea1fa1bc3f6d in lemon0.x for lemon/concept/graph.h
 Timestamp:
 06/28/06 17:06:24 (14 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@2817
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/concept/graph.h
r2090 r2111 39 39 // \brief Modular static graph class. 40 40 // 41 // It should be the same as the \c StaticGraph class.42 class _ StaticGraph41 // It should be the same as the \c Graph class. 42 class _Graph 43 43 : virtual public BaseGraphComponent, 44 44 public IterableGraphComponent, public MappableGraphComponent { … … 57 57 }; 58 58 59 // \brief Modular extendable graph class.60 //61 // It should be the same as the \c ExtendableGraph class.62 class _ExtendableGraph63 : virtual public BaseGraphComponent, public _StaticGraph,64 public ExtendableGraphComponent, public ClearableGraphComponent {65 public:66 typedef BaseGraphComponent::Node Node;67 typedef BaseGraphComponent::Edge Edge;68 69 template <typename _Graph>70 struct Constraints {71 void constraints() {72 checkConcept<_StaticGraph, _Graph >();73 checkConcept<ExtendableGraphComponent, _Graph >();74 checkConcept<ClearableGraphComponent, _Graph >();75 }76 };77 };78 79 // \brief Modular erasable graph class.80 //81 // It should be the same as the \c ErasableGraph class.82 class _ErasableGraph83 : virtual public BaseGraphComponent, public _ExtendableGraph,84 public ErasableGraphComponent {85 public:86 typedef BaseGraphComponent::Node Node;87 typedef BaseGraphComponent::Edge Edge;88 89 template <typename _Graph>90 struct Constraints {91 void constraints() {92 checkConcept<_ExtendableGraph, _Graph >();93 checkConcept<ErasableGraphComponent, _Graph >();94 }95 };96 };97 98 59 /// \addtogroup graph_concepts 99 60 /// @{ 100 61 101 /// An empty staticgraph class.62 /// An empty graph class. 102 63 103 64 /// This class provides all the common features of a graph structure, … … 117 78 /// \todo A pages describing the concept of concept description would 118 79 /// be nice. 119 class StaticGraph 120 { 121 // ///Copy consructor. 122 123 // ///\todo It is not clear, what we expect from a copy constructor. 124 // ///E.g. How to assign the nodes/edges to each other? What about maps? 125 // StaticGraph(const StaticGraph& g) { } 80 class Graph { 126 81 public: 127 82 ///\e … … 131 86 /// Defalult constructor. 132 87 /// 133 StaticGraph() { }88 Graph() { } 134 89 135 90 /// The base type of node iterators, … … 214 169 /// Sets the iterator to the first node of \c g. 215 170 /// 216 NodeIt(const StaticGraph&) { }171 NodeIt(const Graph&) { } 217 172 /// Node > NodeIt conversion. 218 173 … … 221 176 /// This feature necessitates that each time we 222 177 /// iterate the edgeset, the iteration order is the same. 223 NodeIt(const StaticGraph&, const Node&) { }178 NodeIt(const Graph&, const Node&) { } 224 179 /// Next node. 225 180 … … 308 263 /// This constructor sets the iterator to the first outgoing edge of 309 264 /// the node. 310 OutEdgeIt(const StaticGraph&, const Node&) { }265 OutEdgeIt(const Graph&, const Node&) { } 311 266 /// Edge > OutEdgeIt conversion 312 267 … … 314 269 /// This feature necessitates that each time we 315 270 /// iterate the edgeset, the iteration order is the same. 316 OutEdgeIt(const StaticGraph&, const Edge&) { }271 OutEdgeIt(const Graph&, const Edge&) { } 317 272 ///Next outgoing edge 318 273 … … 355 310 /// This constructor set the iterator to the first incoming edge of 356 311 /// the node. 357 InEdgeIt(const StaticGraph&, const Node&) { }312 InEdgeIt(const Graph&, const Node&) { } 358 313 /// Edge > InEdgeIt conversion 359 314 … … 361 316 /// This feature necessitates that each time we 362 317 /// iterate the edgeset, the iteration order is the same. 363 InEdgeIt(const StaticGraph&, const Edge&) { }318 InEdgeIt(const Graph&, const Edge&) { } 364 319 /// Next incoming edge 365 320 … … 398 353 /// This constructor sets the iterator to the first edge of \c g. 399 354 ///@param g the graph 400 EdgeIt(const StaticGraph& g) { ignore_unused_variable_warning(g); }355 EdgeIt(const Graph& g) { ignore_unused_variable_warning(g); } 401 356 /// Edge > EdgeIt conversion 402 357 … … 404 359 /// This feature necessitates that each time we 405 360 /// iterate the edgeset, the iteration order is the same. 406 EdgeIt(const StaticGraph&, const Edge&) { }361 EdgeIt(const Graph&, const Edge&) { } 407 362 ///Next edge 408 363 … … 421 376 Node source(Edge) const { return INVALID; } 422 377 423 // /// Gives back the first Node in the iterating order.424 425 // /// Gives back the first Node in the iterating order.426 // ///427 378 void first(Node&) const {} 428 429 // /// Gives back the next Node in the iterating order.430 431 // /// Gives back the next Node in the iterating order.432 // ///433 379 void next(Node&) const {} 434 380 435 // /// Gives back the first Edge in the iterating order.436 437 // /// Gives back the first Edge in the iterating order.438 // ///439 381 void first(Edge&) const {} 440 // /// Gives back the next Edge in the iterating order.441 442 // /// Gives back the next Edge in the iterating order.443 // ///444 382 void next(Edge&) const {} 445 383 446 384 447 // /// Gives back the first of the Edges point to the given Node.448 449 // /// Gives back the first of the Edges point to the given Node.450 // ///451 385 void firstIn(Edge&, const Node&) const {} 452 453 // /// Gives back the next of the Edges points to the given Node.454 455 456 // /// Gives back the next of the Edges points to the given Node.457 // ///458 386 void nextIn(Edge&) const {} 459 387 460 // /// Gives back the first of the Edges start from the given Node.461 462 // /// Gives back the first of the Edges start from the given Node.463 // ///464 388 void firstOut(Edge&, const Node&) const {} 465 466 // /// Gives back the next of the Edges start from the given Node.467 468 // /// Gives back the next of the Edges start from the given Node.469 // ///470 389 void nextOut(Edge&) const {} 471 390 … … 512 431 513 432 ///\e 514 NodeMap(const StaticGraph&) { }433 NodeMap(const Graph&) { } 515 434 ///\e 516 NodeMap(const StaticGraph&, T) { }435 NodeMap(const Graph&, T) { } 517 436 518 437 ///Copy constructor … … 536 455 537 456 ///\e 538 EdgeMap(const StaticGraph&) { }457 EdgeMap(const Graph&) { } 539 458 ///\e 540 EdgeMap(const StaticGraph&, T) { }459 EdgeMap(const Graph&, T) { } 541 460 ///Copy constructor 542 461 EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) { } … … 546 465 }; 547 466 548 template <typename _Graph> 549 struct Constraints : public _StaticGraph::Constraints<_Graph> {}; 550 551 }; 552 553 /// An empty nonstatic graph class. 554 555 /// This class provides everything that \ref StaticGraph does. 556 /// Additionally it enables building graphs from scratch. 557 class ExtendableGraph : public StaticGraph 558 { 559 public: 560 /// Defalult constructor. 561 562 /// Defalult constructor. 563 /// 564 ExtendableGraph() { } 565 ///Add a new node to the graph. 566 567 /// \return the new node. 568 /// 569 Node addNode() { return INVALID; } 570 ///Add a new edge to the graph. 571 572 ///Add a new edge to the graph with source node \c s 573 ///and target node \c t. 574 ///\return the new edge. 575 Edge addEdge(Node, Node) { return INVALID; } 576 577 /// Resets the graph. 578 579 /// This function deletes all edges and nodes of the graph. 580 /// It also frees the memory allocated to store them. 581 /// \todo It might belong to \ref ErasableGraph. 582 void clear() { } 583 584 template <typename _Graph> 585 struct Constraints : public _ExtendableGraph::Constraints<_Graph> {}; 586 587 }; 588 589 /// An empty erasable graph class. 590 591 /// This class is an extension of \ref ExtendableGraph. It makes it 592 /// possible to erase edges or nodes. 593 class ErasableGraph : public ExtendableGraph 594 { 595 public: 596 /// Defalult constructor. 597 598 /// Defalult constructor. 599 /// 600 ErasableGraph() { } 601 /// Deletes a node. 602 603 /// Deletes node \c n node. 604 /// 605 void erase(Node) { } 606 /// Deletes an edge. 607 608 /// Deletes edge \c e edge. 609 /// 610 void erase(Edge) { } 611 612 template <typename _Graph> 613 struct Constraints : public _ErasableGraph::Constraints<_Graph> {}; 467 template <typename RGraph> 468 struct Constraints : public _Graph::Constraints<RGraph> {}; 614 469 615 470 };
Note: See TracChangeset
for help on using the changeset viewer.