Skip to content

Commit

Permalink
add fast_rp algorithm (#1867)
Browse files Browse the repository at this point in the history
* add fast_rp algorithm

Added Rust implementation; Rust test; Python integration; Python test

* remove unnecessary imports in test_algorithms; fix rust doc for fastrp

* implement AsOrd for float vecs and update fastRP to return partially ordered AlgorithmResult; make tidy

NOTE: make tidy applied formatting to: python/tests/graphql/test_nodes_property_filter.py, python/tests/graphql/test_graph_nodes_edges_property_filter.py, and python/python/raphtory/__init__.pyi

---------

Co-authored-by: Ben Steer <[email protected]>
  • Loading branch information
wyatt-joyner-pometry and miratepuffin authored Nov 25, 2024
1 parent 0414b7f commit 2951a0c
Show file tree
Hide file tree
Showing 12 changed files with 1,192 additions and 435 deletions.
440 changes: 360 additions & 80 deletions python/python/raphtory/__init__.pyi

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions python/python/raphtory/algorithms/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,29 @@ def directed_graph_density(g: GraphView):
float : Directed graph density of G.
"""

def fast_rp(
g: GraphView,
embedding_dim: int,
normalization_strength: float,
iter_weights: list[float],
seed: Optional[int] = None,
threads: Optional[int] = None,
) -> AlgorithmResult:
"""
Computes embedding vectors for each vertex of an undirected/bidirectional graph according to the Fast RP algorithm.
Original Paper: https://doi.org/10.48550/arXiv.1908.11512
Arguments:
g (GraphView): The graph view on which embeddings are generated.
embedding_dim (int): The size (dimension) of the generated embeddings.
normalization_strength (float): The extent to which high-degree vertices should be discounted (range: 1-0)
iter_weights (list[float]): The scalar weights to apply to the results of each iteration
seed (int, optional): The seed for initialisation of random vectors
threads (int, optional): The number of threads to be used for parallel execution.
Returns:
AlgorithmResult: Vertices mapped to their corresponding embedding vectors
"""

def fruchterman_reingold(
graph: GraphView,
iterations: int | None = 100,
Expand Down
Loading

0 comments on commit 2951a0c

Please sign in to comment.