Two-Hop Network

Returns the 2-hop network of a node `n`.

Parameters

  • node (String) – The name of node n.
  • name (String) – Node name (Default: ""). If not specified, node will be matched with its assigned ID.
  • neiSize (Int) – Number of top neighbors sorted by a property to return for every node. If not specified, the full 2-hop network is returned.
  • property (String) – Edge property (Default: "").

Returns

  • network (Map[String, List[String]]) – Map of nodes and their neighbor list starting with node n.

Examples

Reading the LoTR dataset, we send a query for a 2hop-network for Aragorn and a limit of (3) neighbors.

curl -X POST 127.0.0.1:8081/ViewAnalysisRequest \
-H "Content-Type: application/json" \
--data-binary @- << EOF
{
  "jsonrpc":"2.0",
  "analyserName":"com.raphtory.algorithms.twoHopNeighbors",
  "serialiserName":"com.raphtory.serialisers.DefaultSerialiser",
  "timestamp":10000,
  "args":["Aragorn","name","3"]
}
EOF

This returns the following network;

2hop-network example

{"time":10000,
"Aragorn":["Arwen","Denethor","Boromir"],
"Arwen":["Frodo","Elrond","Lúthien"],
"Denethor":["Elendil","Isildur","Gollum"],
"Boromir":["Frodo","Sam","Gimli"],
"viewTime":55}