-
Notifications
You must be signed in to change notification settings - Fork 309
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
nx-cugraph: add relabel_nodes
and convert_node_labels_to_integers
#4531
Merged
+537
−32
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a766891
nx-cugraph: add `relabel_nodes`
eriknw 3aab8dd
Add `convert_node_labels_to_integers`
eriknw ee6a6b9
xfail some networkx tests for nx versions <3.3
eriknw a734a0a
Merge branch 'branch-24.08' into relabel_nodes
eriknw b3ba8f8
Implement `relabel_nodes` for multigraphs; tests
eriknw 894527c
Merge branch 'branch-24.08' into relabel_nodes
eriknw 7ed4796
Merge branch 'branch-24.08' into relabel_nodes
eriknw faf5bfc
Raise if nx input and copy=False
eriknw 2a0bfda
Merge branch 'branch-24.08' into relabel_nodes
nv-rliu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,13 @@ def key(testpath): | |
louvain_different = "Louvain may be different due to RNG" | ||
no_string_dtype = "string edge values not currently supported" | ||
sssp_path_different = "sssp may choose a different valid path" | ||
no_object_dtype_for_edges = ( | ||
"Edges don't support object dtype (lists, strings, etc.)" | ||
) | ||
tuple_elements_preferred = "elements are tuples instead of lists" | ||
nx_cugraph_in_test_setup = ( | ||
"nx-cugraph Graph is incompatible in test setup in nx versions < 3.3" | ||
) | ||
|
||
xfail = { | ||
# This is removed while strongly_connected_components() is not | ||
|
@@ -91,6 +98,81 @@ def key(testpath): | |
"test_cycles.py:TestMinimumCycleBasis." | ||
"test_gh6787_and_edge_attribute_names" | ||
): sssp_path_different, | ||
key( | ||
"test_graph_hashing.py:test_isomorphic_edge_attr" | ||
): no_object_dtype_for_edges, | ||
key( | ||
"test_graph_hashing.py:test_isomorphic_edge_attr_and_node_attr" | ||
): no_object_dtype_for_edges, | ||
key( | ||
"test_graph_hashing.py:test_isomorphic_edge_attr_subgraph_hash" | ||
): no_object_dtype_for_edges, | ||
key( | ||
"test_graph_hashing.py:" | ||
"test_isomorphic_edge_attr_and_node_attr_subgraph_hash" | ||
): no_object_dtype_for_edges, | ||
key( | ||
"test_summarization.py:TestSNAPNoEdgeTypes.test_summary_graph" | ||
): no_object_dtype_for_edges, | ||
key( | ||
"test_summarization.py:TestSNAPUndirected.test_summary_graph" | ||
): no_object_dtype_for_edges, | ||
key( | ||
"test_summarization.py:TestSNAPDirected.test_summary_graph" | ||
): no_object_dtype_for_edges, | ||
key("test_gexf.py:TestGEXF.test_relabel"): no_object_dtype_for_edges, | ||
key( | ||
"test_gml.py:TestGraph.test_parse_gml_cytoscape_bug" | ||
): no_object_dtype_for_edges, | ||
key("test_gml.py:TestGraph.test_parse_gml"): no_object_dtype_for_edges, | ||
key("test_gml.py:TestGraph.test_read_gml"): no_object_dtype_for_edges, | ||
key("test_gml.py:TestGraph.test_data_types"): no_object_dtype_for_edges, | ||
key( | ||
"test_gml.py:TestPropertyLists.test_reading_graph_with_list_property" | ||
): no_object_dtype_for_edges, | ||
key( | ||
"test_relabel.py:" | ||
"test_relabel_preserve_node_order_partial_mapping_with_copy_false" | ||
): "Node order is preserved when relabeling with partial mapping", | ||
Comment on lines
+133
to
+136
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't fully grok why this test is checking that the node order changed. It seems like we'd want to keep the node order the same (and we do). See: |
||
key( | ||
"test_gml.py:" | ||
"TestPropertyLists.test_reading_graph_with_single_element_list_property" | ||
): tuple_elements_preferred, | ||
key( | ||
"test_relabel.py:" | ||
"TestRelabel.test_relabel_multidigraph_inout_merge_nodes" | ||
): no_string_dtype, | ||
key( | ||
"test_relabel.py:TestRelabel.test_relabel_multigraph_merge_inplace" | ||
): no_string_dtype, | ||
key( | ||
"test_relabel.py:TestRelabel.test_relabel_multidigraph_merge_inplace" | ||
): no_string_dtype, | ||
key( | ||
"test_relabel.py:TestRelabel.test_relabel_multidigraph_inout_copy" | ||
): no_string_dtype, | ||
key( | ||
"test_relabel.py:TestRelabel.test_relabel_multigraph_merge_copy" | ||
): no_string_dtype, | ||
key( | ||
"test_relabel.py:TestRelabel.test_relabel_multidigraph_merge_copy" | ||
): no_string_dtype, | ||
key( | ||
"test_relabel.py:TestRelabel.test_relabel_multigraph_nonnumeric_key" | ||
): no_string_dtype, | ||
key("test_contraction.py:test_multigraph_path"): no_object_dtype_for_edges, | ||
key( | ||
"test_contraction.py:test_directed_multigraph_path" | ||
): no_object_dtype_for_edges, | ||
key( | ||
"test_contraction.py:test_multigraph_blockmodel" | ||
): no_object_dtype_for_edges, | ||
key( | ||
"test_summarization.py:TestSNAPUndirectedMulti.test_summary_graph" | ||
): no_string_dtype, | ||
key( | ||
"test_summarization.py:TestSNAPDirectedMulti.test_summary_graph" | ||
): no_string_dtype, | ||
} | ||
|
||
from packaging.version import parse | ||
|
@@ -118,6 +200,19 @@ def key(testpath): | |
"test_strongly_connected.py:" | ||
"TestStronglyConnected.test_connected_raise" | ||
): "test is incompatible with pytest>=8", | ||
# NetworkX 3.3 introduced logic around functions that return graphs | ||
key( | ||
"test_vf2pp_helpers.py:TestGraphTinoutUpdating.test_updating" | ||
): nx_cugraph_in_test_setup, | ||
key( | ||
"test_vf2pp_helpers.py:TestGraphTinoutUpdating.test_restoring" | ||
): nx_cugraph_in_test_setup, | ||
key( | ||
"test_vf2pp_helpers.py:TestDiGraphTinoutUpdating.test_updating" | ||
): nx_cugraph_in_test_setup, | ||
key( | ||
"test_vf2pp_helpers.py:TestDiGraphTinoutUpdating.test_restoring" | ||
): nx_cugraph_in_test_setup, | ||
} | ||
) | ||
|
||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String comparison isn’t appropriate here (breaks with versions like 3.30). Try comparing version specifiers like this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's an alternative solution: #4571