0

I have the following setup

  1. Person is part of an organisation
  2. Person attends meeting
  3. Meeting is held in a location
  • More than one person can attend a meeting
  • More than one person can be part of same organisation
  • Persons from different organisation can attend same meeting
  • Multiple meeting can be held at same location

Of all the locations, there is a very oft-used one (the home base).

Meaning that when I "Expand a spanning Tree", and when I hit that location, my graph "explodes"

Example code I use:

MATCH (p:Person {pcode: 123456})
MATCH (terminator:Location) WHERE terminator.LocCode = 1

CALL apoc.path.spanningTree(p, {
minLevel: 1,
maxLevel: 3,
terminatorNodes: terminator
})
YIELD path
RETURN path
;

My hope when using terminatorNodes is that the path would stop at that particular node and ignore everything that's "beyond" .. but that's not what happens, in actual fact I see all the nodes "beyond"

I have tried using endNodes too, but there it looks like the code bombs out as soon as it bumps into that particular node and stops spanning trees everywhere else too!

I would like to obtain the same effect for a particular organisation too (mine!) but one step at a time!

What I am really trying to achieve is to retrieve all Persons connected to a starting person via meetings. I.e. "Start Person" A attends a meeting with another 3 people from different organisations, then I want to see those Persons returned, and their organisation, and then all the people linked to their organisation. The above is just a start, in the sense that I have other Node labels to deal with but with the same aim.

0

1 Answer 1

0

Couldn't you use a depth search in your case?

MATCH path = (p:Person {pcode: 123456})-[:RELATIONSHIP_NAME*1..3]->(terminator:Loaction)  
WHERE terminator.LocCode = 1   
RETURN path  
1
  • 1
    Thanks for that - it didn't quite work, but most likely because I did not set out that problem well enough. I will create a set of anonimised sample data with associated cypher queries before reposting! Jun 24, 2021 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.