我試圖找出是否有要想辦法讓基於關係和兩個節點之間的最短距離,因爲這個例子: neo4j image example的Neo4j - 尋找基於關係屬性兩個節點之間的最短路徑
碼爲上圖:
CREATE (some_point_1:Point {title:'Some Point 1'})
CREATE (some_point_2:Point {title:'Some Point 2'})
CREATE (some_point_3:Point {title:'Some Point 3'})
CREATE (some_point_4:Point {title:'Some Point 4'})
CREATE (some_point_5:Point {title:'Some Point 5'})
CREATE (some_point_6:Point {title:'Some Point 6'})
CREATE (some_point_1)-[:distance {value:100}]->(some_point_2)
CREATE (some_point_2)-[:distance {value:150}]->(some_point_4)
CREATE (some_point_1)-[:distance {value:200}]->(some_point_3)
CREATE (some_point_3)-[:distance {value:300}]->(some_point_4)
CREATE (some_point_2)-[:distance {value:500}]->(some_point_5)
CREATE (some_point_4)-[:distance {value:300}]->(some_point_5)
CREATE (some_point_5)-[:distance {value:300}]->(some_point_6)
CREATE (some_point_6)-[:distance {value:300}]->(some_point_1)
在本例中的最短路徑應該是: some_point_1> some_point_2> some_point_4> some_point_5(100 + 150 + 300 = 550)
Cypher有這種可能嗎?
謝謝!它喚醒了^^ –