How to get the names of cities, using neo4j and PHP?

1

I followed this tutorial to do the following:

    echo "<h2>Encontre a rota mais curta da cidade A para a cidade B</h2>";

    $query4 = 'MATCH p = (a {name: \'Palo Alto\'})-[r*2..5]->(b {name: \'Santa Clara\'}) WHERE NOT(a-->b) WITH p.name, relationships(p.name) AS rcoll RETURN a.name, b.name, p.name, reduce(totalDistance=0, x IN rcoll| totalDistance + x.distance) AS totalDistance ORDER BY totalDistance LIMIT 5';  

    $result4 = $client->run($query4);

    $record4 = $result4->getRecord();

    echo '<b>' . $record4->get('a.name') . '</b>';

    foreach ($result4->getRecords() as $records4) 
    {
      echo ' ⇢ ' . $records4->get('p.name');
    }

    echo '<b>' . $record4->get('b.name') . '</b>';

I tried the name of the cities, using p.name of MATCH p .

Similar to the $query4 = 'MATCH (a {name: \'Palo Alto\'})-[r*2..5]->(p) RETURN a.name, p.name LIMIT 5'; that worked, only wanted to get the city of Palo Alto to Santa Clara using the shortest route and the total distance because this result gave Palo Alto to Milpitas for lack of shorter route and total distance .

    
asked by anonymous 20.09.2017 / 11:23

0 answers