ConnectedGraphQ

ConnectedGraphQ[g]

yields True if the graph g is connected, and False otherwise.

Details

  • ConnectedGraphQ works for any graph object.
  • A graph is connected if there is a path between every pair of vertices.

Examples

open allclose all

Basic Examples  (2)

Test whether a graph is connected:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

A graph with isolated vertices is not connected:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Scope  (6)

Applications  (1)

Properties & Relations  (5)

See Also

ConnectedComponents  ConnectedGraphComponents  WeaklyConnectedGraphQ  WeaklyConnectedComponents  WeaklyConnectedGraphComponents  Graph  TreeGraph  PathGraph  TreeGraphQ  PathGraphQ

Introduced in 2010
(8.0)