()
| 4278 | * edge weight is `NaN` or `-Infinity`, or if any negative cycle is detected. |
| 4279 | * |
| 4280 | * **Example** (Finding all-pairs shortest paths) |
| 4281 | * |
| 4282 | * ```ts import.meta.vitest |
| 4283 | * import { Graph } from "effect" |
| 4284 | * |
| 4285 | * const graph = Graph.directed<string, number>((mutable) => { |
| 4286 | * const a = Graph.addNode(mutable, "A") |
| 4287 | * const b = Graph.addNode(mutable, "B") |
| 4288 | * const c = Graph.addNode(mutable, "C") |
| 4289 | * Graph.addEdge(mutable, a, b, 3) |
| 4290 | * Graph.addEdge(mutable, b, c, 2) |
| 4291 | * Graph.addEdge(mutable, a, c, 7) |
| 4292 | * }) |
| 4293 | * |
| 4294 | * const result = Graph.floydWarshall(graph, (edgeData) => edgeData) |
| 4295 | * const shortest = { distance: result.distances.get(0)?.get(2), path: result.paths.get(0)?.get(2) } |
| 4296 | * shortest // => { distance: 5, path: [0, 1, 2] } |
| 4297 | * ``` |
| 4298 | * |
| 4299 | * @category algorithms |
| 4300 | * @since 3.18.0 |
| 4301 | */ |
| 4302 | export const floydWarshall: { |
| 4303 | <E>( |
| 4304 | cost: (edgeData: E) => number |
| 4305 | ): <N, T extends Kind = "directed">(graph: Graph<N, E, T> | MutableGraph<N, E, T>) => AllPairsResult<E> |
| 4306 | <N, E, T extends Kind = "directed">( |
| 4307 | graph: Graph<N, E, T> | MutableGraph<N, E, T>, |
| 4308 | cost: (edgeData: E) => number |
| 4309 | ): AllPairsResult<E> |
| 4310 | } = dual(2, <N, E, T extends Kind = "directed">( |
nothing calls this directly
no test coverage detected
searching dependent graphs…