All Pairs Paths Calculator

Analyze node pairs with matrix-based path calculations. Compare direct routes, improved routes, distances, and reachability. Save clean outputs for review, sharing, documentation, and verification.

Calculator Input

Separate labels with commas.
Example: INF, X, NA, -
Use commas, spaces, or tabs. Use your infinity tokens for missing edges.

Example Data Table

This sample shows a four-node weighted graph. Use it to test the calculator quickly.

From \ To A B C D
A 0 3 INF 7
B 8 0 2 INF
C 5 INF 0 1
D 2 INF INF 0

About This Calculator

An all-pairs paths calculator finds the best route between every ordered pair of nodes in a weighted graph. In practical physics work, this idea supports path analysis across state transitions, lattice steps, transport links, detector channels, optical routing, and other structured systems.

This page accepts a weighted adjacency matrix. Each row and column represents a node. A number means a direct connection exists. An infinity token means there is no direct edge between those two positions. After submission, the page computes the shortest distance matrix and a pair-by-pair route summary.

The output is useful when direct paths are not always optimal. A route from one node to another may become shorter after passing through one or more intermediate nodes. The calculator checks every possible intermediate node combination and updates the current best distance whenever an improvement appears.

The page also provides a next-hop matrix, which is helpful for route reconstruction. This matrix tells you the first move to make when traveling from a chosen start node to a chosen destination. The pair summary table then presents the final path string and hop count for every ordered pair.

The heatmap offers a fast visual review. Lower values represent shorter paths, while blank entries indicate unreachable pairs. You can export the pair summary as CSV for spreadsheet work and save a PDF when you need a portable report.

Formula Used

The calculator uses the Floyd-Warshall recurrence.

Base value: d(i,j) = direct edge weight from i to j

Update rule: d(i,j) = min(d(i,j), d(i,k) + d(k,j))

Here, d(i,j) is the best known distance from node i to node j. The index k is an allowed intermediate node. The algorithm tests whether passing through k improves the current distance.

If a diagonal result becomes negative, a negative cycle exists. In that case, route reconstruction becomes unreliable.

How to Use This Calculator

  1. Enter unique node labels, separated with commas.
  2. Paste the weighted adjacency matrix in matching row and column order.
  3. Use infinity tokens such as INF for missing direct edges.
  4. Choose whether the graph is directed or undirected.
  5. Set decimal precision and optional output unit.
  6. Submit the form to generate distance and path results.
  7. Review the shortest distance matrix, next-hop matrix, and heatmap.
  8. Download the pair summary as CSV or PDF if needed.

FAQs

1. What does all-pairs paths mean?

It means finding the best path between every ordered pair of nodes in one graph. The result includes distances for all start and end combinations.

2. Which algorithm does this page use?

It uses the Floyd-Warshall algorithm. This method updates distances by checking whether each node improves routes between every other pair.

3. Can I use INF for missing edges?

Yes. You can enter INF or any tokens you define in the infinity token field. Those entries are treated as unreachable direct edges.

4. What is the next-hop matrix?

It shows the first node to visit on the shortest path from one node to another. It helps rebuild full routes after distance optimization.

5. Does this calculator support undirected graphs?

Yes. Choose the undirected option, and the page will normalize opposite edge directions into one symmetric weighted matrix before solving.

6. What happens if a negative cycle exists?

The page warns you when a negative cycle is detected. Distances may become unreliable for route reconstruction in that situation.

7. Why are some results blank in the graph?

Blank heatmap cells indicate unreachable pairs. They mean no valid path exists from the selected source node to the selected destination node.

8. What can I export from this page?

You can export the pair summary as CSV and PDF. This is useful for validation, reporting, documentation, or later analysis.

Related Calculators

Network degree calculatorAverage path length calculatorClustering coefficient calculatorBetweenness centrality calculatorCloseness centrality calculatorEigenvector centrality calculatorPageRank score calculatorKatz centrality calculatorAssortativity coefficient calculatorModularity score calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.