# FastRP embeddings

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

These examples require the `people` projection from the [projection guide](projections.md#graph-catalogue).

## FastRP embeddings

FastRP initialises sparse random vectors, optionally appends projected numeric
features, propagates weighted neighbourhood averages, and sums L2-normalised
intermediate vectors. `embeddingDimension` is required and positive.
`iterationWeights` defaults to `[0.0,1.0,1.0]`; its length controls the number of
propagation steps. `nodeSelfInfluence` defaults to zero and weights the initial
normalised vector. Empty iteration weights require nonzero self influence.
`normalizationStrength` (default zero) scales initial vectors by outgoing degree
raised to that power; isolated nodes use degree one for this scaling.

`propertyRatio` is in `[0,1]`; the property portion has
`floor(embeddingDimension*propertyRatio)` coordinates. A positive ratio requires
nonempty `featureProperties`, whose values must be finite numeric scalars or
nonempty numeric lists with consistent dimensions. Feature vectors are shared
across nodes. At ratio one with a fixed seed, initialisation depends on features
and not numeric node IDs. Remaining coordinates use node ID and seed. A fixed
seed is reproducible within GDB; RNG sequences are implementation-specific.
An isolate has a zero embedding unless self influence contributes. The final
weighted sum is not normalised again. Overflow raises an error.

```cypher
CALL gds.fastRP.mutate('people', {
  embeddingDimension: 128, randomSeed: 42, mutateProperty: 'structuralEmbedding'
});
CALL gds.knn.stream('people', {
  nodeProperties: 'structuralEmbedding', topK: 10, randomSeed: 42
}) YIELD node1, node2, similarity;
CALL gds.graph.nodeProperties.write('people', ['structuralEmbedding']);
```

## Related articles

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