Total Neighbors (Beta)
The algorithm calculates the total number of neighbors of two vertices.

Specifications

1
CREATE QUERY tg_total_neighbors(VERTEX a, VERTEX b,
2
SET<STRING> e_type)
Copied!

Parameters

Name
Description
Data type
a
A vertex.
VERTEX
b
A vertex.
VERTEX
e_type
Edge types to traverse.
SET<STRING>

Return value

The total number of neighbors of two vertices.

Example

Suppose we have the following graph.
Dan and Jenny together have 6 neighbors in total. Running the algorithm between Dan and Jenny would give us a result of 6. Note that since Jenny and Dan are neighbors themselves, the union of their neighbors includes both Jenny and Dan:
Query
Result
1
RUN QUERY tg_total_neighbors (("Jenny", "person"), ("Dan", "person"),
2
["friendship"])
Copied!
1
{
2
"error": false,
3
"message": "",
4
"version": {
5
"schema": 2,
6
"edition": "enterprise",
7
"api": "v2"
8
},
9
"results": [{"closeness": 6}]
10
}
Copied!
Last modified 27d ago
Export as PDF
Copy link