Skip to content

GraphLoader #9

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

Closed
wants to merge 16 commits into from
Closed

GraphLoader #9

wants to merge 16 commits into from

Conversation

aMahanna
Copy link
Member

@aMahanna aMahanna commented May 2, 2024

Another attempt inspired from #8 to provide a GraphLoader class that returns the following representations of an ArangoDB Graph:

  • A Vertex Map dict[str, dict[str, Any]]
  • An Adjacency List dict[str, dict[str, dict[str, Any]]]
  • A COO Representation Tuple[numpy.ndarray, numpy.ndarray]
  • A Vertex ID to Index Map dict[str, int]

This gives us a tool to offer 1) ArangoDB to NetworkX & 2) ArangoDB to NetworkX-cuGraph

Lots of things to iron out, but this is a start

Note: node/edge field specification is disregarded here, i.e we're loading everything

host = "http://localhost:8529"
username = "root"
password = "passwd"
db_name = "_system"
graph_name = "KarateGraph"

client = ArangoClient(hosts=host)
db = client.db(db_name, username=username, password=password)
graph = db.graph(graph_name)

v_cols = graph.vertex_collections()
edge_definitions = graph.edge_definitions()
e_cols = {c["edge_collection"] for c in edge_definitions}

metagraph = {
    "vertexCollections": {col: {} for col in v_cols},
    "edgeCollections": {col: {} for col in e_cols},
}

start_time = time.time()

result = GraphLoader.load(
    db_name,
    metagraph,
    [host],
    username=username,
    password=password,
    parallelism=..., 
    batch_size=...,
    load_node_dict=True,
    load_adj_dict=True,
    load_as_undirected=True,
    load_coo=True,
)

end_time = time.time()

print(end_time - start_time)

assert type(result) == tuple
node_dict, adj_dict, src_indices, dst_indices, vertex_ids_to_indices = result

@aMahanna
Copy link
Member Author

Closing in favour of #21

@aMahanna aMahanna closed this Jun 28, 2024
@aMahanna aMahanna deleted the graph-loader branch June 28, 2024 13:47
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