我有一个包含多个最短路径的图,并且想要检索顶点的 ID 和边的 ID:
igraph_get_all_shortest_paths(...)
仅计算顶点列表。
不是吗
igraph_get_shortest_paths(&g, &vertices, &edges, from,igraph_vss_1(to), IGRAPH_ALL);
应该这样做吗?
当我运行时:
igraph_t g1;
igraph_vector_t v1;
int ret;
/* Create a graph */
igraph_vector_init(&v1, 0);
igraph_create(&g1, &v1, 0, 0);
igraph_add_vertices(&g1, 1, 0);
igraph_add_vertices(&g1, 1, 0);
igraph_add_vertices(&g1, 1, 0);
igraph_add_vertices(&g1, 1, 0);
igraph_add_vertices(&g1, 1, 0);
igraph_add_edge(&g1,0,1);
igraph_add_edge(&g1,0,2);
igraph_add_edge(&g1,2,3);
igraph_add_edge(&g1,1,3);
igraph_add_edge(&g1,0,4);
igraph_add_edge(&g1,4,3);
igraph_add_edge(&g1,4,3);
igraph_add_edge(&g1,4,3);
igraph_vector_ptr_t verts;
igraph_vector_ptr_init(&verts, 2);
igraph_vector_ptr_t eds;
igraph_vector_ptr_init(&eds, 2);
igraph_vector_t v2;
igraph_vector_init(&v2,2);
VECTOR(v2)[0] = 3;
VECTOR(v2)[1] = 3;
igraph_vs_t tovs = igraph_vss_vector(&v2);
igraph_get_shortest_paths(&g1, &verts, &eds, 0, tovs , IGRAPH_ALL);
igraph_destroy(&g1);
我收到错误:igraph_vector_clear: Assertion `v != ((void *)0)' failed