Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
526 views
in Technique[技术] by (71.8m points)

cypher - How to hide unwanted relationships between nodes in Neo4j

I'm new in Neo4j and I have a weird requirement.

I have some node

CREATE (a:node {title:1})
CREATE (b:node {title:2})
CREATE (c:node {title:3})
CREATE (d:node {title:4})

and multiple relationships between them:

CREATE (a)-[:RELATES{jump:[1]}]->(b)
CREATE (b)-[:RELATES{jump:[1]}]->(c)
CREATE (c)-[:RELATES{jump:[1]}]->(d)
CREATE (a)-[:RELATES{jump:[2]}]->(c)
CREATE (c)-[:RELATES{jump:[2]}]->(d)
CREATE (d)-[:RELATES{jump:[1]}]->(b)
CREATE (a)-[:RELATES{jump:[3]}]->(d)
CREATE (d)-[:RELATES{jump:[3]}]->(c)
CREATE (c)-[:RELATES{jump:[3]}]->(b)

The graph and the relationship are shown here: enter image description here

I want to check the graph such that only those relationships should be visible which I'm interested in. Now when I do something like this: MATCH (a)-[r]->(b) WHERE 1 IN r.jump RETURN a,b

I get the something like:

enter image description here

Is there a way where I can hide(not delete) the not relevant relationships while displaying the graph? May be something like this(edited on Image tool):

enter image description here

PS: Let Grey be white.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In neo4j 3.2.1 this feature has been relocated to the bottom left corner, under the gear icon: "Connect result nodes" (checked by default, thus returning all relationships between nodes included in the result).

uncheck the box


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...