# Neighborhood Connectivity¶

Neighborhood connectivity is a measure based on degree centrality. Connectivity of a vertex is its degree. Neighborhood connectivity is average connectivity of neighbours of given vertex.

$$NC(x)=\frac{\sum_{k \in N(x)}{|N(k)|}}{|N(x)|}$$

Where $$N(x)$$ is set of neighbours of vertex $$x$$

For further informations please refer to [Maslov].

import ml.sparkling.graph.operators.OperatorsDSL._
import org.apache.spark.SparkContext
import org.apache.spark.graphx.Graph

implicit ctx:SparkContext=???
// initialize your SparkContext as implicit value
val graph =???

val centralityGraph: Graph[Double, _] = graph.neighborhoodConnectivity()
// Graph where each vertex is associated with its neighborhood connectivity


You can also compute neighborhood connectivity for graph treated as undirected one:

import ml.sparkling.graph.operators.OperatorsDSL._
import org.apache.spark.SparkContext
import ml.sparkling.graph.api.operators.measures.VertexMeasureConfiguration
import org.apache.spark.graphx.Graph

implicit ctx:SparkContext=???
// initialize your SparkContext as implicit value
val graph =???