Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jadell
Created January 25, 2012 02:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jadell/1674187 to your computer and use it in GitHub Desktop.
Save jadell/1674187 to your computer and use it in GitHub Desktop.
Mutual friends with Cypher
<?php
$client = new Everyman\Neo4j\Client();
$queryString =
"START firstPerson=node({firstId}), secondPerson=node({secondId}) " .
"MATCH firstPerson -[:FRIEND]-> mutualFriend <-[:FRIEND]- secondPerson" .
"RETURN mutualFriend";
$params = array(
"firstId" => 123,
"secondId" => 456
);
$query = new Everyman\Neo4j\Cypher\Query($client, $queryString, $params);
$results = $query->getResultSet();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment