# HG changeset patch # User alpar # Date 1132147564 0 # Node ID 5f2f3d982eba1a2c867c199bc252ad3ff6a73426 # Parent 1530c115580fc2c0c8d5d59213f270e4333d1b5c Empty graph is (strongly) connected. diff -r 1530c115580f -r 5f2f3d982eba lemon/topology.h --- a/lemon/topology.h Wed Nov 16 13:21:57 2005 +0000 +++ b/lemon/topology.h Wed Nov 16 13:26:04 2005 +0000 @@ -48,12 +48,12 @@ /// Check that the given undirected graph connected. /// \param graph The undirected graph. /// \return %True when there is path between any two nodes in the graph. - /// \warning The empty graph is not connected. + /// \note By definition, the empty graph is connected. template bool connected(const UndirGraph& graph) { checkConcept(); typedef typename UndirGraph::NodeIt NodeIt; - if (NodeIt(graph) == INVALID) return false; + if (NodeIt(graph) == INVALID) return true; Dfs dfs(graph); dfs.run(NodeIt(graph)); for (NodeIt it(graph); it != INVALID; ++it) { @@ -72,6 +72,8 @@ /// /// \param graph The graph. It should be undirected. /// \return The number of components + /// \note By definition, the empty graph consists + /// of zero connected components. template int countConnectedComponents(const UndirGraph &graph) { checkConcept(); @@ -237,11 +239,11 @@ /// \return %False when the graph is not strongly connected. /// \see connected /// - /// \warning Empty graph is not strongly connected. + /// \note By definition, the empty graph is strongly connected. template bool stronglyConnected(const Graph& graph) { checkConcept(); - if (NodeIt(graph) == INVALID) return false; + if (NodeIt(graph) == INVALID) return true; typedef typename Graph::Node Node; typedef typename Graph::NodeIt NodeIt; @@ -293,6 +295,8 @@ /// /// \param graph The graph. /// \return The number of components + /// \note By definition, the empty graph has zero + /// strongly connected components. template int countStronglyConnectedComponents(const Graph& graph) { checkConcept(); @@ -356,10 +360,6 @@ /// \image latex strongly_connected_components.eps "Strongly connected components" width=\textwidth /// /// \param graph The graph. - /// \param compMap A writable node map. The values will be set from 0 to - /// the number of the connected components minus one. Each values of the map - /// will be set exactly once, the values of a certain component will be - /// set continuously. /// \retval compMap A writable node map. The values will be set from 0 to /// the number of the strongly connected components minus one. Each values /// of the map will be set exactly once, the values of a certain component