clusters_to_graph#

er_evaluation.data_structures.clusters_to_graph(clusters)[source]#

Transform clusters dictionary into Graph.

Parameters:

clusters (dictionary) – Dictionary mapping cluster identifiers to numpy array of cluster elements.

Returns:

Membership vector.

Examples

>>> from numpy import array
>>> clusters = {1: array([1, 2]), 2: array([3, 5]), 3: array([4]), 4: array([6, 7, 8])}
>>> graph = clusters_to_graph(clusters)