| igraph Reference Manual |
|---|
int igraph_path_length_hist(const igraph_t *graph, igraph_vector_t *res, igraph_real_t *unconnected, igraph_bool_t directed);
This function calculates a histogram, by calculating the shortest path length between each pair of vertices. For directed graphs both directions might be considered and then every pair of vertices appears twice in the histogram.
Arguments:
graph: |
The input graph. |
res: |
Pointer to an initialized vector, the result is stored here. The first (i.e. zeroth) element contains the number of shortest paths of length 1, etc. The supplied vector is resized as needed. |
unconnected: |
Pointer to a real number, the number of pairs for which the second vertex is not reachable from the first is stored here. |
directed: |
Whether to consider directed paths in a directed graph (if not zero). This argument is ignored for undirected graphs. |
Returns:
|
Error code. |
Time complexity: O(|V||E|), the number of vertices times the number of edges.
See also:
<< 2.4. igraph_average_path_length — Calculates the average geodesic length in a graph. |
2.6. igraph_diameter — Calculates the diameter of a graph (longest geodesic). >> |