Total Neighbors
The algorithm counts the total number of neighbors, or vertices connected by one hop, of two vertices.
Specifications
Example
Suppose we have the following graph.
Dan and Jenny together have 6 neighbors in total.
Dan’s neighbors are:
-
Nancy
-
Kevin
-
Tom
-
Jenny
and Jenny’s neighbors are:
-
Dan
-
Tom
-
Amily
Running the algorithm with input vertices of Dan
and Jenny
would give us a result of 6
because the connection Dan - Jenny and Jenny - Dan is not double-counted.