# WeaklyConnectedGraphComponents

gives the weakly connected components of the graph g.

WeaklyConnectedGraphComponents[g,{v1,v2,}]

gives the weakly connected components that include at least one of the vertices v1, v2, .

WeaklyConnectedGraphComponents[g,patt]

gives the connected components that include a vertex that matches the pattern patt.

WeaklyConnectedGraphComponents[{vw,},]

uses rules vw to specify the graph g.

# Details and Options

• WeaklyConnectedComponents returns a list of components {c1,c2,}, where each component ci is given as a graph.
• Vertices u and v are in the same component ci if there is a sequence of edges joining u and v.
• Components ci are ordered by their length, with the largest component first.
• WeaklyConnectedGraphComponents works with undirected graphs, directed graphs, multigraphs, and mixed graphs.

# Examples

open allclose all

## Basic Examples(1)

Give the weakly connected components of a graph:

Highlight the components:

## Scope(8)

WeaklyConnectedGraphComponents works with undirected graphs:

Directed graphs:

Multigraphs:

Mixed graphs:

Use rules to specify the graph:

Select weakly connected graph components that include at least one of the specified vertices:

Use patterns to select a subset of weakly connected graph components:

WeaklyConnectedGraphComponents works with large graphs:

## Applications(1)

A frog in a lily pond is able to jump 1.5 feet to get from one of the 25 lily pads to another. Model the frog's jumping network from the lily leaf density and SpatialGraphDistribution:

Sample a random pond:

Find the largest collection of lily pads the frog can jump between:

Find the number of times the frog would have to swim to visit all lily pads:

## Properties & Relations(3)

For undirected graphs, connected and weakly connected components are identical:

Use WeaklyConnectedGraphQ to test whether a graph is weakly connected:

Weakly connected graph components are ordered by their vertex count, with the largest component first:

Wolfram Research (2016), WeaklyConnectedGraphComponents, Wolfram Language function, https://reference.wolfram.com/language/ref/WeaklyConnectedGraphComponents.html.

#### Text

Wolfram Research (2016), WeaklyConnectedGraphComponents, Wolfram Language function, https://reference.wolfram.com/language/ref/WeaklyConnectedGraphComponents.html.

#### CMS

Wolfram Language. 2016. "WeaklyConnectedGraphComponents." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/WeaklyConnectedGraphComponents.html.

#### APA

Wolfram Language. (2016). WeaklyConnectedGraphComponents. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/WeaklyConnectedGraphComponents.html

#### BibTeX

@misc{reference.wolfram_2024_weaklyconnectedgraphcomponents, author="Wolfram Research", title="{WeaklyConnectedGraphComponents}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/WeaklyConnectedGraphComponents.html}", note=[Accessed: 15-September-2024 ]}

#### BibLaTeX

@online{reference.wolfram_2024_weaklyconnectedgraphcomponents, organization={Wolfram Research}, title={WeaklyConnectedGraphComponents}, year={2016}, url={https://reference.wolfram.com/language/ref/WeaklyConnectedGraphComponents.html}, note=[Accessed: 15-September-2024 ]}