#!/usr/bin/env python
#-*- coding: utf-8 -*-
import networkx as nx


def _partitionGroup(p):
    '''
    get partition as label-dict
    this way we can check if two partitions are similar, despite
    different labels
    '''

    v = {}
    for key, value in sorted(p.iteritems()):
        v.setdefault(value, []).append(key)
    return sorted(v.values())


def _get_test_graph():
    '''test graph with known partition'''
    G = nx.Graph()
    G.add_nodes_from(range(5))
    G.add_edges_from([(0, 1), (1, 2), (1, 3), (2, 4), (3, 4)])
    nx.set_edge_attributes(G, 'weight', [1] * G.number_of_edges())
    return G

df8c4ce5d44d173e91c86bf800d1ff2eaa64ca14
<mask token>

<mask token>


def _partitionGroup(p):
    """
    get partition as label-dict
    this way we can check if two partitions are similar, despite
    different labels
    """
    v = {}
    for key, value in sorted(p.iteritems()):
        v.setdefault(value, []).append(key)
    return sorted(v.values())


<mask token>

<mask token>


def _partitionGroup(p):
    """
    get partition as label-dict
    this way we can check if two partitions are similar, despite
    different labels
    """
    v = {}
    for key, value in sorted(p.iteritems()):
        v.setdefault(value, []).append(key)
    return sorted(v.values())


def _get_test_graph():
    """test graph with known partition"""
    G = nx.Graph()
    G.add_nodes_from(range(5))
    G.add_edges_from([(0, 1), (1, 2), (1, 3), (2, 4), (3, 4)])
    nx.set_edge_attributes(G, 'weight', [1] * G.number_of_edges())
    return G

import networkx as nx


def _partitionGroup(p):
    """
    get partition as label-dict
    this way we can check if two partitions are similar, despite
    different labels
    """
    v = {}
    for key, value in sorted(p.iteritems()):
        v.setdefault(value, []).append(key)
    return sorted(v.values())


def _get_test_graph():
    """test graph with known partition"""
    G = nx.Graph()
    G.add_nodes_from(range(5))
    G.add_edges_from([(0, 1), (1, 2), (1, 3), (2, 4), (3, 4)])
    nx.set_edge_attributes(G, 'weight', [1] * G.number_of_edges())
    return G

#!/usr/bin/env python
#-*- coding: utf-8 -*-
import networkx as nx


def _partitionGroup(p):
    '''
    get partition as label-dict
    this way we can check if two partitions are similar, despite
    different labels
    '''

    v = {}
    for key, value in sorted(p.iteritems()):
        v.setdefault(value, []).append(key)
    return sorted(v.values())


def _get_test_graph():
    '''test graph with known partition'''
    G = nx.Graph()
    G.add_nodes_from(range(5))
    G.add_edges_from([(0, 1), (1, 2), (1, 3), (2, 4), (3, 4)])
    nx.set_edge_attributes(G, 'weight', [1] * G.number_of_edges())
    return G
