Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-11-2022 08:18 PM
Hello
I was wondering if you could help,
I am very new to Neo4j and would like some help with some Cypher queries. I have configured the nodes and relationships and would like to configure the following queries. I am looking for shortest path between sites using dijkstra algorithm.
mark ----> main ----> first ----> ninth ----> allchinese ----> chinese
mark ----> main ----> first ----> ninth ----> casino1 ----> megabucks
Relationship type "route" property "route" add 2nd property "well lighted" value yes
Or is there a better way of adding a relationship with 2 properties
Cypher query - show the shortest path for "mark" to marks property "game" value "megabucks" prefer "well lighted" streets Only show the streets in order and the casino name
mark ----> main ----> first ----> ninth ----> casino1 ----> megabucks
Thanks for any help on this
Mark
################## NODES ##################################
CREATE (n1: person {id:1, name:'mark', likes:'chinese', game:'megabucks'})
CREATE (n2: street {id:2, zipcode:'89050', street:'main'})
CREATE (n3: street {id:3, zipcode:'89050', street:'first'})
CREATE (n4: street {id:4, zipcode:'89050', street:'ninth'})
CREATE (n5: restaurant {id:5, zipcode:'89050', street:'ninth', name:'allchinese'})
CREATE (n6: restaurant {id:6, zipcode:'89051', street:'first', name:'allburgers'})
CREATE (n7: menu {id:7, food:'chinese'})
CREATE (n8: menu {id:8, food:'burgers'})
CREATE (n9: casino {id:9, name:'casino1'})
CREATE (n10: casino {id:10, name:'casino2'})
CREATE (n11: slot {id:11, name:'megabucks'})
CREATE (n12: slot {id:12, name:'batman'})
################ RELATIONSHIPS #################################
MATCH (a {id:1}), (b {id:2}) MERGE (a)-[:route {route:'10'}]->(b);
MATCH (a {id:2}), (b {id:1}) MERGE (a)-[:route {route:'10'}]->(b);
MATCH (a {id:2}), (b {id:3}) MERGE (a)-[:route {route:'100'}]->(b);
MATCH (a {id:3}), (b {id:2}) MERGE (a)-[:route {route:'100'}]->(b);
MATCH (a {id:3}), (b {id:4}) MERGE (a)-[:route {route:'10'}]->(b);
MATCH (a {id:4}), (b {id:3}) MERGE (a)-[:route {route:'10'}]->(b);
MATCH (a {id:4}), (b {id:5}) MERGE (a)-[:route {route:'10'}]->(b);
MATCH (a {id:5}), (b {id:4}) MERGE (a)-[:route {route:'10'}]->(b);
MATCH (a {id:4}), (b {id:6}) MERGE (a)-[:route {route:'10'}]->(b);
MATCH (a {id:6}), (b {id:4}) MERGE (a)-[:route {route:'10'}]->(b);
MATCH (a {id:5}), (b {id:7}) MERGE (a)-[:serves {serves:'10'}]->(b);
MATCH (a {id:7}), (b {id:4}) MERGE (a)-[:serves {serves:'10'}]->(b);
MATCH (a {id:5}), (b {id:8}) MERGE (a)-[:serves {serves:'10'}]->(b);
MATCH (a {id:8}), (b {id:5}) MERGE (a)-[:serves {serves:'10'}]->(b);
MATCH (a {id:4}), (b {id:9}) MERGE (a)-[:route {route:'10'}]->(b);
MATCH (a {id:9}), (b {id:4}) MERGE (a)-[:route {route:'10'}]->(b);
MATCH (a {id:4}), (b {id:10}) MERGE (a)-[:route {route:'10'}]->(b);
MATCH (a {id:10}), (b {id:4}) MERGE (a)-[:route {route:'10'}]->(b);
MATCH (a {id:9}), (b {id:11}) MERGE (a)-[:hosts {hosts:'10'}]->(b);
MATCH (a {id:11}), (b {id:9}) MERGE (a)-[:hosts {hosts:'10'}]->(b);
MATCH (a {id:10}), (b {id:12}) MERGE (a)-[:hosts {hosts:'10'}]->(b);
MATCH (a {id:12}), (b {id:10}) MERGE (a)-[:hosts {hosts:'10'}]->(b);
All the sessions of the conference are now available online