Note

This documents the development version of NetworkX. Documentation for the current release can be found here.

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


## Harmonic Function¶

Function for computing Harmonic function algorithm by Zhu et al.

### 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¶

Function for computing Local and global consistency algorithm by Zhou et al.

### References¶

Zhou, D., Bousquet, O., Lal, T. N., Weston, J., & Schölkopf, B. (2004). Learning with local and global consistency. Advances in neural information processing systems, 16(16), 321-328.

 local_and_global_consistency(G[, alpha, …]) Node classification by Local and Global Consistency