Distance( gamma, X, Y )
Distance( gamma, X, Y, G )
This function returns the distance from X to Y in gamma. The parameters X and Y may be vertices or vertex sets. We define the distance d(<X>,<Y>) from X to Y to be the minimum length of a (directed) path joining a vertex of X to a vertex of Y if such a path exists, and -1 otherwise.
The optional parameter G, if present, is assumed to be a subgroup of Aut(<gamma>) fixing X setwise. Including such a G can speed up the function.
gap> Distance( JohnsonGraph(4,2), 1, 6 ); 2 gap> Distance( JohnsonGraph(4,2), 1, 5 ); 1
Previous Up Top Next