Changeset 1265:552e3d1242c6 in lemon
 Timestamp:
 08/08/13 22:56:10 (6 years ago)
 Branch:
 default
 Phase:
 public
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

lemon/connectivity.h
r695 r1265 745 745 /// \brief Check whether an undirected graph is binodeconnected. 746 746 /// 747 /// This function checks whether the given undirected graph is 748 /// binodeconnected, i.e. any two edges are on same circle. 747 /// This function checks whether the given undirected graph is 748 /// binodeconnected, i.e. a connected graph without articulation 749 /// node. 749 750 /// 750 751 /// \return \c true if the graph binodeconnected. … … 754 755 template <typename Graph> 755 756 bool biNodeConnected(const Graph& graph) { 757 bool hasNonIsolated = false, hasIsolated = false; 758 for (typename Graph::NodeIt n(graph); n != INVALID; ++n) { 759 if (typename Graph::OutArcIt(graph, n) == INVALID) { 760 if (hasIsolated  hasNonIsolated) { 761 return false; 762 } else { 763 hasIsolated = true; 764 } 765 } else { 766 if (hasIsolated) { 767 return false; 768 } else { 769 hasNonIsolated = true; 770 } 771 } 772 } 756 773 return countBiNodeConnectedComponents(graph) <= 1; 757 774 } 
test/connectivity_test.cc
r1257 r1265 98 98 check(simpleGraph(g), "This graph is simple."); 99 99 } 100 101 { 102 ListGraph g; 103 ListGraph::NodeMap<bool> map(g); 104 105 ListGraph::Node n1 = g.addNode(); 106 ListGraph::Node n2 = g.addNode(); 107 108 ListGraph::Edge e1 = g.addEdge(n1, n2); 109 ::lemon::ignore_unused_variable_warning(e1); 110 check(biNodeConnected(g), "Graph is binodeconnected"); 111 112 ListGraph::Node n3 = g.addNode(); 113 ::lemon::ignore_unused_variable_warning(n3); 114 check(!biNodeConnected(g), "Graph is not binodeconnected"); 115 } 116 100 117 101 118 {
Note: See TracChangeset
for help on using the changeset viewer.