Skip to content

Commit 2203ce0

Browse files
committed
path algo use asNodes
1 parent 15e7dda commit 2203ce0

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

mcp_server/src/mcp_server_neo4j_gds/path_algorithm_handlers.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def find_shortest_path(
5656
costs = costs.tolist()
5757

5858
# Get node names using GDS utility function
59-
node_names = [self.gds.util.asNode(node_id) for node_id in node_ids]
59+
node_names = self.gds.util.asNodes(node_ids)
6060

6161
return {
6262
"totalCost": float(path_data["totalCost"].iloc[0]),
@@ -128,7 +128,7 @@ def delta_stepping_shortest_path(
128128

129129
# Get node names using GDS utility function
130130
target_node_name = self.gds.util.asNode(target_node_id)
131-
node_names = [self.gds.util.asNode(node_id) for node_id in node_ids]
131+
node_names = self.gds.util.asNodes(node_ids)
132132

133133
result_data.append(
134134
{
@@ -212,7 +212,7 @@ def dijkstra_single_source_shortest_path(
212212

213213
# Get node names using GDS utility function
214214
target_node_name = self.gds.util.asNode(target_node_id)
215-
node_names = [self.gds.util.asNode(node_id) for node_id in node_ids]
215+
node_names = self.gds.util.asNodes(node_ids)
216216

217217
result_data.append(
218218
{
@@ -295,7 +295,7 @@ def a_star_shortest_path(
295295
costs = costs.tolist()
296296

297297
# Get node names using GDS utility function
298-
node_names = [self.gds.util.asNode(node_id) for node_id in node_ids]
298+
node_names = self.gds.util.asNodes(node_ids)
299299

300300
return {
301301
"totalCost": float(path_data["totalCost"].iloc[0]),
@@ -373,7 +373,7 @@ def yens_shortest_paths(
373373
costs = costs.tolist()
374374

375375
# Get node names using GDS utility function
376-
node_names = [self.gds.util.asNode(node_id) for node_id in node_ids]
376+
node_names = self.gds.util.asNodes(node_ids)
377377

378378
result_data.append(
379379
{
@@ -764,7 +764,7 @@ def random_walk(self, **kwargs):
764764
node_ids = node_ids.tolist()
765765

766766
# Get node names using GDS utility function
767-
node_names = [self.gds.util.asNode(node_id) for node_id in node_ids]
767+
node_names = self.gds.util.asNodes(node_ids)
768768

769769
walks.append(
770770
{
@@ -864,7 +864,7 @@ def breadth_first_search(
864864
node_ids = node_ids.tolist()
865865

866866
# Get node names using GDS utility function
867-
node_names = [self.gds.util.asNode(node_id) for node_id in node_ids]
867+
node_names = self.gds.util.asNodes(node_ids)
868868

869869
traversals.append(
870870
{
@@ -960,7 +960,7 @@ def depth_first_search(
960960
node_ids = node_ids.tolist()
961961

962962
# Get node names using GDS utility function
963-
node_names = [self.gds.util.asNode(node_id) for node_id in node_ids]
963+
node_names = self.gds.util.asNodes(node_ids)
964964

965965
traversals.append(
966966
{
@@ -1046,7 +1046,7 @@ def bellman_ford_single_source_shortest_path(
10461046
costs = costs.tolist()
10471047

10481048
# Get node names using GDS utility function
1049-
node_names = [self.gds.util.asNode(node_id) for node_id in node_ids]
1049+
node_names = self.gds.util.asNodes(node_ids)
10501050

10511051
paths.append(
10521052
{
@@ -1138,7 +1138,7 @@ def longest_path(self, **kwargs):
11381138
costs = costs.tolist()
11391139

11401140
# Get node names using GDS utility function
1141-
node_names = [self.gds.util.asNode(node_id) for node_id in node_ids]
1141+
node_names = self.gds.util.asNodes(node_ids)
11421142

11431143
paths.append(
11441144
{

0 commit comments

Comments
 (0)