Permalink
Browse files

fixed igraph_is_separator() for |V|-1 and |V| unique vertices in the …

…input vertex set
  • Loading branch information...
1 parent 32a743f commit f3b9f14859fb1b01f567ecc27d18c8daea954c78 @ntamas ntamas committed Sep 1, 2016
Showing with 12 additions and 3 deletions.
  1. +9 −0 examples/simple/igraph_is_separator.c
  2. +3 −3 src/separators.c
@@ -40,6 +40,15 @@ int main() {
/* Same graph, but another vertex */
igraph_is_separator(&graph, igraph_vss_1(6), &result);
if (result) FAIL("Non-center of star graph failed.", 2);
+
+ /* Same graph, all vertices but the center */
+ igraph_is_separator(&graph, igraph_vss_seq(1, 9), &result);
+ if (result) FAIL("All non-central vertices of star graph failed.", 5);
+ igraph_destroy(&graph);
+
+ /* Same graph, all vertices */
+ igraph_is_separator(&graph, igraph_vss_seq(0, 9), &result);
+ if (result) FAIL("All vertices of star graph failed.", 6);
igraph_destroy(&graph);
/* Karate club */
View
@@ -47,7 +47,7 @@ int igraph_i_is_separator(const igraph_t *graph,
long int start=0;
if (IGRAPH_VIT_SIZE(*vit) >= no_of_nodes-1) {
- /* Just need to check that we really have n-1 vertices in it */
+ /* Just need to check that we really have at least n-1 vertices in it */
igraph_vector_bool_t hit;
long int nohit=0;
IGRAPH_CHECK(igraph_vector_bool_init(&hit, no_of_nodes));
@@ -63,8 +63,8 @@ int igraph_i_is_separator(const igraph_t *graph,
}
igraph_vector_bool_destroy(&hit);
IGRAPH_FINALLY_CLEAN(1);
- if (nohit == no_of_nodes-1) {
- *res = 1;
+ if (nohit >= no_of_nodes-1) {
+ *res = 0;
return 0;
}
}

0 comments on commit f3b9f14

Please sign in to comment.