0

I am struggling to understand this problem, I run table(coreness(data)) on my data set that is undirected, the output is as below, but as we know core 0, should consider all network, is it right? core zero is the whole graph because at least all of the vertices have degree 0, also do smaller valued cores contain all larger valued cores?

so my graph has 440 vertices, why in the core 0, the formula that I explained above give me just 30 vertices?

coreness
  0   1   2   3   4 
 30 102 143 140  25 

eli
  • 184
  • 2
  • 12
  • it would be much better if you would just follow the guidelines and provide reproducible examples (there is also a good chance that in the process you will find the answer to your question...) https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – desval Jul 01 '20 at 13:44

1 Answers1

1

Coreness is defined for each node, core instead for the whole graph. From ?coreness:

The k-core of graph is a maximal subgraph in which each vertex has at least degree k.

i.e. as you say the 0-core of a graph has all the nodes, since they are all of at least degree 0.

As you might expect, coreness returns the coreness of each node. From ?coreness:

The coreness of a vertex is k if it belongs to the k-core but not to the (k+1)-core.

This means that the number of nodes with coreness 0 is not the total number of nodes belonging to the 0-core of the graph, but those that would drop out if you consider the 1-core. In other words, the total number of nodes in the 0-core is nodes with coreness>=0. The number of nodes in the 1-core is the count of nodes with coreness>=1 and so on.

A simple example:

library(igraph)

set.seed(345)
g <- erdos.renyi.game(50, 0.05)

coreness(g)
 [1] 1 2 1 1 1 1 0 2 2 2 2 2 2 1 1 2 1 2 2 2 2 2 2 2 1 2 2 1 2 2 2 2 2 2 2 0 2 2
[39] 2 2 2 2 2 2 1 2 2 2 2 1

table(coreness(g))
 0  1  2 
 2 12 36
desval
  • 2,345
  • 2
  • 16
  • 23