Graph metric #
This module defines the SimpleGraph.edist function, which takes pairs of vertices to the length of
the shortest walk between them, or ⊤ if they are disconnected. It also defines SimpleGraph.dist
which is the ℕ-valued version of SimpleGraph.edist, and SimpleGraph.ball which is the open
ball in the graph extended metric.
Main definitions #
SimpleGraph.edistis the graph extended metric.SimpleGraph.distis the graph metric.SimpleGraph.ballis the open ball of a given radius around a vertex.
TODO #
Provide an additional computable version of
SimpleGraph.distfor whenGis connected.When directed graphs exist, a directed notion of distance, likely
ENat-valued.
Tags #
graph metric, distance, ball
Metric #
The extended distance between two vertices is the length of the shortest walk between them.
It is ⊤ if no such walk exists.
Instances For
Alias of SimpleGraph.edist_le.
The extended distance between vertices is equal to 1 if and only if these vertices are adjacent.
Supergraphs have smaller or equal extended distances to their subgraphs.
The distance between two vertices is the length of the shortest walk between them.
If no such walk exists, this uses the junk value of 0.
Instances For
The distance between vertices is equal to 1 if and only if these vertices are adjacent.
Supergraphs have smaller or equal distances to their subgraphs.
This bundles and abstracts some facts about the first three vertices of a shortest walk of length at least two: the first and third nodes are different and not connected.
Ball #
The ball of radius zero is empty.
The ball of radius one consists of just the center.
The ball of radius two consists of the center and its neighbors.
The ball of radius ⊤ is the connected component of the center.
A vertex is in the ball of radius ⊤ iff it is reachable from the center.
Balls are monotone in the radius.
The center vertex belongs to any ball of positive radius.
Ball membership is symmetric in center and point.