Same Community
The Same Community algorithm is a simple boolean algorithm to check whether two vertices share the same community labeling.
This algorithm takes two vertices as input, returning 1 if the two vertices are in the same community, and returning 0 if they are not in the same community.
Notes
The algorithm assumes that a community ID is stored in an integer attribute on each vertex. For this to happen, usually a Community Detection algorithm is run to create such community IDs.
This algorithm ignores edge weights.
Specifications
CREATE QUERY tg_same_community(VERTEX a, VERTEX b, STRING
communityAttribute)
Parameters
Name  Description  Default value 


The first vertex to compare. 
N/A 

The second vertex to compare with the first. 
N/A 

The vertex attribute used to store a vertex’s community ID. 
(A blank string) 
Example
Suppose we have the following vertices:
Their community IDs were generated by running the Weakly Connected Components algorithm on the graph.
If we run the algorithm between Kevin and Jenny, we get 1 because the two vertices are in the same community as indicated by their community
attribute: