Given a graph G=<V,E>G = \left< V, E \right>, and a subset S⊂VS \subset V, the sub-graph G(S)G(S) induced by SS is defined as

G(S)=<S,ES> G(S) = \left< S, E_S \right>

where ES={e:e=(u,v)∈E∧(u,v)∈S×S}E_S = \{ e : e = (u, v) \in E \wedge (u, v) \in S \times S\}.

G(S)G(S) is called a kk-core if it is the maximal sub-graph wuch that every vertex in SS has degree at least kk inside this sub-graph. Given the definition of kk-core, the core number of a vertex v∈Vv \in V is the maximum kk such tha t ∃S⊂V\exists S \subset V, G(S)G(S) is a kk-core and v∈Sv \in S.

The key observation is that, given a kk-core G(S)G(S), if we remove every vertex v∈Vv \in V (as long as edges incident to vv) such that d(v)<kd(v) < k, then G(S)G(S) remains a kk-core. Since

  1. If d(v)<kd(v) < k, then v∉Sv \notin S.
  2. Removing edges incident to vv will not affect edges inside G(S)G(S). Then, the vertices' degree inside G(S)G(S) remains unchanged.

This gives an algorithm for computing the core number of each vertex.

  1. for v∈Vv \in V:
  2. \quad check[v]←check[v] \leftarrow false
  3. while not check[v]=check[v] = true ∀v∈V\forall v \in V:
  4. \quad Get an vv with smallest d(v)d(v) and check[v]=check[v] = false
  5. \quad check[v]←check[v] \leftarrow true
  6. \quad core[v]←d(v)core[v] \leftarrow d(v)
  7. \quad for u∈N(v)u \in N(v) such that d(u)>kd(u) > k:
  8. \qquad Delete (v,u)(v, u)
  9. \qquad d(u)←d(u)−1d(u) \leftarrow d(u) - 1

We can use an array DD such that D[i]D[i] is a linked list and contains all vertices with degree ii. Therefore, line 4 can be executed in O(1)O(1) time.

Reference

[1] Batagelj, V. and Zaversnik, M., 2003. An O (m) algorithm for cores decomposition of networks. arXiv preprint cs/0310049.