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


  • WeaklyConnectedGraphQ works for any graph object.
  • A graph is weakly connected if there is a sequence of edges joining every pair of vertices.


open allclose all

Basic Examples  (2)

Test whether a graph is weakly connected:

A graph with isolated vertices is not weakly connected:

Scope  (6)

Test undirected graphs:

Directed graphs:


Mixed graphs:

WeaklyConnectedGraphQ gives False for anything that is not a weakly connected graph:

WeaklyConnectedGraphQ works with large graphs:

Properties & Relations  (3)

A tree graph is weakly connected:

A path graph is weakly connected:

The minimum number of edges in a weakly connected graph with vertices is :

A path graph with vertices has exactly edges:

Introduced in 2012