Same Community
This algorithm takes two vertices, and returns 1 if they two vertices are in the same community, and returns 0 if they are not in the same community.
| The algorithm assumes that community detection has already completed and that a community ID is stored in an integer attribute on each vertex. | 
Parameters
| Name | Description | Data type | 
|---|---|---|
  | 
A vertex.  | 
  | 
  | 
A vertex.  | 
  | 
  | 
The community attribute used to store a vertex’s community ID.  | 
  | 
Return value
- 
Returns 1 if the two vertices are in the same community.
 - 
Returns 0 if the two vertices are not in the same community.
 
Example
Suppose we have the following vertices:
Their community IDs were generated by running the weakly connected component 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: