igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Printing results from shortest path function to file


From: Gábor Csárdi
Subject: Re: [igraph] Printing results from shortest path function to file
Date: Sun, 23 Mar 2014 20:51:16 -0400

res is a vector of pointers. Each pointer points to an igraph_vector_t. So you need to go over the pointers and print the vector one by one, by calling igraph_vector_print(). 

Gabor


On Sun, Mar 23, 2014 at 4:15 PM, Sana Rahim <address@hidden> wrote:
Hello, I am trying to write the results calculated from shortest path to a file, but not able to do. When i try to print by following way it produces some addresses and not paths. Please guide

void main()
{
igraph_t graph;
igraph_vector_t v;
igraph_vector_ptr_t res;
igraph_vector_t nrgeo;
igraph_integer_t sender;

FILE *input;
FILE *fp;
long int i;
input=fopen("DCell2k.txt", "r");

igraph_read_graph_edgelist(&graph, input, 0, 0);
   
/*initializing res and nrgeo*/
igraph_vector_ptr_init(&res, 0);
igraph_vector_init(&nrgeo, 0);
fp=fopen("results.txt", "w");
for(sender=0; sender<20; sender++)
{
  if(sender%3==0)
    {   
    continue;
    }
 igraph_get_all_shortest_paths(&graph, &res, &nrgeo, sender, igraph_vss_seq(1,20), IGRAPH_ALL);
fprintf(fp, "%p\n", VECTOR(res));
}
igraph_destroy(&graph);

}


_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help



reply via email to

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