traverse method
Implementation
Matrix traverse() {
var roots = this.roots();
State state = State(mtx: Matrix(), queue: TraverseQueue(), x: 0, y: 0);
if (roots.length == 0) {
throw "no graph roots found";
}
var mtx = state.mtx, queue = state.queue;
queue.add(incomeId: null, bufferQueue: null, items: roots);
mtx = traverseList(state);
return mtx;
}