Traversing walks #
Functions that help access different parts of a walk.
Main definitions #
SimpleGraph.Walk.getVert: Get the nth vertex encountered in a walk, or the last one ifnis too largeSimpleGraph.Walk.snd: The second vertex of a walk, or the only vertex in an empty walkSimpleGraph.Walk.penultimate: The penultimate vertex of a walk, or the only vertex in an empty walkSimpleGraph.Walk.firstDart: The first dart of a non-empty walkSimpleGraph.Walk.lastDart: The last dart of a non-empty walk
Tags #
walks
Get the nth vertex from a walk, where n is generally expected to be
between 0 and p.length, inclusive.
If n is greater than or equal to p.length, the result is the path's endpoint.
Equations
- SimpleGraph.Walk.nil.getVert x✝ = u
- (SimpleGraph.Walk.cons h p).getVert 0 = u
- (SimpleGraph.Walk.cons h q).getVert n.succ = q.getVert n
Instances For
Use support_getElem_eq_getVert to rewrite in the reverse direction.
Use getVert_eq_support_getElem to rewrite in the reverse direction.
The second vertex of a walk, or the only vertex in a nil walk.
Instances For
Use snd_eq_support_getElem_one to rewrite in the reverse direction.
Use support_getElem_one to rewrite in the reverse direction.
The penultimate vertex of a walk, or the only vertex in a nil walk.
Equations
- p.penultimate = p.getVert (p.length - 1)
Instances For
The last dart of a walk.
Equations
- p.lastDart hp = { fst := p.penultimate, snd := w, adj := ⋯ }
Instances For
Use firstDart_eq_head_darts to rewrite in the reverse direction.
Use head_darts_eq_firstDart to rewrite in the reverse direction.
Use head_edges_eq_mk_start_snd to rewrite in the reverse direction.
Use mk_penultimate_end_eq_getLast_edges to rewrite in the reverse direction.
Use getLast_edges_eq_mk_penultimate_end to rewrite in the reverse direction.