[Top][All Lists]

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

[igraph] Re: shortest path length

From: Yong Zou
Subject: [igraph] Re: shortest path length
Date: Thu, 18 Jun 2009 10:32:56 +0200

Hi Tamas,

Thanks a lot for helping me. I tried to understand how to write a
correct code. It seems that I always get a
message:"structural_properties.c:873 :Size of the `res' and the `to'
should match".

 igraph_t graph;
 igraph_vector_ptr_t result_paths;
 igraph_vector_t *result_path;
 igraph_integer_t from_node;
 igraph_integer_t to_node;

 igraph_vector_ptr_init(&result_paths, 0);
 from_node = 10;
 to_node = 1000;
 igraph_get_shortest_paths(&graph, &result_paths, from_node,
igraph_vss_1(to_node), IGRAPH_ALL);
 result_path = igraph_vector_ptr_e(&result_paths, 0);   // get the
first path in the result vector
 for (i=0; i<igraph_vector_size(result_path); i++) {
        printf("%ld ", (long)igraph_vector_e(result_path, i));
 igraph_vector_destroy(result_path);        // destroy the path
 igraph_vector_ptr_destroy(result_paths);   // free all the pointers
and destroy the pointer list


reply via email to

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