
From:  Perrone, Alexander G. 
Subject:  [igraph] List triangles 
Date:  Tue, 21 Feb 2017 16:32:31 +0000 
How can one list all the triangles in igraph C? I could not find an example in documentation. I'd like the same output as triangles(g) in R. I tried the following as an example but I cannot get it to work. Error is Segmentation fault (core dumped). Any
help would be much appreciated.
#include <igraph.h>
int main(void) {
igraph_vector_t v;
igraph_vector_int_t triangles;
igraph_t graph;
igraph_real_t edges[] = { 0, 1, 0, 2, 1, 2, 2, 3, 2, 4, 3, 4 };
igraph_vector_view(&v, edges, sizeof(edges)/sizeof(double));
igraph_create(&graph, &v, 0, IGRAPH_UNDIRECTED);
igraph_list_triangles(&graph, &triangles);
igraph_vector_int_destroy(&triangles);
}
Alex

[Prev in Thread]  Current Thread  [Next in Thread] 