# HG changeset patch
# User Alpar Juttner <alpar@cs.elte.hu>
# Date 1376049929 -7200
# Node ID 19087d4f215db96b1867f67bc1032a68704224eb
# Parent  b9887ae63df0dc6570ebe3401ee4d559eb5931c2# Parent  70b199792735c034825047537cef0250c8fb28df
Merge bugfix #439 to branch 1.2

diff -r b9887ae63df0 -r 19087d4f215d lemon/connectivity.h
--- a/lemon/connectivity.h	Wed Aug 07 07:09:31 2013 +0200
+++ b/lemon/connectivity.h	Fri Aug 09 14:05:29 2013 +0200
@@ -745,14 +745,37 @@
   /// \brief Check whether an undirected graph is bi-node-connected.
   ///
   /// This function checks whether the given undirected graph is
-  /// bi-node-connected, i.e. any two edges are on same circle.
+  /// bi-node-connected, i.e. a connected graph without articulation
+  /// node.
   ///
   /// \return \c true if the graph bi-node-connected.
-  /// \note By definition, the empty graph is bi-node-connected.
+  ///
+  /// \note By definition,
+  /// \li a graph consisting of zero or one node is bi-node-connected,
+  /// \li a graph consisting of two isolated nodes
+  /// is \e not bi-node-connected and
+  /// \li a graph consisting of two nodes connected by an edge
+  /// is bi-node-connected.
   ///
   /// \see countBiNodeConnectedComponents(), biNodeConnectedComponents()
   template <typename Graph>
   bool biNodeConnected(const Graph& graph) {
+    bool hasNonIsolated = false, hasIsolated = false;
+    for (typename Graph::NodeIt n(graph); n != INVALID; ++n) {
+      if (typename Graph::OutArcIt(graph, n) == INVALID) {
+        if (hasIsolated || hasNonIsolated) {
+          return false;
+        } else {
+          hasIsolated = true;
+        }
+      } else {
+        if (hasIsolated) {
+          return false;
+        } else {
+          hasNonIsolated = true;
+        }
+      }
+    }
     return countBiNodeConnectedComponents(graph) <= 1;
   }
 
diff -r b9887ae63df0 -r 19087d4f215d test/connectivity_test.cc
--- a/test/connectivity_test.cc	Wed Aug 07 07:09:31 2013 +0200
+++ b/test/connectivity_test.cc	Fri Aug 09 14:05:29 2013 +0200
@@ -99,6 +99,23 @@
   }
 
   {
+    ListGraph g;
+    ListGraph::NodeMap<bool> map(g);
+
+    ListGraph::Node n1 = g.addNode();
+    ListGraph::Node n2 = g.addNode();
+
+    ListGraph::Edge e1 = g.addEdge(n1, n2);
+    ::lemon::ignore_unused_variable_warning(e1);
+    check(biNodeConnected(g), "Graph is bi-node-connected");
+
+    ListGraph::Node n3 = g.addNode();
+    ::lemon::ignore_unused_variable_warning(n3);
+    check(!biNodeConnected(g), "Graph is not bi-node-connected");
+  }
+
+
+  {
     Digraph d;
     Digraph::NodeMap<int> order(d);
     Graph g(d);