节点分类#

此模块提供用于节点分类问题的函数。

此模块中的函数未导入到顶层 networkx 命名空间中。您可以通过导入 networkx.algorithms.node_classification 模块来访问这些函数,然后将这些函数作为 node_classification 的属性来访问。例如

>>> from networkx.algorithms import node_classification
>>> G = nx.path_graph(4)
>>> G.edges()
EdgeView([(0, 1), (1, 2), (2, 3)])
>>> G.nodes[0]["label"] = "A"
>>> G.nodes[3]["label"] = "B"
>>> node_classification.harmonic_function(G)
['A', 'A', 'B', 'B']

参考文献#

Zhu, X., Ghahramani, Z., & Lafferty, J. (2003, August). Semi-supervised learning using gaussian fields and harmonic functions. In ICML (Vol. 3, pp. 912-919).

harmonic_function(G[, max_iter, label_name])

基于调和函数的节点分类

local_and_global_consistency(G[, alpha, ...])

基于局部和全局一致性的节点分类