2.2. igraph_get_shortest_paths — Calculates the shortest paths from/to one vertex.

int igraph_get_shortest_paths(const igraph_t *graph, igraph_vector_ptr_t *res,
			      igraph_integer_t from, const igraph_vs_t to, 
			      igraph_neimode_t mode);

If there is more than one geodesic between two vertices, this function gives only one of them.

Arguments: 

graph:

The graph object.

res:

The result, this is a pointer vector, each element points to a vector object. These should be initialized before passing them to the function, which will properly clear and/or resize them and fill the ids of the vertices along the geodesics from/to the vertices.

from:

The id of the vertex from/to which the geodesics are calculated.

to:

Vertex sequence with the ids of the vertices to/from which the shortest paths will be calculated. A vertex might be given multiple times.

mode:

The type of shortest paths to be use for the calculation in directed graphs. Possible values:

IGRAPH_OUT

the outgoing paths are calculated.

IGRAPH_IN

the incoming paths are calculated.

IGRAPH_ALL

the directed graph is considered as an undirected one for the computation.

Returns: 

Error code:

IGRAPH_ENOMEM

not enough memory for temporary data.

IGRAPH_EINVVID

from is invalid vertex id, or the length of to is not the same as the length of res.

IGRAPH_EINVMODE

invalid mode argument.

Time complexity: O(|V|+|E|), |V| is the number of vertices, |E| the number of edges in the graph.

See also: 

igraph_shortest_paths() if you only need the path length but not the paths themselves.