ConnectedGraphQ
✖
ConnectedGraphQ
Details

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

Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Test whether a graph is connected:

https://wolfram.com/xid/01yrpa3dx6b-rb3d4


https://wolfram.com/xid/01yrpa3dx6b-78jol

A graph with isolated vertices is not connected:

https://wolfram.com/xid/01yrpa3dx6b-jfp3fm


https://wolfram.com/xid/01yrpa3dx6b-dxll7e

Scope (6)Survey of the scope of standard use cases

https://wolfram.com/xid/01yrpa3dx6b-bu4i36


https://wolfram.com/xid/01yrpa3dx6b-idswig


https://wolfram.com/xid/01yrpa3dx6b-5c4td0


https://wolfram.com/xid/01yrpa3dx6b-26nv2e

ConnectedGraphQ gives False for anything that is not a connected graph:

https://wolfram.com/xid/01yrpa3dx6b-3l2bwe

ConnectedGraphQ works with large graphs:

https://wolfram.com/xid/01yrpa3dx6b-do4pmf

https://wolfram.com/xid/01yrpa3dx6b-3y4dmr

Applications (1)Sample problems that can be solved with this function
Properties & Relations (5)Properties of the function, and connections to other functions
The graph distance matrix of a connected graph does not have entries:

https://wolfram.com/xid/01yrpa3dx6b-dlq5yi


https://wolfram.com/xid/01yrpa3dx6b-b4jw5q


https://wolfram.com/xid/01yrpa3dx6b-dkfpm0


https://wolfram.com/xid/01yrpa3dx6b-ewvtp2

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

https://wolfram.com/xid/01yrpa3dx6b-bge9sr


https://wolfram.com/xid/01yrpa3dx6b-bkwc58

A path graph with vertices has exactly
edges:

https://wolfram.com/xid/01yrpa3dx6b-iqoccl


https://wolfram.com/xid/01yrpa3dx6b-tfe5e

The sum of the vertex degrees of a connected graph is greater than for the underlying simple graph:

https://wolfram.com/xid/01yrpa3dx6b-c9u2no


https://wolfram.com/xid/01yrpa3dx6b-cb1njg


https://wolfram.com/xid/01yrpa3dx6b-ecasd1


https://wolfram.com/xid/01yrpa3dx6b-b7cnwi

An undirected tree is connected:

https://wolfram.com/xid/01yrpa3dx6b-edtvky


https://wolfram.com/xid/01yrpa3dx6b-e4qbaq

An undirected path is connected:

https://wolfram.com/xid/01yrpa3dx6b-chaumv


https://wolfram.com/xid/01yrpa3dx6b-m3y6z

Wolfram Research (2010), ConnectedGraphQ, Wolfram Language function, https://reference.wolfram.com/language/ref/ConnectedGraphQ.html.
Text
Wolfram Research (2010), ConnectedGraphQ, Wolfram Language function, https://reference.wolfram.com/language/ref/ConnectedGraphQ.html.
Wolfram Research (2010), ConnectedGraphQ, Wolfram Language function, https://reference.wolfram.com/language/ref/ConnectedGraphQ.html.
CMS
Wolfram Language. 2010. "ConnectedGraphQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ConnectedGraphQ.html.
Wolfram Language. 2010. "ConnectedGraphQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ConnectedGraphQ.html.
APA
Wolfram Language. (2010). ConnectedGraphQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ConnectedGraphQ.html
Wolfram Language. (2010). ConnectedGraphQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ConnectedGraphQ.html
BibTeX
@misc{reference.wolfram_2025_connectedgraphq, author="Wolfram Research", title="{ConnectedGraphQ}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/ConnectedGraphQ.html}", note=[Accessed: 29-May-2025
]}
BibLaTeX
@online{reference.wolfram_2025_connectedgraphq, organization={Wolfram Research}, title={ConnectedGraphQ}, year={2010}, url={https://reference.wolfram.com/language/ref/ConnectedGraphQ.html}, note=[Accessed: 29-May-2025
]}