src/lemon/graph_utils.h
changeset 1053 90f8696360b2
parent 986 e997802b855c
child 1079 81addddaf3d3
     1.1 --- a/src/lemon/graph_utils.h	Wed Jan 05 12:26:59 2005 +0000
     1.2 +++ b/src/lemon/graph_utils.h	Wed Jan 05 14:34:00 2005 +0000
     1.3 @@ -103,17 +103,33 @@
     1.4      return _countEdges<Graph>(g);
     1.5    }
     1.6  
     1.7 -  /// \brief Function to count the symmetric edges in the graph.
     1.8 +  // Undirected edge counting:
     1.9 +
    1.10 +  template <typename Graph>
    1.11 +  inline
    1.12 +  typename enable_if<typename Graph::EdgeNumTag, int>::type
    1.13 +  _countUndirEdges(const Graph &g) {
    1.14 +    return g.undirEdgeNum();
    1.15 +  }
    1.16 +
    1.17 +  template <typename Graph>
    1.18 +  inline int _countUndirEdges(Wrap<Graph> w) {
    1.19 +    return countItems<Graph, typename Graph::UndirEdgeIt>(w.value);
    1.20 +  }
    1.21 +
    1.22 +  /// \brief Function to count the edges in the graph.
    1.23    ///
    1.24 -  /// This function counts the symmetric edges in the graph.
    1.25 +  /// This function counts the edges in the graph.
    1.26    /// The complexity of the function is O(e) but for some
    1.27    /// graph structure it is specialized to run in O(1).
    1.28 +
    1.29    template <typename Graph>
    1.30 -  inline int countSymEdges(const Graph& _g) {
    1.31 -    return countItems<Graph, typename Graph::SymEdgeIt>(_g);
    1.32 +  inline int countUndirEdges(const Graph& g) {
    1.33 +    return _countUndirEdges<Graph>(g);
    1.34    }
    1.35  
    1.36  
    1.37 +
    1.38    template <typename Graph, typename DegIt>
    1.39    inline int countNodeDegree(const Graph& _g, const typename Graph::Node& _n) {
    1.40      int num = 0;