I have been trying to make graphs using the igraph library in c. I have even reinstalled it but i am unable to understand the problem. The whole program is compiled successfully but i get no graph as an output. All the printf's are executed and are shown in the output only the graph seems to be missing.
Please help i am stuck in this problem.
#include <igraph.h>
int main(void)
{
igraph_real_t diameter;
igraph_t graph;
igraph_erdos_renyi_game(&graph, IGRAPH_ERDOS_RENYI_GNP, 1000, 5.0/1000,
IGRAPH_UNDIRECTED, IGRAPH_NO_LOOPS);
igraph_diameter(&graph, &diameter, 0, 0, 0, IGRAPH_UNDIRECTED, 1);
printf("Diameter of a random graph with average degree 5: %f\n",
(double) diameter);
igraph_destroy(&graph);
return 0;
}
This is the code i am using. Only the printf statement is being printed.There is no error or warning.
You are using igraph from C, and the C core of igraph completely lacks plotting capabilities. (This is deliberate). If you want to plot graphs, you have to use igraph's Python or R bindings; in the Python and R modules, plotting is implemented on top of the C core library.
plot
function on it - Tamás 2012-04-06 20:49
igraph_write_graph_edgelist
from C to save the edge list to a text file (see http://igraph.sourceforge.net/doc/html/igraphwritegraph_edgelist.html for more information). You can then read it back in Python using import igraph; g = igraph.load("edgelist.txt", format="edgelist")
, or in R using library(igraph); g <- read.graph("edgelist.txt", format="edgelist")
- Tamás 2012-04-07 19:08