Skip to content

Commit

Permalink
Update nx-cugraph to NetworkX 3.4 (#4717)
Browse files Browse the repository at this point in the history
This run `make` in `python/nx-cugraph` directory and update the pre-commit hook.

Also fixes `ego_graph` tests to check `nx.config.fallback_to_nx` configuration.

Authors:
  - Erik Welch (https://github.com/eriknw)

Approvers:
  - Rick Ratzel (https://github.com/rlratzel)
  - Jake Awe (https://github.com/AyodeAwe)

URL: #4717
  • Loading branch information
eriknw authored Oct 15, 2024
1 parent 4bb5494 commit 21fe9bf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ repos:
types: [python]
language: python
pass_filenames: false
additional_dependencies: ["networkx>=3.3"]
additional_dependencies: ["networkx>=3.4"]
- repo: local
hooks:
- id: nx-cugraph-readme-update
Expand All @@ -78,4 +78,4 @@ repos:
types_or: [python, markdown]
language: python
pass_filenames: false
additional_dependencies: ["networkx>=3.3"]
additional_dependencies: ["networkx>=3.4"]
4 changes: 2 additions & 2 deletions python/nx-cugraph/_nx_cugraph/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"backend_name": "cugraph",
"project": "nx-cugraph",
"package": "nx_cugraph",
"url": f"https://rapids.ai/nx-cugraph",
"url": "https://rapids.ai/nx-cugraph",
"short_summary": "GPU-accelerated backend.",
# "description": "TODO",
"functions": {
Expand Down Expand Up @@ -180,7 +180,7 @@
"ego_graph": "Weighted ego_graph with negative cycles is not yet supported. `NotImplementedError` will be raised if there are negative `distance` edge weights.",
"eigenvector_centrality": "`nstart` parameter is not used, but it is checked for validity.",
"from_pandas_edgelist": "cudf.DataFrame inputs also supported; value columns with str is unsuppported.",
"generic_bfs_edges": "`neighbors` and `sort_neighbors` parameters are not yet supported.",
"generic_bfs_edges": "`neighbors` parameter is not yet supported.",
"katz_centrality": "`nstart` isn't used (but is checked), and `normalized=False` is not supported.",
"louvain_communities": "`seed` parameter is currently ignored, and self-loops are not yet supported.",
"pagerank": "`dangling` parameter is not supported, but it is checked for validity.",
Expand Down
3 changes: 1 addition & 2 deletions python/nx-cugraph/nx_cugraph/tests/test_ego_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,14 @@ def test_ego_graph_cycle_graph(
nx.ego_graph(Gnx, n, **kwargs, backend="cugraph")
with pytest.raises(NotImplementedError, match="ego_graph"):
nx.ego_graph(Gcg, n, **kwargs, backend="cugraph")
if _nxver < (3, 4):
if _nxver < (3, 4) or not nx.config.fallback_to_nx:
with pytest.raises(NotImplementedError, match="ego_graph"):
nx.ego_graph(Gcg, n, **kwargs)
else:
# This is an interesting case. `nxcg.ego_graph` is not implemented for
# these arguments, so it falls back to networkx. Hence, as it is currently
# implemented, the input graph is `nxcg.CudaGraph`, but the output graph
# is `nx.Graph`. Should networkx convert back to "cugraph" backend?
# TODO: make fallback to networkx configurable.
H2cg = nx.ego_graph(Gcg, n, **kwargs)
assert type(H2nx) is type(H2cg)
assert_graphs_equal(H2nx, nxcg.from_networkx(H2cg, preserve_all_attrs=True))
Expand Down

0 comments on commit 21fe9bf

Please sign in to comment.