Skip to content

Commit 628edc0

Browse files
authored
Merge pull request #586 from FlorentinD/fix-to-undirected
Fix to_undirected config parameter passing
2 parents a636ccc + f9ccedb commit 628edc0

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
## Bug fixes
1414

1515
* Fixed an issue where source and target IDs of relationships in heterogeneous OGBL graphs were not parsed correctly.
16+
* Fixed an issue where configuration parameters such as `aggregation` were ignored by `gds.graph.toUndirected`.
1617

1718

1819
## Improvements

graphdatascience/graph/graph_entity_ops_runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,13 @@ def _run_procedure(
250250

251251
@graph_type_check
252252
def __call__(self, G: Graph, relationship_type: str, mutate_relationship_type: str, **config: Any) -> "Series[Any]":
253-
return self._run_procedure(G, relationship_type, mutate_relationship_type)
253+
return self._run_procedure(G, relationship_type, mutate_relationship_type, **config)
254254

255255
@graph_type_check
256256
@compatible_with("estimate", min_inclusive=ServerVersion(2, 3, 0))
257257
def estimate(self, G: Graph, relationship_type: str, mutate_relationship_type: str, **config: Any) -> "Series[Any]":
258258
self._namespace += ".estimate"
259-
return self._run_procedure(G, relationship_type, mutate_relationship_type)
259+
return self._run_procedure(G, relationship_type, mutate_relationship_type, **config)
260260

261261

262262
class GraphRelationshipsRunner(GraphEntityOpsBaseRunner):

graphdatascience/tests/unit/test_graph_ops.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,18 @@ def test_graph_sample_cnarw(runner: CollectingQueryRunner, gds: GraphDataScience
689689
}
690690

691691

692+
def test_graph_relationships_to_undirected(runner: CollectingQueryRunner, gds: GraphDataScience) -> None:
693+
G, _ = gds.graph.project("g", "*", "*")
694+
695+
gds.graph.relationships.toUndirected(G, "REL", "REL_UNDIRECTED", aggregation="MAX")
696+
697+
assert runner.last_query() == "CALL gds.graph.relationships.toUndirected($graph_name, $config)"
698+
assert runner.last_params() == {
699+
"graph_name": "g",
700+
"config": {"relationshipType": "REL", "mutateRelationshipType": "REL_UNDIRECTED", "aggregation": "MAX"},
701+
}
702+
703+
692704
@pytest.mark.compatible_with(min_inclusive=ServerVersion(2, 6, 0))
693705
def test_remote_projection_on_specific_database(runner: CollectingQueryRunner, aura_gds: AuraGraphDataScience) -> None:
694706
aura_gds.set_database("bar")

0 commit comments

Comments
 (0)