Skip to content

Commit 8662811

Browse files
committed
fix: PR comments - Copilot version
1 parent 4e125fd commit 8662811

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/_igraph/graphobject.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13796,29 +13796,29 @@ PyObject *igraphmodule_Graph_community_voronoi(igraphmodule_GraphObject *self,
1379613796

1379713797
/* Handle weights parameter */
1379813798
if (igraphmodule_attrib_to_vector_t(weights_o, self, &weights_v, ATTRIBUTE_TYPE_EDGE)) {
13799-
if (lengths_v != 0) {
13799+
if (lengths_v != NULL) {
1380013800
igraph_vector_destroy(lengths_v); free(lengths_v);
1380113801
}
1380213802
return NULL;
1380313803
}
1380413804

1380513805
/* Initialize result vectors */
1380613806
if (igraph_vector_int_init(&membership_v, 0)) {
13807-
if (lengths_v != 0) {
13807+
if (lengths_v != NULL) {
1380813808
igraph_vector_destroy(lengths_v); free(lengths_v);
1380913809
}
13810-
if (weights_v != 0) {
13810+
if (weights_v != NULL) {
1381113811
igraph_vector_destroy(weights_v); free(weights_v);
1381213812
}
1381313813
igraphmodule_handle_igraph_error();
1381413814
return NULL;
1381513815
}
1381613816

1381713817
if (igraph_vector_int_init(&generators_v, 0)) {
13818-
if (lengths_v != 0) {
13818+
if (lengths_v != NULL) {
1381913819
igraph_vector_destroy(lengths_v); free(lengths_v);
1382013820
}
13821-
if (weights_v != 0) {
13821+
if (weights_v != NULL) {
1382213822
igraph_vector_destroy(weights_v); free(weights_v);
1382313823
}
1382413824
igraph_vector_int_destroy(&membership_v);
@@ -13833,10 +13833,10 @@ PyObject *igraphmodule_Graph_community_voronoi(igraphmodule_GraphObject *self,
1383313833
weights_v,
1383413834
mode, radius)) {
1383513835

13836-
if (lengths_v != 0) {
13836+
if (lengths_v != NULL) {
1383713837
igraph_vector_destroy(lengths_v); free(lengths_v);
1383813838
}
13839-
if (weights_v != 0) {
13839+
if (weights_v != NULL) {
1384013840
igraph_vector_destroy(weights_v); free(weights_v);
1384113841
}
1384213842
igraph_vector_int_destroy(&membership_v);
@@ -13847,10 +13847,10 @@ PyObject *igraphmodule_Graph_community_voronoi(igraphmodule_GraphObject *self,
1384713847

1384813848
/* Clean up input vectors */
1384913849

13850-
if (lengths_v != 0) {
13850+
if (lengths_v != NULL) {
1385113851
igraph_vector_destroy(lengths_v); free(lengths_v);
1385213852
}
13853-
if (weights_v != 0) {
13853+
if (weights_v != NULL) {
1385413854
igraph_vector_destroy(weights_v); free(weights_v);
1385513855
}
1385613856

tests/test_decomposition.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,9 @@ def testVoronoi(self):
499499

500500
# One community should have vertices 0-4, the other should have 5-9
501501
expected_communities = [{0, 1, 2, 3, 4}, {5, 6, 7, 8, 9}]
502-
self.assertTrue(
503-
communities == expected_communities or communities == expected_communities[::-1] # Order might be swapped
502+
self.assertEqual(
503+
set(frozenset(c) for c in communities),
504+
set(frozenset(c) for c in expected_communities)
504505
)
505506

506507
# Test 2: Two cliques connected by a single bridge edge

0 commit comments

Comments
 (0)