Skip to content

Commit 37ac07d

Browse files
authored
Merge branch 'main' into mirror-crud-to-nxcg
2 parents 423a7b2 + 48b4bfe commit 37ac07d

File tree

20 files changed

+396
-166
lines changed

20 files changed

+396
-166
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ workflows:
131131
- test:
132132
matrix:
133133
parameters:
134-
python_version: ["3.10", "3.11", "3.12.2"]
134+
python_version: ["3.10", "3.11", "3.12"]
135135
- test-gpu:
136136
requires:
137137
- lint

CHANGELOG.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,92 @@
1+
1.3.0 (2025-01-10)
2+
------------------
3+
4+
New
5+
~~~
6+
- Fully support parameterized `db` object (#70) [Anthony Mahanna]
7+
8+
* new: fully support parameterized `db` object
9+
10+
* fix: `hosts`
11+
12+
* fix: docstring
13+
14+
* new: support `use_gpu` algorithm parameter
15+
16+
* new: `test_multiple_graph_sessions`
17+
18+
Fix
19+
~~~
20+
- Readme img. [Anthony Mahanna]
21+
22+
Other
23+
~~~~~
24+
- Bump: version. [Anthony Mahanna]
25+
- Rm: scarf. [Anthony Mahanna]
26+
- Cleanup: `overwrite_graph` and `chat` (#69) [Anthony Mahanna]
27+
28+
* cleanup: `overwrite_graph`
29+
30+
* fix: typo
31+
32+
* fix: `chat`
33+
34+
* temp: disable `chat`
35+
- Temp: lock adb. [Anthony Mahanna]
36+
37+
need to investigate issues with 3.12.3
38+
- Update README.md. [Anthony Mahanna]
39+
- Update README.md. [Anthony Mahanna]
40+
- !gitchangelog (#67) [aMahanna, github-actions[bot]]
41+
42+
43+
1.2.0 (2024-10-21)
44+
------------------
45+
46+
New
47+
~~~
48+
- Use `_graphs` instead of `nxadb_graphs` (#66) [Anthony Mahanna]
49+
50+
* new: use `_graphs` instead of `nxadb_graphs`
51+
52+
* fix: lint
53+
54+
* fix: typo
55+
56+
* cleanup
57+
58+
* cleanup: use `GRAPH_FIELD`
59+
60+
* fix: env var
61+
62+
* fix: lint
63+
64+
* bump version
65+
66+
Other
67+
~~~~~
68+
- Bump: networkx dep (#64) [Anthony Mahanna]
69+
70+
* bump: networkx dep
71+
72+
* fix: `mypy`
73+
74+
* new: `_should_backend_run`
75+
76+
overriding https://github.com/networkx/networkx/blob/networkx-3.4.1/networkx/utils/backends.py#L1514-L1535 to support backwards compatibility
77+
78+
* Update VERSION
79+
80+
* fix: use `from_networkx` if graph does not exist in db
81+
82+
* remove demo.py
83+
84+
* new: `_should_backend_run`, `_can_backend_run`
85+
86+
* fix: lint
87+
- !gitchangelog (#62) [aMahanna, github-actions[bot]]
88+
89+
190
1.1.0 (2024-10-08)
291
------------------
392

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<img src="https://rapids.ai/images/RAPIDS-logo.png" alt="RAPIDS" height="60">
1111
</a>
1212
<a href="https://www.nvidia.com/en-us/startups/">
13-
<img src="https://www.serversimply.com/media/20181218-Nvidia-Inception.png" alt="NVIDIA" height="60">
13+
<img src="https://www.nvidia.com/content/dam/en-zz/Solutions/about-nvidia/logo-and-brand/02-nvidia-logo-color-grn-500x200-4c25-p@2x.png" alt="NVIDIA" height="60">
1414
</a>
1515

1616
<br>
@@ -44,7 +44,7 @@ This is a [backend to NetworkX](https://networkx.org/documentation/stable/refere
4444

4545
Benefits of having ArangoDB as a backend to NetworkX include:
4646
1. No need to re-create the graph every time you start a new session.
47-
2. Access to GPU-accelerated graph analytics ([nx-cugraph](https://docs.rapids.ai/api/cugraph/nightly/nx_cugraph/nx_cugraph/)).
47+
2. Access to GPU-accelerated graph analytics ([nx-cugraph](https://rapids.ai/nx-cugraph/)).
4848
3. Access to a database query language ([Arango Query Language](https://arangodb.com/sql-aql-comparison/)).
4949
4. Access to a visual interface for graph exploration ([ArangoDB Web UI](https://docs.arangodb.com/stable/components/web-interface/graphs/)).
5050
5. Access to cross-collaboration on the same graph ([ArangoDB Cloud](https://docs.arangodb.com/stable/get-started/set-up-a-cloud-instance/)).
@@ -153,7 +153,7 @@ os.environ["DATABASE_NAME"] = credentials["dbName"]
153153

154154
## How does algorithm dispatching work?
155155

156-
`nx-arangodb` will automatically dispatch algorithm calls to either CPU or GPU based on if `nx-cugraph` is installed. We rely on a rust-based library called [phenolrs](https://github.com/arangoml/phenolrs) to retrieve ArangoDB Graphs as fast as possible.
156+
`nx-arangodb` will automatically dispatch algorithm calls to either CPU or GPU based on if [nx-cugraph](https://rapids.ai/nx-cugraph/) is installed. We rely on a rust-based library called [phenolrs](https://github.com/arangoml/phenolrs) to retrieve ArangoDB Graphs as fast as possible.
157157

158158
You can also force-run algorithms on CPU even if `nx-cugraph` is installed:
159159

@@ -166,13 +166,16 @@ import nx_arangodb as nxadb
166166

167167
G = nxadb.Graph(name="MyGraph")
168168

169+
# Option 1: Use Global Config
169170
nx.config.backends.arangodb.use_gpu = False
170-
171171
nx.pagerank(G)
172172
nx.betweenness_centrality(G)
173173
# ...
174-
175174
nx.config.backends.arangodb.use_gpu = True
175+
176+
# Option 2: Use Local Config
177+
nx.pagerank(G, use_gpu=False)
178+
nx.betweenness_centrality(G, use_gpu=False)
176179
```
177180

178181
<p align="center">

_nx_arangodb/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.0
1+
1.3.0

_nx_arangodb/__init__.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,7 @@ def get_info():
7474
for key in info_keys:
7575
del d[key]
7676

77-
d["default_config"] = {
78-
"host": None,
79-
"username": None,
80-
"password": None,
81-
"db_name": None,
82-
"read_parallelism": None,
83-
"read_batch_size": None,
84-
"use_gpu": True,
85-
}
77+
d["default_config"] = {"use_gpu": True}
8678

8779
return d
8880

doc/algorithms/index.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,17 @@ You can also force-run algorithms on CPU even if ``nx-cugraph`` is installed:
4343
4444
G = nxadb.Graph(name="MyGraph")
4545
46+
# Option 1: Use Global Config
4647
nx.config.backends.arangodb.use_gpu = False
47-
4848
nx.pagerank(G)
4949
nx.betweenness_centrality(G)
5050
# ...
51-
5251
nx.config.backends.arangodb.use_gpu = True
5352
53+
# Option 2: Use Local Config
54+
nx.pagerank(G, use_gpu=False)
55+
nx.betweenness_centrality(G, use_gpu=False)
56+
5457
5558
.. image:: ../_static/dispatch.png
5659
:align: center

doc/nx_arangodb.ipynb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,7 @@
236236
"outputs": [],
237237
"source": [
238238
"# 5. Run an algorithm (CPU)\n",
239-
"nx.config.backends.arangodb.use_gpu = False # Optional\n",
240-
"\n",
241-
"res = nx.pagerank(G)"
239+
"res = nx.pagerank(G, use_gpu=False)"
242240
]
243241
},
244242
{
@@ -357,8 +355,6 @@
357355
"source": [
358356
"# 4. Run an algorithm (GPU)\n",
359357
"# See *Package Installation* to install nx-cugraph ^\n",
360-
"nx.config.backends.arangodb.use_gpu = True\n",
361-
"\n",
362358
"res = nx.pagerank(G)"
363359
]
364360
},

nx_arangodb/classes/dict/adj.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ def adjlist_outer_dict_factory(
105105
db: StandardDatabase,
106106
graph: Graph,
107107
default_node_type: str,
108+
read_parallelism: int,
109+
read_batch_size: int,
108110
edge_type_key: str,
109111
edge_type_func: Callable[[str, str], str],
110112
graph_type: str,
@@ -115,6 +117,8 @@ def adjlist_outer_dict_factory(
115117
db,
116118
graph,
117119
default_node_type,
120+
read_parallelism,
121+
read_batch_size,
118122
edge_type_key,
119123
edge_type_func,
120124
graph_type,
@@ -1454,6 +1458,12 @@ class AdjListOuterDict(UserDict[str, AdjListInnerDict]):
14541458
symmetrize_edges_if_directed : bool
14551459
Whether to add the reverse edge if the graph is directed.
14561460
1461+
read_parallelism : int
1462+
The number of parallel threads to use for reading data in _fetch_all.
1463+
1464+
read_batch_size : int
1465+
The number of documents to read in each batch in _fetch_all.
1466+
14571467
Example
14581468
-------
14591469
>>> g = nxadb.Graph(name="MyGraph")
@@ -1467,6 +1477,8 @@ def __init__(
14671477
db: StandardDatabase,
14681478
graph: Graph,
14691479
default_node_type: str,
1480+
read_parallelism: int,
1481+
read_batch_size: int,
14701482
edge_type_key: str,
14711483
edge_type_func: Callable[[str, str], str],
14721484
graph_type: str,
@@ -1489,6 +1501,8 @@ def __init__(
14891501
self.edge_type_key = edge_type_key
14901502
self.edge_type_func = edge_type_func
14911503
self.default_node_type = default_node_type
1504+
self.read_parallelism = read_parallelism
1505+
self.read_batch_size = read_batch_size
14921506
self.adjlist_inner_dict_factory = adjlist_inner_dict_factory(
14931507
db,
14941508
graph,
@@ -1853,6 +1867,8 @@ def _fetch_all(self) -> None:
18531867
is_directed=True,
18541868
is_multigraph=self.is_multigraph,
18551869
symmetrize_edges_if_directed=self.symmetrize_edges_if_directed,
1870+
read_parallelism=self.read_parallelism,
1871+
read_batch_size=self.read_batch_size,
18561872
)
18571873

18581874
# Even if the Graph is undirected,

0 commit comments

Comments
 (0)