private final void harvestSteps(final Traversal.Admin<?, ?> traversal) {
        for (final Step<?, ?> step : traversal.getSteps()) {
            this.matrix.put(step.getId(), step);
            if (step instanceof TraversalParent) {
                for (final Traversal.Admin<?, ?> globalChild : ((TraversalParent) step).getGlobalChildren()) {
                    this.harvestSteps(globalChild);
                }
                for (final Traversal.Admin<?, ?> localChild : ((TraversalParent) step).getLocalChildren()) {
                    this.harvestSteps(localChild);
                }
            }
        }
    }
A TraversalMatrix provides random, non-linear access to the steps of a traversal by their step id.
This is useful in situations where traversers becomes detached from their traversal (and step) and later need to be re-attached.
A classic use case is {@link TraversalVertexProgram} on {@link GraphComputer}.

@author Marko A. Rodriguez (http://markorodriguez.com)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalMatrix.java