Common Neighbors (Beta)

The Common Neighbors algorithm calculates the number of common neighbors between two vertices.

Specification

CREATE QUERY tg_common_neighbors(VERTEX a, VERTEX b, SET<STRING> e_type)

Parameters

Name

Description

Data type

a

A vertex.

VERTEX

b

A vertex.

VERTEX

e_type

Edge types to traverse.

SET<STRING>

Return value

The number of common neighbors between two vertices.

Example

Suppose to have the following graph:

Running the algorithm between Dan and Jenny will show that they have 1 common neighbor:

RUN QUERY common_neighbors (("Jenny", "person"), ("Dan", "person"), 
    ["friendship"])

Last updated