101 template <typename Graph> |
101 template <typename Graph> |
102 inline int countEdges(const Graph& g) { |
102 inline int countEdges(const Graph& g) { |
103 return _countEdges<Graph>(g); |
103 return _countEdges<Graph>(g); |
104 } |
104 } |
105 |
105 |
106 /// \brief Function to count the symmetric edges in the graph. |
106 // Undirected edge counting: |
107 /// |
107 |
108 /// This function counts the symmetric edges in the graph. |
108 template <typename Graph> |
|
109 inline |
|
110 typename enable_if<typename Graph::EdgeNumTag, int>::type |
|
111 _countUndirEdges(const Graph &g) { |
|
112 return g.undirEdgeNum(); |
|
113 } |
|
114 |
|
115 template <typename Graph> |
|
116 inline int _countUndirEdges(Wrap<Graph> w) { |
|
117 return countItems<Graph, typename Graph::UndirEdgeIt>(w.value); |
|
118 } |
|
119 |
|
120 /// \brief Function to count the edges in the graph. |
|
121 /// |
|
122 /// This function counts the edges in the graph. |
109 /// The complexity of the function is O(e) but for some |
123 /// The complexity of the function is O(e) but for some |
110 /// graph structure it is specialized to run in O(1). |
124 /// graph structure it is specialized to run in O(1). |
111 template <typename Graph> |
125 |
112 inline int countSymEdges(const Graph& _g) { |
126 template <typename Graph> |
113 return countItems<Graph, typename Graph::SymEdgeIt>(_g); |
127 inline int countUndirEdges(const Graph& g) { |
114 } |
128 return _countUndirEdges<Graph>(g); |
|
129 } |
|
130 |
115 |
131 |
116 |
132 |
117 template <typename Graph, typename DegIt> |
133 template <typename Graph, typename DegIt> |
118 inline int countNodeDegree(const Graph& _g, const typename Graph::Node& _n) { |
134 inline int countNodeDegree(const Graph& _g, const typename Graph::Node& _n) { |
119 int num = 0; |
135 int num = 0; |