com.phasmidsoftware.visitor.core.Tracer
See theTracer companion object
Typeclass for algorithm tracing. Implementations produce human-readable output showing the steps of a graph algorithm at a given nesting depth; the depth is used to indent output so that the logical structure of the algorithm is visible.
Each trace call provides two lazily-evaluated messages:
brief— a short summary (e.g. a count); always used by non-silent tracersdetail— a fuller description (e.g. collection elements); used only byverbose
The canonical no-op given (Tracer.silent) is resolved automatically, so existing call sites require no changes. Students opt in by summoning a tracer:
given Tracer[Int] = Tracer.verbose()
Kosaraju.stronglyConnectedComponents(graph)
Both brief and detail are by-name so that string interpolation is never evaluated in the silent case — zero overhead in production use.
Three built-in modes:
silent— no output, neitherbriefnordetailevaluatedsummary— emitsbriefonly, and only at depth 0verbose— emitsdetail(falling back tobriefifdetailis empty), up to a configurablemaxDepth
Type parameters
- V
-
the vertex type (present so that, for example, a vertex tracer and an edge tracer can coexist in scope via their distinct type parameters)
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
In this article