equal
deleted
inserted
replaced
68 /// |
68 /// |
69 /// \brief Count the number of connected components of an undirected graph |
69 /// \brief Count the number of connected components of an undirected graph |
70 /// |
70 /// |
71 /// Count the number of connected components of an undirected graph |
71 /// Count the number of connected components of an undirected graph |
72 /// |
72 /// |
73 /// \param g The graph. In must be undirected. |
73 /// \param graph The graph. It should be undirected. |
74 /// \return The number of components |
74 /// \return The number of components |
75 template <typename UndirGraph> |
75 template <typename UndirGraph> |
76 int countConnectedComponents(const UndirGraph &graph) { |
76 int countConnectedComponents(const UndirGraph &graph) { |
77 checkConcept<concept::UndirGraph, UndirGraph>(); |
77 checkConcept<concept::UndirGraph, UndirGraph>(); |
78 typedef typename UndirGraph::Node Node; |
78 typedef typename UndirGraph::Node Node; |
111 /// Find the connected components of an undirected graph. |
111 /// Find the connected components of an undirected graph. |
112 /// |
112 /// |
113 /// \image html connected_components.png |
113 /// \image html connected_components.png |
114 /// \image latex connected_components.eps "Connected components" width=\textwidth |
114 /// \image latex connected_components.eps "Connected components" width=\textwidth |
115 /// |
115 /// |
116 /// \param g The graph. In must be undirected. |
116 /// \param graph The graph. It should be undirected. |
117 /// \retval comp A writable node map. The values will be set from 0 to |
117 /// \retval compMap A writable node map. The values will be set from 0 to |
118 /// the number of the connected components minus one. Each values of the map |
118 /// the number of the connected components minus one. Each values of the map |
119 /// will be set exactly once, the values of a certain component will be |
119 /// will be set exactly once, the values of a certain component will be |
120 /// set continuously. |
120 /// set continuously. |
121 /// \return The number of components |
121 /// \return The number of components |
122 /// |
122 /// |
235 /// graph is strongly connected when any two nodes of the graph are |
235 /// graph is strongly connected when any two nodes of the graph are |
236 /// connected with directed pathes in both direction. |
236 /// connected with directed pathes in both direction. |
237 /// \return %False when the graph is not strongly connected. |
237 /// \return %False when the graph is not strongly connected. |
238 /// \see connected |
238 /// \see connected |
239 /// |
239 /// |
240 /// \waning Empty graph is not strongly connected. |
240 /// \warning Empty graph is not strongly connected. |
241 template <typename Graph> |
241 template <typename Graph> |
242 bool stronglyConnected(const Graph& graph) { |
242 bool stronglyConnected(const Graph& graph) { |
243 checkConcept<concept::StaticGraph, Graph>(); |
243 checkConcept<concept::StaticGraph, Graph>(); |
244 if (NodeIt(graph) == INVALID) return false; |
244 if (NodeIt(graph) == INVALID) return false; |
245 |
245 |
289 /// Count the strongly connected components of a directed graph. |
289 /// Count the strongly connected components of a directed graph. |
290 /// The strongly connected components are the classes of an equivalence |
290 /// The strongly connected components are the classes of an equivalence |
291 /// relation on the nodes of the graph. Two nodes are connected with |
291 /// relation on the nodes of the graph. Two nodes are connected with |
292 /// directed paths in both direction. |
292 /// directed paths in both direction. |
293 /// |
293 /// |
294 /// \param g The graph. |
294 /// \param graph The graph. |
295 /// \return The number of components |
295 /// \return The number of components |
296 template <typename Graph> |
296 template <typename Graph> |
297 int countStronglyConnectedComponents(const Graph& graph) { |
297 int countStronglyConnectedComponents(const Graph& graph) { |
298 checkConcept<concept::StaticGraph, Graph>(); |
298 checkConcept<concept::StaticGraph, Graph>(); |
299 |
299 |
353 /// when there are directed paths between them in both direction. |
353 /// when there are directed paths between them in both direction. |
354 /// |
354 /// |
355 /// \image html strongly_connected_components.png |
355 /// \image html strongly_connected_components.png |
356 /// \image latex strongly_connected_components.eps "Strongly connected components" width=\textwidth |
356 /// \image latex strongly_connected_components.eps "Strongly connected components" width=\textwidth |
357 /// |
357 /// |
358 /// \param g The graph. |
358 /// \param graph The graph. |
359 /// \retval comp A writable node map. The values will be set from 0 to |
359 /// \param compMap A writable node map. The values will be set from 0 to |
|
360 /// the number of the connected components minus one. Each values of the map |
|
361 /// will be set exactly once, the values of a certain component will be |
|
362 /// set continuously. |
|
363 /// \retval compMap A writable node map. The values will be set from 0 to |
360 /// the number of the strongly connected components minus one. Each values |
364 /// the number of the strongly connected components minus one. Each values |
361 /// of the map will be set exactly once, the values of a certain component |
365 /// of the map will be set exactly once, the values of a certain component |
362 /// will be set continuously. |
366 /// will be set continuously. |
363 /// \return The number of components |
367 /// \return The number of components |
364 /// |
368 /// |
418 /// The strongly connected components are the classes of an equivalence |
422 /// The strongly connected components are the classes of an equivalence |
419 /// relation on the nodes of the graph. Two nodes are in relationship |
423 /// relation on the nodes of the graph. Two nodes are in relationship |
420 /// when there are directed paths between them in both direction. |
424 /// when there are directed paths between them in both direction. |
421 /// The strongly connected components are separated by the cut edges. |
425 /// The strongly connected components are separated by the cut edges. |
422 /// |
426 /// |
423 /// \param g The graph. |
427 /// \param graph The graph. |
424 /// \retval comp A writable edge map. The values will be set true when |
428 /// \retval cutMap A writable node map. The values will be set true when the |
425 /// the edge is cut edge otherwise false. |
429 /// edge is a cut edge. |
426 /// |
430 /// |
427 /// \return The number of cut edges |
431 /// \return The number of cut edges |
428 template <typename Graph, typename EdgeMap> |
432 template <typename Graph, typename EdgeMap> |
429 int stronglyConnectedCutEdges(const Graph& graph, EdgeMap& cutMap) { |
433 int stronglyConnectedCutEdges(const Graph& graph, EdgeMap& cutMap) { |
430 checkConcept<concept::StaticGraph, Graph>(); |
434 checkConcept<concept::StaticGraph, Graph>(); |
756 /// |
760 /// |
757 /// \image html node_biconnected_components.png |
761 /// \image html node_biconnected_components.png |
758 /// \image latex node_biconnected_components.eps "bi-node-connected components" width=\textwidth |
762 /// \image latex node_biconnected_components.eps "bi-node-connected components" width=\textwidth |
759 /// |
763 /// |
760 /// \param graph The graph. |
764 /// \param graph The graph. |
761 /// \retval comp A writable undir edge map. The values will be set from 0 to |
765 /// \retval compMap A writable undir edge map. The values will be set from 0 |
762 /// the number of the biconnected components minus one. Each values |
766 /// to the number of the biconnected components minus one. Each values |
763 /// of the map will be set exactly once, the values of a certain component |
767 /// of the map will be set exactly once, the values of a certain component |
764 /// will be set continuously. |
768 /// will be set continuously. |
765 /// \return The number of components. |
769 /// \return The number of components. |
766 /// |
770 /// |
767 template <typename UndirGraph, typename UndirEdgeMap> |
771 template <typename UndirGraph, typename UndirEdgeMap> |
800 /// relation on the undirected edges. Two undirected edges are in |
804 /// relation on the undirected edges. Two undirected edges are in |
801 /// relationship when they are on same circle. The biconnected components |
805 /// relationship when they are on same circle. The biconnected components |
802 /// are separted by nodes which are the cut nodes of the components. |
806 /// are separted by nodes which are the cut nodes of the components. |
803 /// |
807 /// |
804 /// \param graph The graph. |
808 /// \param graph The graph. |
805 /// \retval comp A writable edge map. The values will be set true when |
809 /// \retval cutMap A writable edge map. The values will be set true when |
806 /// the node separate two or more components. |
810 /// the node separate two or more components. |
807 /// \return The number of the cut nodes. |
811 /// \return The number of the cut nodes. |
808 template <typename UndirGraph, typename NodeMap> |
812 template <typename UndirGraph, typename NodeMap> |
809 int biNodeConnectedCutNodes(const UndirGraph& graph, NodeMap& cutMap) { |
813 int biNodeConnectedCutNodes(const UndirGraph& graph, NodeMap& cutMap) { |
810 checkConcept<concept::UndirGraph, UndirGraph>(); |
814 checkConcept<concept::UndirGraph, UndirGraph>(); |
1083 /// |
1087 /// |
1084 /// \image html edge_biconnected_components.png |
1088 /// \image html edge_biconnected_components.png |
1085 /// \image latex edge_biconnected_components.eps "bi-edge-connected components" width=\textwidth |
1089 /// \image latex edge_biconnected_components.eps "bi-edge-connected components" width=\textwidth |
1086 /// |
1090 /// |
1087 /// \param graph The graph. |
1091 /// \param graph The graph. |
1088 /// \retval comp A writable node map. The values will be set from 0 to |
1092 /// \retval compMap A writable node map. The values will be set from 0 to |
1089 /// the number of the biconnected components minus one. Each values |
1093 /// the number of the biconnected components minus one. Each values |
1090 /// of the map will be set exactly once, the values of a certain component |
1094 /// of the map will be set exactly once, the values of a certain component |
1091 /// will be set continuously. |
1095 /// will be set continuously. |
1092 /// \return The number of components. |
1096 /// \return The number of components. |
1093 /// |
1097 /// |
1127 /// connected with at least two edge-disjoint paths. The bi-edge-connected |
1131 /// connected with at least two edge-disjoint paths. The bi-edge-connected |
1128 /// components are separted by edges which are the cut edges of the |
1132 /// components are separted by edges which are the cut edges of the |
1129 /// components. |
1133 /// components. |
1130 /// |
1134 /// |
1131 /// \param graph The graph. |
1135 /// \param graph The graph. |
1132 /// \retval comp A writable node map. The values will be set true when the |
1136 /// \retval cutMap A writable node map. The values will be set true when the |
1133 /// edge is a cut edge. |
1137 /// edge is a cut edge. |
1134 /// \return The number of cut edges. |
1138 /// \return The number of cut edges. |
1135 template <typename UndirGraph, typename UndirEdgeMap> |
1139 template <typename UndirGraph, typename UndirEdgeMap> |
1136 int biEdgeConnectedCutEdges(const UndirGraph& graph, UndirEdgeMap& cutMap) { |
1140 int biEdgeConnectedCutEdges(const UndirGraph& graph, UndirEdgeMap& cutMap) { |
1137 checkConcept<concept::UndirGraph, UndirGraph>(); |
1141 checkConcept<concept::UndirGraph, UndirGraph>(); |
1185 /// |
1189 /// |
1186 /// \brief Sort the nodes of a DAG into topolgical order. |
1190 /// \brief Sort the nodes of a DAG into topolgical order. |
1187 /// |
1191 /// |
1188 /// Sort the nodes of a DAG into topolgical order. |
1192 /// Sort the nodes of a DAG into topolgical order. |
1189 /// |
1193 /// |
1190 /// \param g The graph. In must be directed and acyclic. |
1194 /// \param graph The graph. It should be directed and acyclic. |
1191 /// \retval comp A writable node map. The values will be set from 0 to |
1195 /// \retval order A writable node map. The values will be set from 0 to |
1192 /// the number of the nodes in the graph minus one. Each values of the map |
1196 /// the number of the nodes in the graph minus one. Each values of the map |
1193 /// will be set exactly once, the values will be set descending order. |
1197 /// will be set exactly once, the values will be set descending order. |
1194 /// |
1198 /// |
1195 /// \see checkedTopologicalSort |
1199 /// \see checkedTopologicalSort |
1196 /// \see dag |
1200 /// \see dag |
1225 /// \brief Sort the nodes of a DAG into topolgical order. |
1229 /// \brief Sort the nodes of a DAG into topolgical order. |
1226 /// |
1230 /// |
1227 /// Sort the nodes of a DAG into topolgical order. It also checks |
1231 /// Sort the nodes of a DAG into topolgical order. It also checks |
1228 /// that the given graph is DAG. |
1232 /// that the given graph is DAG. |
1229 /// |
1233 /// |
1230 /// \param g The graph. In must be directed and acyclic. |
1234 /// \param graph The graph. It should be directed and acyclic. |
1231 /// \retval order A readable - writable node map. The values will be set |
1235 /// \retval order A readable - writable node map. The values will be set |
1232 /// from 0 to the number of the nodes in the graph minus one. Each values |
1236 /// from 0 to the number of the nodes in the graph minus one. Each values |
1233 /// of the map will be set exactly once, the values will be set descending |
1237 /// of the map will be set exactly once, the values will be set descending |
1234 /// order. |
1238 /// order. |
1235 /// \return %False when the graph is not DAG. |
1239 /// \return %False when the graph is not DAG. |