Skip to content
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

Issue with Neo4j GDS 1.4.1 K-Spanning tree example #98

Open
icejean opened this issue Jan 30, 2021 · 1 comment
Open

Issue with Neo4j GDS 1.4.1 K-Spanning tree example #98

icejean opened this issue Jan 30, 2021 · 1 comment
Labels
good first issue Indicates a good issue for first-time contributors

Comments

@icejean
Copy link

icejean commented Jan 30, 2021

Hi all,
I'm following Noe4j's online document at 6.5.1. Minimum Weight Spanning Tree - 6.5. Path finding algorithms , it seems that the Cypher to query K-Spanning tree doesn't work:

MATCH (n:Place)
WITH n.id AS Place, n.kminst AS Partition, count(*) AS count
WHERE count = 3
RETURN Place, Partition

Should it be modifyed to the following?

MATCH (n:Place)
WITH n.kminst AS Partition, count(*) AS count
WHERE count = 3
MATCH (n:Place)
WHERE n.kminst=Partition
RETURN n

I'v downloaded the example transport data of the book <Graph Algorithms>from data · master · examples / Graph Algorithms · GitLab, and loaded it into a graph database, all path algorithms of the package is O.K. , except the K-Spanning tree, can't figure out how to make it work.

MATCH (source:Place {id: "Amsterdam"})
CALL gds.alpha.spanningTree.kmin.write({
     nodeProjection:'Place',
     relationshipProjection:{
     EROAD:{
         type:'EROAD',
         properties:'distance',
         orientation:'NATURAL'
     }},
     startNodeId:id(source),
     relationshipWeightProperty:'distance',
     writeProperty: 'kminst',
     k: 3
})
YIELD createMillis, computeMillis, writeMillis, effectiveNodeCount
RETURN createMillis, computeMillis, writeMillis, effectiveNodeCount

MATCH (n:Place)
WITH n.kminst AS partition, count(*) AS count
RETURN partition, count

There's no partition gets the count value 3 (which is the value of parameter k), so don't know how to extract the result with a Cypher like this:

MATCH (n:Place)
WITH n.kminst AS Partition, count(*) AS count
WHERE count = 3
MATCH (n:Place)
WHERE n.kminst=Partition
RETURN n

Any idea is appreciated.

@icejean
Copy link
Author

icejean commented Jan 31, 2021

O.K., get the key that the Prim algorithm only applies to UNDIRECTED graph, should be mentioned in the algorithm document.

@FlorentinD FlorentinD added the good first issue Indicates a good issue for first-time contributors label Dec 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Indicates a good issue for first-time contributors
Projects
None yet
Development

No branches or pull requests

2 participants