Changeset 1419:c3244a26adb1 in lemon0.x
 Timestamp:
 05/14/05 19:34:31 (14 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1889
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/lemon/graph_utils.h
r1413 r1419 19 19 20 20 #include <iterator> 21 #include <vector> 21 22 #include <map> 22 23 … … 267 268 268 269 template <typename _Graph, typename _Item> 269 class ItemSetTraits { 270 }; 270 class ItemSetTraits {}; 271 271 272 272 template <typename _Graph> … … 362 362 }; 363 363 364 365 364 /// Provides an immutable and unique id for each item in the graph. 366 365 … … 376 375 typedef _Item Key; 377 376 377 typedef True NeedCopy; 378 378 379 /// \brief Constructor. 379 380 /// … … 398 399 class InverseMap { 399 400 public: 401 402 typedef True NeedCopy; 403 400 404 /// \brief Constructor. 401 405 /// … … 694 698 class SourceMap { 695 699 public: 700 701 typedef True NeedCopy; 702 696 703 typedef typename Graph::Node Value; 697 704 typedef typename Graph::Edge Key; … … 732 739 class TargetMap { 733 740 public: 741 742 typedef True NeedCopy; 743 734 744 typedef typename Graph::Node Value; 735 745 typedef typename Graph::Edge Key; … … 763 773 } 764 774 775 /// \brief Returns the "forward" directed edge view of undirected edge. 776 /// 777 /// Returns the "forward" directed edge view of undirected edge. 778 /// \author Balazs Dezso 779 template <typename Graph> 780 class ForwardMap { 781 public: 782 783 typedef True NeedCopy; 784 785 typedef typename Graph::Edge Value; 786 typedef typename Graph::UndirEdge Key; 787 788 /// \brief Constructor 789 /// 790 /// Constructor 791 /// \param _graph The graph that the map belongs to. 792 ForwardMap(const Graph& _graph) : graph(_graph) {} 793 794 /// \brief The subscript operator. 795 /// 796 /// The subscript operator. 797 /// \param key An undirected edge 798 /// \return The "forward" directed edge view of undirected edge 799 Value operator[](const Key& key) const { 800 return graph.edgeWithSource(key, graph.source(key)); 801 } 802 803 private: 804 const Graph& graph; 805 }; 806 807 /// \brief Returns a \ref ForwardMap class 808 809 /// This function just returns an \ref ForwardMap class. 810 /// \relates ForwardMap 811 template <typename Graph> 812 inline ForwardMap<Graph> forwardMap(const Graph& graph) { 813 return ForwardMap<Graph>(graph); 814 } 815 816 /// \brief Returns the "backward" directed edge view of undirected edge. 817 /// 818 /// Returns the "backward" directed edge view of undirected edge. 819 /// \author Balazs Dezso 820 template <typename Graph> 821 class BackwardMap { 822 public: 823 typedef True NeedCopy; 824 825 typedef typename Graph::Edge Value; 826 typedef typename Graph::UndirEdge Key; 827 828 /// \brief Constructor 829 /// 830 /// Constructor 831 /// \param _graph The graph that the map belongs to. 832 BackwardMap(const Graph& _graph) : graph(_graph) {} 833 834 /// \brief The subscript operator. 835 /// 836 /// The subscript operator. 837 /// \param key An undirected edge 838 /// \return The "backward" directed edge view of undirected edge 839 Value operator[](const Key& key) const { 840 return graph.edgeWithSource(key, graph.target(key)); 841 } 842 843 private: 844 const Graph& graph; 845 }; 846 847 /// \brief Returns a \ref BackwardMap class 848 849 /// This function just returns an \ref BackwardMap class. 850 /// \relates BackwardMap 851 template <typename Graph> 852 inline BackwardMap<Graph> backwardMap(const Graph& graph) { 853 return BackwardMap<Graph>(graph); 854 } 855 765 856 766 857 /// @}
Note: See TracChangeset
for help on using the changeset viewer.