getConnectedComponents
- Finding isolated subgraphs
- Checking if graph is connected
- Partitioning graphs into independent parts
- Network analysis and clustering
Example
Use cases
Finding isolated nodes
Largest component
getStronglyConnectedComponents
- Finding cycles in directed graphs
- Identifying feedback loops
- Module dependency analysis
- State machine analysis
Example
Use cases
Finding cyclic dependencies
Condensation graph
Create a DAG where each SCC becomes a single node:isConnected
- Validating graph connectivity
- Checking if graph is a single component
- Network connectivity testing
Example
Checking before operations
Comparison
| Algorithm | Graph Type | Finds | Complexity |
|---|---|---|---|
getConnectedComponents | Any (treats as undirected) | Nodes reachable by any path | O(V + E) |
getStronglyConnectedComponents | Directed | Nodes mutually reachable by directed paths | O(V + E) |
isConnected | Any (treats as undirected) | Whether graph is single component | O(V + E) |