cycle property

List<T> cycle

Returns the first cycle detected or an empty list if the graph is acyclic.

Note: A cycle starts and ends at the same vertex while inner vertices are distinct.


List<T> get cycle {
  // Find a cycle.
  final start = cycleVertex;
  if (start == null) {
    return <T>[];
  } else {
    return crawler.path(start, start);