graph_to_clusters#
- er_evaluation.data_structures.graph_to_clusters(graph)[source]#
Transform Graph into clusters dictionary.
- Parameters:
graph (Graph) – igraph Graph object.
- 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) >>> graph_to_clusters(graph) {0: array(['1', '2'], dtype=object), 1: array(['3', '5'], dtype=object), 2: array(['4'], dtype=object), 3: array(['6', '7', '8'], dtype=object)}