g3-toolkit API Reference
    Preparing search index...

    Function allShortestPaths

    • Union of ALL shortest paths between two nodes (review 9.17: the singular findShortestPath made "Find paths to here" a one-path demo by construction). Layered BFS from the source records each node's distance; an edge belongs to the union iff it steps from distance d to d+1 along some shortest route, collected by walking backward from the target through distance-decreasing edges. The result is the SUBGRAPH of shortest routes (nodeIds/edgeIds), plus the route count (capped: counts can be exponential in dense graphs; the cap keeps the label honest as "50+").

      maxHops bounds the layered BFS exactly as it bounds findShortestPath: a target farther than the bound is found: false (issue #29: the loop used to read only the frontier, so a search between distant nodes on a large graph ran to exhaustion while the option documented a bound it did not apply).

      Endpoints follow findShortestPath's rule: a node hasNode does not report is never found; an existing node is its own zero-hop path, here with pathCount: 1.

      Parameters

      • graph: PathGraph
      • sourceId: string
      • targetId: string
      • Optionaloptions: PathOptions & { countCap?: number }

      Returns PathResult & { pathCount: number }