В случае использования шифра следующий запрос возвращает общих друзей:
start a = node(1), b = node(4) match (a)--(x)--(b) return x;
В примере выше возвращаются общие друзья узла 1 и 4

Ниже приведена копия запросов и их результаты для примера с картинки:
neo4j-sh (0)$ start a = node(1), b = node(4) match (a)--(x)--(b) return x;
==> +--------------------+
==> | x |
==> +--------------------+
==> | Node[3]{Name->"C"} |
==> +--------------------+
==> 1 row
==> 9 ms
==>
neo4j-sh (0)$ start a = node(1), b = node(6) match (a)--(x)--(b) return x;
==> +--------------------+
==> | x |
==> +--------------------+
==> | Node[5]{Name->"E"} |
==> | Node[2]{Name->"B"} |
==> +--------------------+
==> 2 rows
==> 0 ms