Graph discrepancy measures the imbalance of edge counts on induced subgraphs. In the Erdős-Spencer
problem, assign a sign to each graph edge
of the complete graph
. The discrepancy of the signing is the largest absolute value of the sum of signs on edges within
a subset
of the vertex set. The minimum
over all signings is
where
is the induced subgraph on
.
Erdős and Spencer (1971) showed that has order
. Thus there are positive
constants
such that
for all sufficiently large
. Niedzielski (2026) formalized
both bounds in Lean with AI assistance.
If the positive edges form a graph on the same vertices, the signed sum for
is
.
It measures the deviation of the edge count from its
expected value at density
, up to a factor of 2.