This function checks if the given (hyper)graph H is connected. A (hyper)graph is said to be connected if it has exactly one connected component.
Isolated vertices do not count as connected components and will not make this method return false. This is in contrast to isConnectedGraph in which isolated vertices form their own connected components. See the Connected Components Tutorial for more information.
i1 : S = QQ[a..e]; |
i2 : G = graph {a*b,b*c,c*d,d*e,a*e} -- the 5-cycle (connected) o2 = Graph{edges => {{a, b}, {b, c}, {c, d}, {a, e}, {d, e}}} ring => S vertices => {a, b, c, d, e} o2 : Graph |
i3 : H = graph {a*b,b*c,c*a,d*e} -- a 3-cycle and a disjoint edge (not connected) o3 = Graph{edges => {{a, b}, {a, c}, {b, c}, {d, e}}} ring => S vertices => {a, b, c, d, e} o3 : Graph |
i4 : isConnected G o4 = true |
i5 : isConnected H o5 = false |
In the following example, the graph G has the isolated vertex d. As d is not considered to be in any connected component, this graph is connected.
i6 : S = QQ[a,b,c,d]; |
i7 : G = graph {a*b,b*c} o7 = Graph{edges => {{a, b}, {b, c}}} ring => S vertices => {a, b, c, d} o7 : Graph |
i8 : isolatedVertices G o8 = {d} o8 : List |
i9 : isConnected G o9 = true |
The object isConnected is a method function.