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
.
Main definitions #
SimpleGraph.edist
is the graph extended metric.SimpleGraph.dist
is the graph metric.
TODO #
Provide an additional computable version of
SimpleGraph.dist
for whenG
is connected.When directed graphs exist, a directed notion of distance, likely
ENat
-valued.
Tags #
graph metric, distance
Metric #
The extended distance between two vertices is the length of the shortest walk between them.
It is ⊤
if no such walk exists.
Equations
- G.edist u v = ⨅ (w : G.Walk u v), ↑w.length
Instances For
Alias of SimpleGraph.edist_le
.
The extended distance between vertices is equal to 1
if and only if these vertices are adjacent.
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
.
Equations
- G.dist u v = (G.edist u v).toNat
Instances For
The distance between vertices is equal to 1
if and only if these vertices are adjacent.