Maximum Edges in a Simple Graph

Coding
Graph Theory
Easy
What is the worst-case number of edges in a simple undirected graph with n vertices?
Hint 1

In a simple graph, at most one edge can connect any given pair of vertices.

Hint 2

Count the number of distinct unordered pairs of vertices.

Show worked solution
  1. 1. Count vertex pairs

    A simple undirected graph can have at most one edge per unordered pair of distinct vertices.

  2. 2. Apply the combination count

    The number of unordered pairs from vertices is , which equals the maximum edge count.

Answer: n(n-1)/2

Related roles: Browse quant jobs

Related problems