int main() { igraph_t graph; igraph_vector_ptr_t separators; long int i, n; igraph_famous(&graph, "zachary"); igraph_vector_ptr_init(&separators, 0); igraph_all_minimal_st_separators(&graph, &separators); n=igraph_vector_ptr_size(&separators); for (i=0; i<n; i++) { igraph_bool_t res; igraph_vector_t *sep=VECTOR(separators)[i]; igraph_is_separator(&graph, igraph_vss_vector(sep), &res); if (!res) { printf("Vertex set %li is not a separator!\n", i); igraph_vector_print(sep); return 1; } } igraph_destroy(&graph); for (i=0; i<n; i++) { igraph_vector_t *v=VECTOR(separators)[i]; igraph_vector_destroy(v); igraph_Free(v); } igraph_vector_ptr_destroy(&separators); return 0; }
int main() { igraph_t g; igraph_vector_t y; /* turn on attribute handling */ igraph_i_set_attribute_table(&igraph_cattribute_table); /* Create a graph, add some attributes and save it as a GraphML file */ igraph_famous(&g, "Petersen"); SETGAS(&g, "name", "Petersen's graph"); SETGAN(&g, "vertices", igraph_vcount(&g)); SETGAN(&g, "edges", igraph_ecount(&g)); igraph_vector_init_seq(&y, 1, igraph_vcount(&g)); SETVANV(&g, "id", &y); igraph_vector_destroy(&y); SETVAS(&g, "name", 0, "foo"); SETVAS(&g, "name", 1, "foobar"); igraph_vector_init_seq(&y, 1, igraph_ecount(&g)); SETEANV(&g, "id", &y); igraph_vector_destroy(&y); SETEAS(&g, "name", 0, "FOO"); SETEAS(&g, "name", 1, "FOOBAR"); igraph_write_graph_gml(&g, stdout, 0, ""); igraph_write_graph_graphml(&g, stdout); igraph_destroy(&g); return 0; }