Graph Edges Calculator (Complete Graph)
Find how many edges a complete graph K_n has for a given number of vertices, undirected or directed.
Graph type
Unordered pairs of distinct vertices (handshakes)
- 1
Ordered vertex pairs
6 × (6 − 1) = 30 - 2
Undirected edges (each pair counted twice)
30 ÷ 2 = 15Dividing by 2 removes the double-counting: {a, b} and {b, a} are the same edge.
How does this calculator work?
A complete graph K_n joins every pair of vertices. For n vertices the undirected edge count is the handshake number n(n−1)/2, while a directed complete graph has n(n−1) edges — twice as many. Both grow quadratically, and n = 0 or 1 gives zero edges.
Formula
How this is calculated
A complete graph K_n connects every pair of distinct vertices. Enter n, the number of vertices (a whole number, n ≥ 0), and choose the graph type. In an undirected complete graph each unordered pair {a, b} contributes a single edge, so the total is the binomial coefficient C(n, 2) = n(n−1)/2 — the classic "handshake" number, since it also counts how many handshakes occur when n people each shake hands once with everyone else.
A directed (oriented) complete graph instead counts every ordered pair (a, b) with a ≠ b, allowing an arrow in each direction. There are n choices for the first vertex and (n−1) for the second, giving n(n−1) edges — exactly twice the undirected count. Both formulas grow quadratically with n, which is why the edges-versus-vertices curve curves upward sharply.
The calculator floors any decimal input to an integer and rejects negative values. Edge cases behave naturally: n = 0 and n = 1 both yield 0 edges (no pairs exist), and n = 2 yields 1 undirected or 2 directed edges. Self-loops and multi-edges are not counted, matching the definition of a simple complete graph.
Frequently asked questions
If n people each shake hands once with every other person, the number of distinct handshakes equals the number of edges in an undirected complete graph: n(n−1)/2.
Each unordered pair becomes two ordered pairs (a→b and b→a), so the directed count n(n−1) is exactly double the undirected count n(n−1)/2.
Zero. With fewer than two vertices there are no pairs to connect, so a complete graph on 0 or 1 vertices has no edges.
Also known as
TG we-Calculate Editorial Team. (2026). Graph Edges Calculator (Complete Graph) [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/complete-graph-edges-calculator
TG we-Calculate Editorial Team. "Graph Edges Calculator (Complete Graph)." TG we-Calculate. 2026. https://we-calculate.com/calculator/complete-graph-edges-calculator.
TG we-Calculate Editorial Team, "Graph Edges Calculator (Complete Graph)," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/complete-graph-edges-calculator
@misc{wecalculate_complete_graph_edges_calculator, title = {Graph Edges Calculator (Complete Graph)}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/complete-graph-edges-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
