# GDS algorithms and execution modes

[Wiki](../README.md) / [Graph data science](README.md)

## Algorithms and modes

All listed algorithms expose `.stream`, `.stats`, `.mutate` and `.write`:

| Procedure prefix | Stream columns | Algorithm configuration |
|---|---|---|
| `gds.pageRank` | `nodeId, score` | `maxIterations`, `dampingFactor`, `tolerance`, `relationshipWeightProperty`, `sourceNodes`, `concurrency` |
| `gds.degree` | `nodeId, score` | `orientation`, `relationshipWeightProperty` |
| `gds.wcc` | `nodeId, componentId` | `threshold`, `relationshipWeightProperty`, `consecutiveIds` |
| `gds.scc` | `nodeId, componentId` | `consecutiveIds` |
| `gds.labelPropagation` | `nodeId, communityId` | `maxIterations`, `relationshipWeightProperty`, `consecutiveIds` |
| `gds.leiden` | `nodeId, communityId` | `maxLevels`, `gamma`, `theta`, `tolerance`, `randomSeed`, `relationshipWeightProperty`, `consecutiveIds` |
| `gds.louvain` | `nodeId, communityId` | `maxIterations`, `maxLevels`, `tolerance`, `relationshipWeightProperty`, `consecutiveIds` |
| `gds.triangleCount` | `nodeId, triangleCount` | No additional options |
| `gds.localClusteringCoefficient` | `nodeId, localClusteringCoefficient` | No additional options |
| `gds.betweenness` | `nodeId, score` | Exact, unweighted Brandes algorithm |
| `gds.nodeSimilarity` | `node1, node2, similarity` | `similarityMetric`, `similarityCutoff`, `degreeCutoff`, `upperDegreeCutoff`, `topK`, `topN` |
| `gds.knn` | `node1, node2, similarity` | `nodeProperties`, `similarityCutoff`, `topK`, `randomSeed`, `sampleRate`, `maxIterations`, `deltaThreshold`, `randomJoins`, `exact`, `concurrency:1` |
| `gds.fastRP` | `nodeId, embedding` | `embeddingDimension`, `iterationWeights`, `nodeSelfInfluence`, `normalizationStrength`, `randomSeed`, `relationshipWeightProperty`, `featureProperties`, `propertyRatio`, `concurrency` |

All accept `nodeLabels` and `relationshipTypes` filters. Leiden, Louvain, triangle count
and local clustering require an undirected projection. Weights must be finite
and non-negative. WCC includes isolated nodes. Community numbering is
deterministic within GDB; compare partitions rather than numeric IDs across implementations.
Louvain performs local moves and repeated weighted community aggregation.
Intermediate-community output is not implemented.

`stream` returns rows; `stats` returns aggregate results. GDB's query result
container still materialises rows. `mutate` adds a previously absent
`mutateProperty` to projected nodes, while `write` writes `writeProperty` through
the database's normal constraints, indexes, undo log and WAL. Pair algorithms
instead need `mutateRelationshipType` or `writeRelationshipType`; their optional
property name defaults to `score`. Stats include counts, computation timings
and relevant distributions; write/mutate add timing and written-count columns.

```cypher
CALL gds.wcc.stream('people') YIELD nodeId, componentId
RETURN gds.util.asNode(nodeId).name AS name, componentId;

CALL gds.louvain.write('people', {writeProperty: 'community'});
CALL gds.pageRank.mutate('people', {mutateProperty: 'rank'});
CALL gds.graph.nodeProperties.write('people', ['rank']);
```

## Related articles

[Graph projections and catalogue](projections.md) · [GDS resources and cancellation](resources.md) · [Graph data science](README.md)
