iddfs
iddfs(adj, start, maxDepth) repeats depth-limited DFS and returns the first-reach order discovered up to maxDepth. It accepts an adjacency list and returns vertex indices.
| Signature | Returns | Complexity |
|---|---|---|
iddfs(adj: usize[][], start: usize, maxDepth: usize) | usize[] | O(V + E) per depth pass; O(V) memory |
tyrus
import { iddfs } from "tyrus:algorithm";
const order: usize[] = iddfs([[1], [2], [3], []], 0, 2);
print(order); // [0, 1, 2]Study result
iddfsInfo returns IddfsInfo with the final visit order, attempted depth limits, and deterministic traversal metrics.
tyrus
interface IddfsInfo extends TraversalInfo {
depthLimitsTried: usize[];
iterationCount: usize;
}tyrus
import { IddfsInfo, iddfsInfo } from "tyrus:algorithm";
const info: IddfsInfo = iddfsInfo([[1, 2], [3], [3], []], 0, 2);
print(info.visitOrder); // [0, 1, 2, 3]
print(info.depthLimitsTried); // [0, 1, 2]
print(info.iterationCount); // 3
print(info.examinedEdgeCount); // 6
print(info.maxDepth); // 2