| igraph Reference Manual |
|---|
int igraph_girth(const igraph_t *graph, igraph_integer_t *girth, igraph_vector_t *circle);
The current implementation works for undirected graphs only, directed graphs are treated as undirected graphs. Loop edges and multiple edges are ignored.
If the graph is a forest (ie. acyclic), then zero is returned.
This implementation is based on Alon Itai and Michael Rodeh: Finding a minimum circuit in a graph Proceedings of the ninth annual ACM symposium on Theory of computing , 1-10, 1977. The first implementation of this function was done by Keith Briggs, thanks Keith.
Arguments:
|
The input graph. |
|
Pointer to an integer, if not |
|
Pointer to an initialized vector, the vertex ids in
the shortest circle will be stored here. If |
Returns:
Error code. |
Time complexity: O((|V|+|E|)^2), |V| is the number of vertices, |E| is the number of edges in the general case. If the graph has no circles at all then the function needs O(|V|+|E|) time to realize this and then it stops.
<< 2.9. igraph_diameter — Calculates the diameter of a graph (longest geodesic). |
3. Neighborhood of a vertex >> |