Weighted Graph Calculator

Solve path costs, degrees, and connectivity from one page. Test edge lists with smart validation. See weighted network insights clearly in seconds online fast.

Calculator Input

Use one edge per line. Example: A,B,4
Example data table

Example Edge List

Source Target Weight
AB4
AC2
BC1
BD5
CD8
CE10
DE2
DF6
EF3

Suggested sample setup: Nodes = A, B, C, D, E, F. Source = A. Target = F. Graph type = Undirected.

Formula Used

  • Total edge weight: sum of all entered edge weights.
  • Average edge weight: total edge weight ÷ number of edges.
  • Weighted degree: sum of incident edge weights for a node.
  • Directed weighted total: weighted in-degree + weighted out-degree.
  • Density, undirected: 2E ÷ [N(N − 1)].
  • Density, directed: E ÷ [N(N − 1)].
  • Shortest path: Dijkstra is used for non-negative weights. Bellman-Ford is used for directed graphs with negative weights.
  • Minimum spanning tree: Kruskal’s algorithm selects the lowest-cost edges that connect all reachable nodes without cycles.

How to Use This Calculator

  1. Enter a graph name, choose directed or undirected, and set decimal places.
  2. List node labels separated by commas. The calculator can also infer nodes from edges.
  3. Paste one edge per line in the format source,target,weight.
  4. Enter a source node to calculate distances. Add a target node to return a shortest path and total cost.
  5. Click the calculate button to view summary metrics, tables, and Plotly charts above the form.
  6. Use the CSV or PDF buttons to export the current results.

FAQs

1. What does this weighted graph calculator measure?

It measures node count, edge count, total weight, average weight, density, weighted degrees, connectivity, adjacency matrix values, shortest paths, and spanning tree totals for suitable graphs.

2. What edge format should I use?

Use one edge per line in this format: source,target,weight. Example: A,B,4. Labels can be letters, words, or codes, and weights can be integers or decimals.

3. Can I analyze directed and undirected graphs?

Yes. Choose the graph type before calculating. Directed graphs keep arrow direction. Undirected graphs treat each edge as two-way for path and connectivity analysis.

4. How is the shortest path calculated?

Non-negative graphs use Dijkstra’s algorithm. Directed graphs with negative weights use Bellman-Ford. If a reachable negative cycle exists, shortest path values are flagged as unreliable.

5. Why is the shortest path skipped for undirected negative edges?

An undirected negative edge can be traversed back and forth, creating an immediate negative cycle. That makes shortest path totals unstable, so the calculator warns instead.

6. When does the calculator show a spanning tree?

It shows a minimum spanning tree for connected undirected graphs. If the graph is disconnected, it returns a minimum spanning forest instead of one complete tree.

7. What does weighted degree mean?

Weighted degree is the sum of the weights touching a node. In directed graphs, the calculator also separates incoming weight from outgoing weight.

8. Can I export the results?

Yes. After calculating, use the CSV button for data export or the PDF button for a printable results report containing the summary, tables, and chart section.

Related Calculators

adjacency matrix generatorpagerank calculatortopological sort calculatorminimum spanning tree calculatorgraph intersection calculatorgraph distance calculatorrandom graph generatorprim algorithm calculatorbreadth first search calculatorgraph compression 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.