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