How to use the leidenalg.ALL_NEIGH_COMMS function in leidenalg

To help you get started, we’ve selected a few leidenalg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vtraag / leidenalg / tests / test_Optimiser.py View on Github external
def test_optimiser(self):
    G = reduce(ig.Graph.disjoint_union, (ig.Graph.Tree(10, 3, mode=ig.TREE_UNDIRECTED) for i in range(10)));
    partition = leidenalg.CPMVertexPartition(G, resolution_parameter=0);
    self.optimiser.consider_comms=leidenalg.ALL_NEIGH_COMMS;
    self.optimiser.optimise_partition(partition);
    self.assertListEqual(
        partition.sizes(), 10*[10],
        msg="After optimising partition failed to find different components with CPMVertexPartition(resolution_parameter=0)");
github vtraag / leidenalg / tests / test_Optimiser.py View on Github external
def test_move_nodes(self):
    G = ig.Graph.Full(100);
    partition = leidenalg.CPMVertexPartition(G, resolution_parameter=0.5);
    self.optimiser.move_nodes(partition, consider_comms=leidenalg.ALL_NEIGH_COMMS);
    self.assertListEqual(
        partition.sizes(), [100],
        msg="CPMVertexPartition(resolution_parameter=0.5) of complete graph after move nodes incorrect.");