Calculator Input
Example Data Table
This example is an unweighted undirected graph. You can paste it directly into the calculator to test the output quickly.
| Row | From | To | Weight | Meaning |
|---|---|---|---|---|
| 1 | A | B | 1 | Connects A and B |
| 2 | A | C | 1 | Connects A and C |
| 3 | B | C | 1 | Creates a triangle |
| 4 | B | D | 1 | Extends the graph outward |
| 5 | C | E | 1 | Links to another branch |
| 6 | D | E | 1 | Creates an alternate route |
| 7 | E | F | 1 | Adds a farther endpoint |
Formula Used
Shortest path distance: For every pair of vertices, the calculator finds the minimum path length between them.
Eccentricity of a node: e(v) = max d(v, u), where d(v, u) is the shortest distance from node v to node u.
Graph diameter: D = max e(v). It is the greatest shortest-path distance in the graph.
Graph radius: R = min e(v). It is the smallest eccentricity among all nodes.
Update rule: The calculator uses Floyd-Warshall style updates: d(i,j) = min(d(i,j), d(i,k) + d(k,j)).
Disconnected graphs: If some nodes are unreachable, the overall diameter is undefined. The tool also reports the largest finite shortest-path span for extra insight.
How to Use This Calculator
- Enter a graph name if you want a labeled report.
- Choose whether the graph is directed or undirected.
- Select weighted mode only when each edge has a numeric weight.
- Optionally enter a node list. Missing nodes are still detected from edges.
- Paste one edge per line in the edge list box.
- Click Calculate Diameter to place the result above the form.
- Review the summary cards, eccentricity table, paths, and distance matrix.
- Use the CSV or PDF buttons to export your results.
FAQs
1) What is graph diameter?
Graph diameter is the largest shortest-path distance between any two reachable nodes in a connected graph. It measures the graph’s widest minimum separation.
2) What happens if the graph is disconnected?
The overall diameter becomes undefined because at least one node pair has no path between them. This calculator also reports the largest finite span among reachable pairs.
3) Can I use weighted graphs here?
Yes. Turn on weighted mode and enter each line as node1, node2, weight. All weights should be positive for meaningful shortest-path results.
4) Does the calculator support directed graphs?
Yes. In directed mode, direction matters for every edge. A graph must be strongly connected for the diameter and radius to be fully defined.
5) What is the difference between eccentricity and radius?
Eccentricity belongs to one node and shows its farthest shortest-path distance. Radius is the smallest eccentricity across all nodes in the graph.
6) Why does this tool show center and peripheral nodes?
Center nodes have the minimum eccentricity, so they are most central. Peripheral nodes have the maximum eccentricity, so they sit farthest from the graph’s center.
7) What edge input formats work best?
Use one edge per line. Unweighted examples: “A B” or “A,B”. Weighted examples: “A B 4” or “A,B,4”. Avoid spaces inside node names.
8) Where is graph diameter useful?
It is useful in network design, transportation analysis, social graphs, routing studies, dependency mapping, and algorithm research where distance spread matters.