networkX.core_number(graph)

今天在学习别人特征工程的时候,看到这样一个函数,max_kcore = pd.DataFrame(list(nx.core_number(graph).items()), columns=["qid", "kcore"]),找了半天找不到nx.core_number()函数返回的是什么。

官方文档是这样介绍的:

Return the core number for each vertex.

A k-core is a maximal subgraph that contains nodes of degree k or more.

The core number of a node is the largest value k of a k-core containing that node.

Parameters: G (NetworkX graph) – A graph or directed graph
Returns: core_number – A dictionary keyed by node to the core number.
Return type: dictionary
Raises: NetworkXError – The k-core is not defined for graphs with self loops or parallel edges.

我的理解:

返回值是:core_number   core_number是包含该节点的最大k_core

                  那k_core又是什么呢?k_core是一个包含度大于等于k的节点的极大子图

也就是该节点所在的所有极大子图中,最大节点度的最大值。不知道有什么用,也不清楚自己的理解对不对。

原文地址:https://www.cnblogs.com/smartwhite/p/9594991.html