The diameter of a graph is the length of the longest geodesic.
The graph to analyze.
Logical, whether directed or undirected paths are to be considered. This is ignored for undirected graphs.
Logical, what to do if the graph is unconnected. If FALSE, the function will return a number that is one larger the largest possible diameter, which is always the number of vertices. If TRUE, the diameters of the connected components will be calculated and the largest one will be returned.
Optional positive weight vector for calculating weighted
distances. If the graph has a
The diameter is calculated by using a breadth-first search like method.
get_diameter returns a path with the actual diameter. If there are
many shortest paths of the length of the diameter, then it returns the first
farthest_vertices returns two vertex ids, the vertices which are
connected by the diameter path.
A numeric constant for
diameter, a numeric vector for
farthest_vertices returns a list with two
vertices The two vertices that are the farthest.
distance Their distance.
Gabor Csardi [email protected]
1 2 3 4 5 6 7 8 9 10 11 12 13
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.