Node Classification#

This module provides the functions for node classification problem.

The functions in this module are not imported into the top level networkx namespace. You can access these functions by importing the networkx.algorithms.node_classification modules, then accessing the functions as attributes of node_classification. For example:

>>> 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']

References#

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])

Node classification by Harmonic function

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

Node classification by Local and Global Consistency