Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)");
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.");