@maxgraph/core
    Preparing search index...

    Function traverse

    • Traverses the (directed) graph invoking the given function for each visited vertex and edge. The function is invoked with the current vertex and the incoming edge as a parameter. This implementation makes sure each vertex is only visited once. The function may return false if the traversal should stop at the given vertex.

      Example:

      GlobalConfig.logger.show();
      let cell = graph.getSelectionCell();
      graph.traverse(cell, false, (vertex, edge)=>
      {
      GlobalConfig.logger.debug(graph.getLabel(vertex));
      });

      Parameters

      • vertex: Cell | null = null

        that represents the vertex where the traversal starts.

      • directed: boolean = true

        Optional boolean indicating if edges should only be traversed from source to target. Default is true.

      • func: Function | null = null

        Visitor function that takes the current vertex and the incoming edge as arguments. The traversal stops if the function returns false.

      • edge: Cell | null = null

        Optional that represents the incoming edge. This is null for the first step of the traversal.

      • visited: Map<Cell, boolean> | null = null

        Optional Map from cells to true for the visited cells.

      • inverse: boolean = false

        Optional boolean to traverse in inverse direction. Default is false. This is ignored if directed is false.

      Returns void