Neighborhood-inclusion in networks

This vignette describes the concept of neighborhood-inclusion, its connection with network centrality and gives some example use cases with the netrankr package. The partial ranking induced by neighborhood-inclusion can be used to assess partial centrality or compute probabilistic centrality.

Theoretical Background

In an undirected graph $G=(V,E)$, the neighborhood of a node $u \in V$ is defined as $$N(u)=\lbrace w : \lbrace u,w \rbrace \in E \rbrace$$ and its closed neighborhood as $N[v]=N(v) \cup \lbrace v \rbrace$. If the neighborhood of a node $u$ is a subset of the closed neighborhood of a node $v$, $N(u)\subseteq N[v]$, we speak of neighborhood inclusion. This concept defines a dominance relation among nodes in a network. We say that $u$ is dominated by $v$ if $N(u)\subseteq N[v]$. Neighborhood-inclusion induces a partial ranking on the vertices of a network. That is, (usually) some (if not most!) pairs of vertices are incomparable, such that neither $N(u)\subseteq N[v]$ nor $N(v)\subseteq N[u]$ holds. There is, however, a special graph class where all pairs are comparable (found in this vignette).

The importance of neighborhood-inclusion is given by the following result:

$$ N(u)\subseteq N[v] \implies c(u)\leq c(v), $$ where $c$ is a centrality index defined on special path algebras. These include many of the well known measures like closeness (and variants), betweenness (and variants) as well as many walk-based indices (eigenvector and subgraph centrality, total communicability,...).

Very informally, if $u$ is dominated by $v$, then u is less central than $v$ no matter which centrality index is used, that fulfill the requirement. While this is the key result, this short description leaves out many theoretical considerations. These and more can be found in

Schoch, David & Brandes, Ulrik. (2016). Re-conceptualizing centrality in social networks. European Journal of Appplied Mathematics, 27(6), 971–985. (link)

Neighborhood-inclusion in the netrankr Package

set.seed(1886) #for reproducibility

We work with the following simple graph.

g <- dbces11

     vertex.color="black",vertex.label.color="white", vertex.size=16,vertex.label.cex=0.75,

We can compare neighborhoods manually with the neighborhood function of the igraph package. Note the mindist parameter to distinguish between open and closed neighborhood.

u <- 3
v <- 5
Nu <- neighborhood(g,order=1,nodes=u,mindist = 1)[[1]] #N(u) 
Nv <- neighborhood(g,order=1,nodes=v,mindist = 0)[[1]] #N[v] 


Although it is obvious that Nu is a subset of Nv, we can verify it as follows.


Checking all pairs of nodes can efficiently be done with the neighborhood_inclusion() function from the netrankr package.

P <- neighborhood_inclusion(g, sparse = FALSE)

If an entry P[u,v] is equal to one, we have $N(u)\subseteq N[v]$.

The function dominance_graph() can alternatively be used to visualize the neighborhood inclusion as a directed graph.

g.dom <- dominance_graph(P)

     vertex.color="black",vertex.label.color="white", vertex.size=16, vertex.label.cex=0.75,
     edge.color="black", edge.arrow.size=0.5,margin=0,asp=0.5)

Centrality and Neighborhood-inclusion

We start by calculating some standard measures of centrality found in the ìgraph package for our example network. Note that the netrankr package also implements a great variety of indices, but they need further specifications described in this vignette.

cent.df <- data.frame(

#rounding for better readability
cent.df.rounded <- round(cent.df,4) 

Notice how for each centrality index, different vertices are considered to be the most central node. The most central from degree to subgraph centrality are $11$, $8$, $6$, $7$ and $10$. Note that only undominated vertices can achieve the highest score for any reasonable index. As soon as a vertex is dominated by at least one other, it will always be ranked below the dominator. We can check for undominated vertices simply by forming the row Sums in P.


r length(which(rowSums(P)==0)) nodes are undominated in the graph. It is thus entirely possible to find indices that would also rank $4, 5$ and $9$ on top.

Besides the top ranked nodes, we can check if the entire partial ranking P is preserved in each centrality ranking. If there exists a pair $u$ and $v$ and index $c()$ such that $N(u)\subseteq N[v]$ but $c(v)>c(u)$, we do not consider $c$ to be a valid index.

In our example, we considered vertex $3$ and $5$, where $3$ was dominated by $5$. It is easy to verify that all centrality scores of $5$ are in fact greater than the ones of $3$ by inspecting the respective rows in the table. To check all pairs, we use the function is_preserved. The function takes a partial ranking, as induced by neighborhood inclusion, and a score vector of a centrality index and checks if P[i,j]==1 & scores[i]>scores[j] is FALSE for all pairs i and j.

apply(cent.df[,2:6],2,function(x) is_preserved(P,x))

All considered indices preserve the neighborhood inclusion preorder on the example network.

NOTE: Preserving neighborhood inclusion on one network does not guarantee that an index preserves it on all networks. For more details refer to the paper cited in the first section.

Try the netrankr package in your browser

Any scripts or data that you put into this service are public.

netrankr documentation built on Sept. 5, 2021, 5:19 p.m.