shortestPathTo

fun shortestPathTo(to: S): List<S>

Finds the shortest path to a given state using a naive recursive algorithm.

Note: includes this state by default.

// Given a simple state machine: [A] -> [B] -> [C]
A.shortestPathTo(C) // listOf(A, B, C)
A.shortestPathTo(A) // listOf(A)

Return

a list of states making up the shortest path.

Parameters

to

The state to find a path to.