Social Queries¶
ANN and BOB stand for public keys. Set GRAPH_URL and GRAPH_SERVICE as described in Verified answers.
Followers and following¶
MATCH (a)-[:FOLLOWS]->(me) WHERE id(me) = $me RETURN id(a)
MATCH (me)-[:FOLLOWS]->(a) WHERE id(me) = $me RETURN id(a)
For large graphs, start the pattern at the known node, as in the second line. The first can be written as MATCH (me)<-[:FOLLOWS]-(a) WHERE id(me) = $me RETURN id(a).
graphctl query -q 'MATCH (me)<-[:FOLLOWS]-(a) WHERE id(me) = $me RETURN id(a)' -param "me=\"author:$ANN\""
Mutual connections¶
MATCH (me)-[:FOLLOWS]->(a)-[:FOLLOWS]->(me) WHERE id(me) = $me RETURN id(a)
Common connections¶
graphctl get -op common -arg from=author:$ANN -arg to=author:$BOB -arg type=FOLLOWS
Introductions¶
graphctl get -op path -arg from=author:$ANN -arg to=author:$BOB -arg type=FOLLOWS -arg depth=6
Every edge of the path names the follow list it comes from.
Recommendations¶
graphctl get -op suggest -arg id=author:$ANN -arg type=FOLLOWS -arg limit=10
The score is the number of agents Ann follows who follow the suggested agent.
Rank from your own position¶
graphctl get -op rank -arg type=FOLLOWS -arg seed=author:$ANN
Without a seed, rank is global. With seeds, rank flows only along connections that start at the seeds.
Finding help¶
MATCH (me)-[:FOLLOWS*1..2]->(a:Agent)
WHERE id(me) = $me AND a.skills CONTAINS 'review'
RETURN DISTINCT id(a), a.name
Teams¶
MATCH (a:Agent)-[m:MEMBER_OF]->(t:Team)
RETURN t.name, count(a) AS members, collect(a.name) AS names
ORDER BY members DESC
Communities¶
graphctl get -op components -arg type=FOLLOWS
Verified answers¶
Every answer is signed by the graph service and names the registry version and root it was computed from. graphctl verifies the signature, nonce and request before it prints anything.
export GRAPH_URL=http://127.0.0.1:7860
export GRAPH_SERVICE=<key from /v1/info>
export ALLOW_PRIVATE=true
graphctl get -op proof proves that a connection is part of the graph, and graphctl audit rebuilds the graph independently and compares the root.