camunda-modeler-plugin/main/bpmndt/PathFinder.js
/**
   * Finds all paths between a given start and end element.
   */
Finds all paths between a given start and end element.
Finds all paths between a given start and end element .
find(start, end) {
    const paths = [];
    const stack = [];
    stack.push({ id: start, path: [] });
    while (stack.length !== 0) {
      const current = stack.pop();
      if (this._isLoop(current)) {
        continue;
      }
      current.path.push(current.id);
      if (current.id === end) {
        paths.push(current.path);
        continue;
      }
      const element = this.elementRegistry.get(current.id);
      if (element === undefined) {
        continue;
      }
      const next = this._getOutgoing(element).concat(this._getBoundary(element.id));
      for (const id of next) {
        stack.push({ id: id, path: current.path.slice() });
      }
    }
    return paths.reverse();
  }
find ( start , end ) { const paths = [ ] ; const stack = [ ] ; stack . push ( { id : start , path : [ ] } ) ; while ( stack . length !== 0 ) { const current = stack . pop ( ) ; if ( this . _isLoop ( current ) ) { continue ; } current . path . push ( current . id ) ; if ( current . id === end ) { paths . push ( current . path ) ; continue ; } const element = this . elementRegistry . get ( current . id ) ; if ( element === undefined ) { continue ; } const next = this . _getOutgoing ( element ) . concat ( this . _getBoundary ( element . id ) ) ; for ( const id of next ) { stack . push ( { id : id , path : current . path . slice ( ) } ) ; } } return paths . reverse ( ) ; }
Finds all paths between a given start and end element.
Finds all paths between a given start and end element .
// stop branch, if loop is detected // stop branch, if end is reached // stop branch, if element does not exist anymore