Beginner

完全图边数计算器

计算给定顶点数的完全图 K_n 的边数,支持无向图和有向图。
Whole number of nodes, n ≥ 0

Graph type

Undirected counts each pair once; directed counts both orderings
Undirected edges
15

Unordered pairs of distinct vertices (handshakes)

Vertices
6
Undirected
15
Directed
30
Your graph
Step by step
  1. 1

    Ordered vertex pairs

    6 × (6 − 1) = 30
  2. 2

    Undirected edges (each pair counted twice)

    30 ÷ 2 = 15
    Dividing by 2 removes the double-counting: {a, b} and {b, a} are the same edge.
结果仅为一般参考性的估算,并非专业建议——在依赖这些重要结果之前,请务必自行独立核实。 阅读完整免责声明.
快速解答

这个计算器是如何工作的?

完全图 K_n 连接每一对顶点。对于 n 个顶点,无向边数为握手数 n(n−1)/2,而有向完全图有 n(n−1) 条边——是前者的两倍。两者均以二次方速度增长,当 n = 0 或 1 时,边数为零。

公式
Undirected: E = n(n−1)/2 | Directed: E = n(n−1)
How this is calculated

完全图 K_n 连接所有不同顶点对。输入 n(顶点数,须为非负整数,n ≥ 0),并选择图的类型。在无向完全图中,每个无序顶点对 {a, b} 贡献一条边,因此总边数为二项式系数 C(n, 2) = n(n−1)/2——即经典的“握手数”,因为它也表示 n 人中每人与其他所有人各握一次手时的握手总次数。

有向(定向)完全图则统计每个满足 a ≠ b 的有序顶点对 (a, b),允许每个方向各有一条弧。第一个顶点有 n 种选择,第二个有 (n−1) 种,共得 n(n−1) 条边——恰好是无向图的两倍。两个公式都随 n 呈二次方增长,因此边数–顶点数曲线向上急剧弯曲。

计算器会将小数输入向下取整为整数,并拒绝负值。边界情况的处理符合直觉:n = 0 和 n = 1 均得 0 条边(不存在顶点对),n = 2 得 1 条无向边或 2 条有向边。自环和多重边不计入,与简单完全图的定义一致。

常见问题

如果 n 人中每人与其他所有人各握一次手,不同握手次数等于无向完全图的边数:n(n−1)/2。

每个无序顶点对变成两个有序对(a→b 和 b→a),因此有向边数 n(n−1) 恰好是无向边数 n(n−1)/2 的两倍。

零条。顶点数少于两个时,不存在可连接的顶点对,因此 0 或 1 个顶点的完全图没有边。

也称为

完全图边数
握手问题
边数计算
完全图
顶点边数
图论边数
kn图

APA

TG we-Calculate Editorial Team. (2026). 完全图边数计算器 [Online calculator]. TG we-Calculate. https://we-calculate.com/zh/calculator/complete-graph-edges-calculator

Chicago

TG we-Calculate Editorial Team. "完全图边数计算器." TG we-Calculate. 2026. https://we-calculate.com/zh/calculator/complete-graph-edges-calculator.

IEEE

TG we-Calculate Editorial Team, "完全图边数计算器," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/zh/calculator/complete-graph-edges-calculator

BibTeX

@misc{wecalculate_complete_graph_edges_calculator, title = {完全图边数计算器}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/zh/calculator/complete-graph-edges-calculator}}, year = {2026}, note = {TG we-Calculate} }

这个计算器对您有帮助吗?