index.js
// determine if there's a path between 2 level entities
determine if there's a path between 2 level entities
determine if there ' s a path between 2 level entities
_isConnected(src, dest) {
    const visited = {}
    const toVisit = [ src ]
    while (toVisit.length) {
      const next = toVisit.pop()
      if (next.id === dest.id) {
        return true
      }
      if (!visited[next.id]) {
        visited[next.id] = true
        for (let id in next.to) { const child = next.to[id]; toVisit.push(child.entity) }
      }
    }
    return false
  }
_isConnected ( src , dest ) { const visited = { } const toVisit = [ src ] while ( toVisit . length ) { const next = toVisit . pop ( ) if ( next . id === dest . id ) { return true } if ( ! visited [ next . id ] ) { visited [ next . id ] = true for ( let id in next . to ) { const child = next . to [ id ] ; toVisit . push ( child . entity ) } } } return false }
determine if there's a path between 2 level entities
determine if there ' s a path between 2 level entities