Adjacency list Created 2026-10-13 Updated 2026-10-20
An adjacency list represents a graph by keeping, for each vertex , a collection of the vertices reached by its outgoing edges. An array indexed by vertex identifiers can locate each collection; the collection itself may use a linked list or an array. In an undirected graph, each nonloop edge supplies an entry at both endpoints.[ref]
For a worked example, take the simple graph
where denotes the unordered pair . Its adjacency lists, displayed in label order, are
Thus has three neighbours, although the graph has six vertices. Its list contains exactly the destinations available for a single step from ; no slots are reserved there for . The fourteen neighbour entries represent seven edges, with appearing as in 's list and as in 's list. The label order makes the example easy to read; an adjacency list need not be sorted.
Figure 1.
Seven undirected edges and their fourteen adjacency list entries
. Details.
The useful idea is to store existing connections explicitly. Neighbour enumeration can then follow exactly the possible next steps, which is what breadth-first search and depth-first search need. In a sparse graph, most pairs of vertices have no edge; adjacency lists avoid reserving a separate adjacency matrix entry for every such absence. Whether this saves work depends on the question: neighbour enumeration and testing one proposed edge have different costs.
Birthday collision count 2026-10-14
The birthday collision count counts equal-label unordered pairs. Write it as a sum of indicator random variables:
This uses linearity of expectation; mutual independence of the pair indicators is unnecessary. For 23 uniform calendar labels, , whereas . A configuration with three equal labels contributes three pairs, so counting pairs and recording whether any pair exists are different random variables.
Treating every pair event as mutually independent would give the wrong exact formula. For three draws, and force . The probability that all three equalities hold is , while the product of their individual probabilities is for . This distinguishes independence of the original label draws from mutual independence of events built from overlapping draws.
Cut vertex Created 2026-10-06 Updated 2026-10-14
A cut vertex, also called an articulation point, is a vertex of an undirected graph whose deletion increases the number of connected components of a graph. Write for that count, including isolated vertices, and for the graph obtained by removing and every incident edge. Then the test is , even when the original graph is disconnected. By contrast, deleting a bridge in a graph removes just one edge and keeps both endpoint vertices. These are different failure models. [ref]
First take two triangles in a graph, and , sharing only the vertex . This simple graph has
Here abbreviates the unordered pair . Removing leaves the two connected components of a graph and , so . Removing any other vertex leaves a connected graph. Thus is the only cut vertex. Every edge lies on a triangle in a graph, so deleting any single edge still leaves a graph path between its endpoints along the other two edges. There are no bridges in a graph.
The generator computes the adjacency lists and checks every vertex deletion, giving the following complete table:
Deleted vertex Original graph neighbours of
Now take two disjoint triangles in a graph, and , joined by the edge :
Deleting only preserves all six vertices and leaves connected components of a graph and : is the only bridge in a graph. Deleting also removes and , leaving connected components of a graph and . Deleting instead leaves and . Thus are exactly the cut vertices.
Figure 2.
Edge deletion keeps its endpoints; cut vertex deletion removes all incident edges
. Details.
Again the adjacency lists and all vertex deletion counts are computed directly:
Deleted vertex Original graph neighbours of
For a disconnected example, adjoin an isolated vertex to the first graph. Now , deleting gives , and deleting gives . The original graph was already disconnected, but is still a cut vertex; is not. The empty graph has count zero, so deleting the only vertex of a one-vertex graph does not create a cut vertex. Nor is either endpoint of a single isolated edge a cut vertex, although that edge is a bridge in a graph.
In a communications network, a cut vertex models a router whose failure separates surviving routers. The shared- example shows why having an alternative graph path around each individual edge does not protect against failure of the common router. An additional edge from to removes this particular vulnerability: after deleting , still join the two sides. A bridge in a graph instead models a vulnerable link. This distinction tells us whether to add another cable between existing devices or a route avoiding an indispensable device; it describes connectivity, rather than traffic capacity or failure probabilities.
The beautiful structural consequence is that a graph splits into biconnected components joined at cut vertices. Within each nontrivial robust piece, a single vertex failure cannot separate the other vertices; between pieces, the shared cut vertices reveal the bottlenecks. Also, a Hamiltonian graph has no cut vertex: deleting any vertex from its Hamilton cycle leaves a Hamiltonian path through all remaining vertices.
Historically, Tarjan's June 1972 paper developed depth-first search as a tool for finding biconnected components in time linear in the numbers of vertices and edges. [ref] In his 1983 recollection, Tarjan credited Hopcroft with the original linear-time biconnected component algorithm during their collaboration beginning in summer 1970, and described the published version as a refinement. The historical lesson is how a carefully organized traversal turns many separate deletion experiments into one computation. [ref]
Place five labeled vertices around a pentagon. In the complete graph , color the five perimeter edges red and the five diagonals blue. Writing for the unordered pair , the red pairs are , and the blue pairs are . This assigns a color to every pair, including every diagonal.
The red subgraph is the cycle graph ; the blue subgraph is the cycle graph . Neither contains a triangle in a graph. Consequently, none of the ten triples has all three edges red or all three blue, proving the lower bound for the Ramsey number for triangles. Crossings in the drawing are not additional vertices.
Graph Created 2026-09-24 Updated 2026-10-18
Figure 1.
Two drawings of the same six-vertex graph and its adjacency matrix
. Details.
A graph describes objects, called vertices, and pairwise connections, called edges. Its vertex set tells us what the objects are; records their connections. The basic abstraction retains graph adjacency while discarding positions, angles and Euclidean distances: moving the dots in a drawing changes none of the edges. A crossing of two drawn lines is not an extra vertex unless explicitly designated as one. Even the labels can change: a graph isomorphism is a relabelling that preserves graph adjacency in both directions.[ref]
This makes graphs useful when the question concerns possible connections rather than physical shape. For example, model locations by vertices and direct links by edges; a graph path answers whether one location can reach another. Alternatively, let vertices be activities and edges represent conflicts: a graph coloring then assigns compatible time slots. These are mathematical models, so one must decide which pairwise relationship an edge means before applying graph theory.[ref]
Our running simple graph has
where abbreviates the unordered pair . It consists of two triangles in a graph, and , joined by . The two drawings above have identical graph adjacency, even though their apparent lengths differ. What counts is that and are adjacent, whereas and are not.
Route questions require precise vocabulary. A walk is a sequence of consecutive adjacent vertices, permitting repetitions; its length counts traversed edges. A trail is a walk that repeats no edge; a graph path repeats no vertex. For a multigraph, the walk must also specify which parallel edge each step uses. For instance, is a length-five walk but not a trail, since it uses twice. The length-three graph path is a shortest route: crossing between the two triangles in a graph requires , with at least one edge before it and one after it. Thus in graph distance, regardless of the drawing.[ref]
An Eulerian trail uses every edge exactly once, allowing repeated vertices; a Hamiltonian path visits every vertex exactly once, without needing every edge. Here is an Eulerian trail of length seven, whereas is a Hamiltonian path of length five. The first repeats ; the second omits . Calling an Eulerian trail an "Eulerian path" must not be taken to impose our graph path convention.[ref]
The classic historical example is Euler's Königsberg bridge problem: represent the four land regions by vertices and the seven bridges by distinct edges, giving a multigraph. Their degrees of vertices are . In a trail using every edge, arrivals and departures pair at every internal vertex, so at most the two endpoints can have odd vertex degree. Four odd degrees of vertices therefore rule out such a route. This early foundational example of graph theory needs neither bridge lengths nor a geographical map. Euler's paper is conventionally associated with 1736, the volume's nominal year; the Euler Archive records its writing in 1735 and publication in 1741.[ref][ref]
Independence here is a relative consistency assertion: from a ground first-order model satisfying ZFC, construct a first-order model of each remaining theory in which the omitted axiom fails. The ground axiom of choice is a tool for constructing these countermodels, not an extra axiom imposed on the theories being tested. The constructible universe supplies the usual relative-consistency implication from ZF to ZFC, so this ground choice assumption requires no additional consistency strength. These constructions can be formalized inside an arbitrary ground model; they do not require the stronger assumption that a transitive model exists.
Union. Put and use the hereditarily locally small membership model
The ground cardinal is a strong limit cardinal of countable cofinality. This transitive class contains the empty set and . Pairing preserves the bound, as does taking a subset, so separation holds for every formula relativized to this class. If an internally definable function has domain , ground replacement collects its range . Since and every descendant of an element of already has fewer than members, . Thus the full functional Axiom schema of replacement holds. For , every actual subset of belongs to the class and
Consequently its entire power set belongs to the class. Extensionality and foundation are inherited from the ground membership relation; witnesses infinity. However belongs to , while its only possible union is , which does not. All the other ZF axioms hold, and union fails. Bounding the entire transitive closure by instead would give the wrong model: functional ranges at this singular bound need not be hereditarily small.
Power set. Use the transitive class of hereditarily countable sets. Pairing, union and separation preserve hereditary countability. A functional image of a countable domain is countable, and its members have countable transitive closures; their countable union is countable in the ground ZFC model. This proves replacement. The remaining structural axioms and infinity are inherited. Every actual subset of belongs to , but a putative internal power set of would contain all these subsets and hence be uncountable by Cantor's theorem. Power set fails in , with every other ZF axiom intact.
Replacement. Use in the cumulative hierarchy. At a limit ordinal cutoff, pairing, union, power set and every instance of separation remain below the cutoff; foundation, extensionality and infinity hold as well. With parameter , define by finite iterations of power set. The finite iteration witnesses and each value are inside , so this is an internally definable total function on . Its range has rank of a set and is absent from the model. This instance of replacement fails.
Extensionality. Build well-founded coded sets over one urelement , retaining a distinct ordinary empty set . Membership of an atom is always false, and membership of a set code is its coded extension. Thus but they have identical empty extensions. Pairing, union, separation and replacement are performed on set codes; pure witnesses infinity, and the well-founded construction gives foundation. There is a small point concerning the unmodified, untyped Axiom of power set: the atom is vacuously a subset of every object. Therefore the internal power-set object for contains all ordinary set-subsets of and the atom. It has exactly the required extension. All remaining ZF axioms hold, but extensionality fails. In the usual typed atom theory, the power-set axiom instead quantifies only over set-subsets.
Foundation. In the ground universe let exchange and and fix all other objects. On the same domain define the Rieger-Bernays permutation model
Since is a bijection, two objects with the same -members are equal, so extensionality holds. Any ground collection of desired members is represented by the object . In particular, an -pair is and the -union of is
An -subset of is an object with , so its -power-set object is
Translate every formula by replacing membership with ; ground separation and replacement collect the required extensions and the same representation supplies their internal witnesses. The -empty object is , and its -successor operation is . Ground well-founded recursion and replacement collect the iterates of from ; representing this collection gives an -inductive object. Thus infinity holds. But for , , whence and has precisely itself as its -member. Foundation fails.
Infinity. The hereditarily finite sets satisfy extensionality, foundation, pairing, union, power set and separation. Each internal domain is externally finite, so every internally definable functional image is finite and belongs to , proving replacement. No finite object can contain the empty set and all its successive Finite von Neumann ordinals. Infinity fails, and all other ZF axioms hold.
Choice with atoms. For the negative model use the Basic Fraenkel permutation model. Let be an infinite set of urelements and let every permutation of act recursively on sets. Keep precisely the hereditarily finitely supported objects: an object has a finite support if every permutation fixing pointwise fixes the object, and every object occurring in its membership ancestry must also have such a support. The class of these objects contains the pure universe and itself.
Supports for a pair are united; union preserves a support; a formula defining a subset uses the finite union of the supports of its domain and parameters. An internally definable functional range has the same support, since its values are uniquely specified, and its elements are already hereditarily supported. This proves the full separation and replacement schemas. All hereditarily supported set-subsets of a fixed set form its symmetric internal power set; this collection is invariant under the pointwise stabilizer of a support of the original set. For the untyped version add all the atoms, as above. Pure , ground well-foundedness and set-extensionality give the remaining axioms.
The family of unordered pairs of atoms is hereditarily supported. If it had a choice function , let be a finite support of . Choose distinct . The transposition exchanging fixes and , but exchanges its two possible chosen elements. Invariance of would imply is fixed by that transposition, a contradiction. Conversely, the full well-founded universe over the atoms, before restricting to finite supports, satisfies choice when the ground universe does. Both choice and its negation are relatively consistent with the stated weakening of extensionality.
We use the random alteration method, controlling large hypergraph independent sets and then removing the few forbidden overlaps. Fix , let tend to infinity, and independently include each three-element subset of an -vertex set as an hypergraph edge with probability . Call the resulting three-uniform hypergraph , and let .
For any prescribed -vertex set, the probability that it is a hypergraph independent set is . Hence the union bound gives
because has order , with a positive constant depending only on .
Let count unordered pairs of distinct hypergraph edges meeting in two vertices. Each potential pair consists of its common pair and two distinct additional vertices, so
The Markov inequality implies . We may therefore fix one realization for which and no -vertex hypergraph independent set exists. For each offending hypergraph edge pair choose one vertex from its union, and let be the set of all chosen vertices. Delete , together with all incident hypergraph edges, and call the induced hypergraph . Then , so . The next two parts verify both desired properties of this same .
If contains no , every pair of vertices has at most two common neighbours. Double-counting a vertex together with an unordered pair of its neighbours gives
Consequently
By Cauchy--Schwarz,
This quadratic inequality implies for an absolute constant ; for example works for every . Thus
Ramsey number 2026-10-14
For positive integers , the Ramsey number is the least integer such that every red-blue edge coloring of the complete graph contains either a red clique on vertices or a blue clique on vertices. The complete graph has all unordered pairs as edges; every edge gets exactly one color, with no requirement that incident edges have different colors. The definition and its graph interpretation appear in D. Yogeshwaran's Discrete Mathematics notes, section 5.3.
For example, asks how many vertices force a monochromatic triangle in a graph. Swapping colors gives . Also : either a red edge exists, or all edges are blue. On vertices, an all-blue coloring avoids both a red edge and a blue -clique. Under the convention that a one-vertex clique qualifies in either color, .
For , splitting the neighbors of one vertex by the colors of their incident edges gives
Indeed, in a complete graph of the order on the right, at least neighbors are joined to that vertex by red edges, or at least are joined by blue edges. In the red case, the defining property of the smaller Ramsey number supplies either a blue -clique among the neighbors or a red -clique that extends by the chosen vertex; the blue case is symmetric. Starting from the one-vertex base cases, this recursively proves finite existence. The binomial upper bound for a Ramsey number packages the resulting estimate. [ref] present the neighbor argument and the sharp Ramsey number for triangles.
Equivalently, every graph on at least vertices has an -clique or a -element independent set: color its edges red and the edges of its complement graph blue. This is the Ramsey theorem in graph theory. Larger monochromatic patterns have their own thresholds, such as a graph Ramsey number, matching Ramsey number or triangle-packing Ramsey number; these ask different questions from finding one clique.
Ramsey number for triangles Created 2026-10-14 Updated 2026-10-31
Every red-blue edge coloring of the complete graph contains a monochromatic triangle in a graph, and some coloring of contains none. Together the five-cycle Ramsey coloring and six-vertex monochromatic triangle argument give
The threshold is exact: one carefully chosen coloring establishes the lower bound, while the upper bound must handle every coloring.
A familiar interpretation uses six people and colors each pair red if they know one another and blue if they do not. Assuming the relation is symmetric and every pair falls into exactly one case, there are either three mutual acquaintances or three mutual strangers. The conclusion concerns all three pairs within the group, not merely two relationships through a common person. There is no prediction about which color wins or which three people form the group.
The small size makes exhaustive verification practical. The complete graph has edges, giving red-blue colorings of labeled vertices; exactly 12 have no monochromatic triangle in a graph. They are the choices of a red cycle graph of length five, whose blue complement graph is another five-cycle. The complete graph has edges, giving colorings. Checking all triples in every coloring finds none without a monochromatic triangle in a graph; in fact the minimum number is two. These counts can be reproduced by assigning one bit to each unordered pair and testing whether the three bits of each triple agree. The monochromatic-triangle counting formula gives a separate explanation of the stronger minimum-two conclusion.
Ramsey theory Created 2026-09-24 Updated 2026-10-13
Ramsey theory studies configurations that every finite coloring of a sufficiently large structure must contain. Its striking message is that some order is unavoidable even when no organized construction was used. A basic example is the Ramsey number for triangles: color every edge of a complete graph on six vertices red or blue, in any way, and some triangle in a graph has all three edges the same color. Five vertices do not suffice.
The objects receiving colors matter. In the Ramsey number for triangles, colors belong to edges, which represent all unordered pairs of distinct vertices; the vertices themselves have no colors. In the finite Ramsey theorem, colors can instead belong to all -element subsets of a finite set. A monochromatic set or homogeneous set for a colouring expresses agreement among the appropriate colored objects.
Why is this useful? Ramsey theory provides existence guarantees in combinatorics that survive every possible assignment of a fixed finite number of colors. The Ramsey theorem turns this into a structural dichotomy: every sufficiently large graph contains a large clique or a large independent set. In arithmetic, the Van der Waerden theorem guarantees monochromatic arithmetic progressions. The beauty is the universal quantifier: an adversary can choose every color and still cannot prevent the promised configuration.
These guarantees concern precisely specified configurations under stated hypotheses. They do not justify selecting arbitrary patterns in empirical data after seeing the data, or attributing statistical significance to a selected pattern. A mathematical guarantee of some monochromatic configuration alone says nothing about the empirical meaning of that configuration.
The subject's name comes from F. P. Ramsey's [ref]. The [ref] records receipt on 28 November 1928 and presentation on 13 December 1928. Ramsey introduced the Ramsey theorem for r-sets and finite Ramsey theorem as tools for a problem in mathematical logic, while recognizing their independent interest in combinatorics. He also distinguished proving that a finite threshold exists from finding its smallest value, the quantitative question captured by a Ramsey number.
Simple graph 2026-10-14
An undirected simple graph is exactly a pair of sets
Thus every edge is a two-element set of distinct vertices. The unordered pair equals , so there is no direction. The distinctness condition excludes self-loops, and using a set of edges excludes parallel copies. A simple graph may have vertices with no incident edges; does not by itself determine . For example, and have the same edge set but different vertex sets.[ref]
In the six-vertex example, the vertex neighbourhood of is , so its degree of a vertex is . In label order , the degree sequence is
This is the handshaking lemma: count each edge once at each of its two endpoints. The average degree of a graph here is . The degree sequence is a compact consistency check on an edge list; an odd sum could not describe any finite undirected graph. It also forces the number of odd degrees of vertices to be even, since the even terms do not affect the parity of the sum.
The adjacency matrix in the figure uses label order . Its entry is one exactly when , and zero otherwise. It is a symmetric matrix with zero diagonal, and each row sum gives the corresponding vertex degree. For example, row is . The fourteen ones count both directions of the seven undirected edges; they do not indicate fourteen different edges. This translates a picture into a representation suitable for calculation.
The restrictions matter. A directed graph uses an ordered pair to distinguish from , so reachability can depend on direction. A multigraph can contain several distinct edges between the same vertices; adding another would raise and to four without adding a new neighbour. A self-loop at contributes two to its undirected vertex degree, making it four, because both endpoints lie at . Specify whether self-loops are allowed in a multigraph. Finally, a weighted graph attaches numerical information to edges: if links carry travel times, minimizing the number of edges need not minimize total time. These are changes to the model, rather than changes to how the same simple graph is drawn.
For distinct objects, the number of unordered pairs of different objects is
Ordering the objects gives pairs with the first object, new pairs with the second, and so on down to one. Alternatively, ordered pairs count every unordered pair twice. The binomial coefficient therefore counts the edges of a complete graph on vertices. This is also consistent with the handshaking lemma: each vertex has degree of a vertex , and the degree sum counts every edge twice.
Walk in a graph Created 2026-10-06 Updated 2026-10-14
A walk records a journey through a graph as a finite alternating sequence
where each edge joins the consecutive vertices and . Both vertices and edges may repeat. Its length is , counting edge traversals with repetitions, rather than counting different edges or measuring the drawing. Here a graph path means a walk with no repeated vertices; a trail instead forbids repeated edges. These conventions distinguish a journey's record from the subgraph consisting of the connections it used.[ref]
Unless stated otherwise, the examples below use a finite simple graph that is an undirected graph, so an edge may be traversed in either direction. In a multigraph, retain each edge's individual identity as well as its endpoint vertices: two parallel edges are different choices for the same step. If self-loops are allowed, traversing one leaves the current vertex unchanged but adds one to the length. In a directed graph, each step must follow its directed edge from its initial to its terminal vertex, giving a directed walk; reversing a journey need not be possible.[ref]
We allow the zero-length walk at every vertex . It uses no edges, so it is also a trail and a graph path, and its coinciding endpoints make it a closed walk. This means staying put is a legitimate journey; a graph with no vertices has no such walk. Positive-length restrictions will be stated explicitly.[ref]
Use the same constructed graph throughout these three sections:
Here denotes the unordered pair , and . Two triangles in a graph, and , share , with one extra edge . These are schematic connections, not measured roads; the highlighted connections in the diagram show which edges are used, while the numbered sequence records their order.
Figure 1.
One constructed graph: repeated edges in a walk, repeated vertices in a trail, and a graph path
. Details.
The length-six walk uses and twice, so it is not a trail. The length-six trail returns to but uses six different edges, so it is not a graph path. The length-three graph path repeats neither vertices nor edges. Thus
for this particular graph. The restrictions answer different routing questions: revisiting a junction is harmless for many journeys, whereas reusing a serviced road segment can matter for an inspection route. Travel costs require a weighted graph; a walk's cost adds the weight of each traversal, even when an edge is used again.
Every finite walk from to contains a graph path from to after deleting detours. For a proof outline, if with , delete the intervening closed walk. The retained steps still meet at the same vertex, and the length strictly decreases. Repeating terminates with no repeated vertices, or with the zero-length graph path when . This explains why reachability can be formulated using either walks or graph paths. With nonnegative edge weights, deletion also cannot increase cost, connecting the argument to the shortest path problem; with negative weights that cost conclusion fails.[ref]