Relationship filters in `apoc.path.spanningTree`

Hello everyone!

I'm trying to build a spanning tree but I want to exclude certain relationships. So I want to use a relationshipFilter that is just > to indicate direction but I also want to do something like !Alpha to exclude all the Alpha relationships. Is there no way to do that?

I does not look that way from my read of the documentation. Do these Alpha relationships have nodes with a specific label or labels that are not part of the path you want, so you could filter out these nodes with a node label filter? These would effectively filter the Alpha relationships indirectly.

Thankfully, we do! But there is a bug because even if I use backticks, the apoc call doesn't understand.

So, if I could say:

labelFilters: "-`primary:beta`"

Where the backticks imply that my label is, sadly, using special characters, I would be good. But while cypher itself knows how to handle that, it seems apoc doesn't for some reason.

Fixing all the labels to be the standard camel case resolves this problem, but that's a big lift of our graphdb

Your label isn’t actually defined with backticks as ’primary:beta’ with a colon in the label? That would be a very poor design. Or, do you have two labels on the node as primary and beta? If the latter, your node filter would be the following if you need to include both labels to identify the nodes attached to Alpha relationships.

“-primary|beta”

The label is primary:beta so the backticks aren't part of the label, but the colon is. :-(

That is what I thought you mean, unfortunately. You probably need to the backticks to use the label, as the colon is a delimiter for using multiple labels on a node. I the label is actually that, and does not represent two labels, then can you change it to something like primary-beta? I feel this will have issues in many inconvenient places if you stay with this format.

Yeah, I agree. I need to refactor the old code that's making those relationships.