Weakly Connected Components
Introduction
The Weakly Connected Components (WCC) algorithm identifies connected components within a directed graph, disregarding edge direction.
Output
The algorithm produces the following fields:
Field Name | Description |
---|---|
id | The ID of the vertex (node) |
componentId | A generated integer ID representing the component of the vertex |
Query Example
Parameters
Name | Description | Required | Default Value |
---|---|---|---|
labels | Specifies the node labels to include in the algorithm | Yes | |
relationshipTypes | Specifies the relationship types to include | Yes | |
maxIterations | Maximum number of iterations | No | 30 |
relationshipWeightProperty | Defines the property name for edge weights | No | |
threshold | Minimum edge weight value for it to be included in the algorithm | No | 0.0 |
seedProperty | The node property used as the seed for the component ID | No | "id" |
minComponentSize | Minimum size of the components to be returned | No | 0 |
Method | Description | Required | Default Value |
---|---|---|---|
vertices(String... names) | Specifies the vertex labels to include | Yes | |
edges(String... names) | Specifies the edge labels to include | Yes | |
maxIteration(int n) | Sets the maximum iteration count | No | 30 |
setParams(Object... args) | Adds additional parameters using alternating keys and values | No | see below |
Additional parameter keys in setParams
Key | Description | Default Value |
---|---|---|
weight | Specifies the edge weight property or a constant value as weight | 1.0 |
threshold | Minimum edge weight value for it to be included in the algorithm | 0.0 |
seedProperty | The vertex property used as the component ID seed | "id" |
minComponentSize | Minimum size of the components to be returned | 0 |
Exporting Query Results
For large datasets, export the results to object storage: