Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: mirror_crud_to_nxcg #65

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

wip: mirror_crud_to_nxcg #65

wants to merge 9 commits into from

Conversation

aMahanna
Copy link
Member

@aMahanna aMahanna commented Oct 15, 2024

Introduces a new parameter (mirror_crud_to_nxcg) to the nxadb.Graph constructor.

If set to True, any CRUD operations performed on the ArangoDB Graph will be reflected on the cached cuGraph Graph, if it exists.

# Assumption: NVIDIA GPU available, and `nx-cugraph` installed

import os
import networkx as nx
import nx_arangodb as nxadb

os.environ["..."] = ...

G = nxadb.Graph(name="MyGraph", mirror_crud_to_nxcg=True)

res = nx.pagerank(G) # Pulls the data as an NetworkX-cuGraph object, and caches it to G.nxcg_Graph

If mirror_crud_to_nxcg is False

G.add_node(999, foo="bar") # does not update the `G.nxcg_graph` object

assert G.number_of_nodes() == G.nxcg_graph.number_of_nodes() + 1

print(G.nxcg_graph.nodes[999]) # KeyError

If mirror_crud_to_nxcg is True

G.add_node(999, foo="bar") # updates the `G.nxcg_graph` object

assert G.number_of_nodes() == G.nxcg_graph.number_of_nodes()

print(G.nxcg_graph.nodes[999]) # Works

@aMahanna aMahanna marked this pull request as draft October 15, 2024 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant