Added context to forEachNode and forEachEdge.