     return successful
   }
 
-  private func checkGraphCyclesEdges(cycles: Set<Cycle>) -> Bool {
+  private func checkGraphCyclesEdges(cycles: [Cycle]) -> Bool {
     var successful: Bool = true
     for cycle in cycles {
       assert(cycle.edges.count >= 1)

  private func findAllReachableIndices(for startVertexIndex: Int) -> Set<Int> {
    var visited: Set<Int> = []
    var stack: [Int] = [startVertexIndex]
    while let fromIndex = stack.first {
      stack.removeFirst()

      visited.insert(fromIndex)
      for toIndex in graph.adjacencyList[fromIndex].flatMap({ $0.toIndices }) {
        if !visited.contains(toIndex) {
          stack.append(toIndex)
        }
      }
    }

    reachableIndices = Array(repeating: [], count: graph.vertices.count)
  }

  fileprivate func findAllCycles() -> [Cycle] {
    findAllReachableIndices()

    result = []
