3-SAT reduction to vertex cover Created 2026-10-07 Updated 2026-10-14
A polynomial-time many-one reduction represents each variable by an adjacent literal pair and each clause by a triangle in a graph. Connect each occurrence vertex to its corresponding literal vertex. A vertex cover of size must choose one literal vertex per variable and two vertices per clause, and its omitted clause vertex forces a true literal. Conversely a satisfying Boolean valuation supplies such a cover. This establishes NP-hardness of the vertex-cover decision problem from 3-SAT.
Bipartite vertex cover Created 2026-09-24 Updated 2026-10-14
König's theorem equates the minimum vertex-cover size of a bipartite graph with its maximum matching size.
A bipartite vertex cover is a vertex cover restricted to a bipartite graph; Kőnig's theorem for bipartite matching computes its minimum size.
Connected vertex cover 2026-10-31
A vertex cover whose induced subgraph is connected. The optimization problem minimizes subject to both conditions. A graph with edges in two distinct connected components of a graph has no connected vertex cover: covering each of these edges requires selected vertices in different components. Isolated vertices can be ignored when exactly one component contains all the edges. The edge-free case depends on whether the empty solution is admitted.
For a nontrivial connected graph, return the internal vertices of a rooted tree in a depth-first search tree. Undirected depth-first search has only ancestor-descendant edges, so every edge meets an internal vertex; the internal vertices are connected along parent paths. For a maximum-size proper matching in a rooted tree of that tree, existence of which is assumed, . Every vertex cover has size at least , proving the factor two. The implementation needs only depth-first search, hence linear time complexity; it does not compute the analysis matching in a graph.
Dominating set 2026-10-24
Independence number Created 2026-10-03 Updated 2026-10-14
The independence number is the largest cardinality of an independent set in a finite simple graph:It answers "how many mutually compatible objects can be selected at once?", while the chromatic number asks how many compatible groups are needed for all the vertices. Diestel uses this notation for a largest independent set.[ref]
For the cycle graph , the independent set shows that . Three selected vertices would require at least three unselected vertices separating them around the cycle graph, which has only five vertices. Thus . There are five largest independent sets, obtained by rotating around the cycle graph, and five corresponding minimum vertex covers.
For the complete bipartite graph , an independent set cannot contain a vertex from each side, since every such pair is joined by an edge. The larger side has three vertices, so . A triangle in a graph has independence number one. A graph with no edges and vertices has independence number , including when .
The complement correspondence between vertex covers and independent sets gives, with ,Every extra vertex that can be left in an independent set is one fewer vertex needed in a minimum vertex cover. This identity holds for all finite simple graphs, including the triangle in a graph and the cycle graph ; it does not require the bipartite graph hypothesis of Kőnig's theorem for bipartite matching.
For a nonempty graph, every colour class of a proper vertex colouring contains at most vertices. Counting all the vertices therefore givesSince the chromatic number is an integer, the bound rounds up: for the cycle graph , . It is attained by assigning colour to , colour to , and colour to . All five edges, including , have differently coloured endpoints.
Independent set (graph theory) Created 2026-10-14 Updated 2026-10-18
An independent set selects mutually compatible objects when an edge of a graph represents a conflict. For example, if vertices are activities and edges join activities that cannot occur together, an independent set is a collection that can share one time slot. Finding the largest such collection is measured by the independence number.[ref]
https://introtcs.org/public/lec_12_NP.html. Barak, Introduction to Theoretical Computer Science, Chapter 14, The independent set problem
In a finite simple graph , an independent set is a subset with no edge joining two selected vertices:The empty set and every singleton set are independent sets. In the cycle graph drawn under vertex cover, is an independent set, but is not: the closing edge joins those two vertices. Choosing nonconsecutive labels is insufficient unless the wraparound edge is checked.
An independent set of maximum size has cardinality equal to the independence number. Being unable to add another vertex only makes an independent set inclusion-maximal. In the star graph , the centre alone is inclusion-maximal, since it is adjacent to every leaf, but the three leaves form a larger independent set. This distinction mirrors the difference between an inclusion-minimal vertex cover and a minimum vertex cover.
Every independent set has a vertex cover as its complement of a set; a largest independent set has a minimum vertex cover as its complement. In every proper vertex colouring, each colour class is an independent set, so graph coloring partitions the vertices into mutually compatible groups.
Independent vertex cover 2026-10-25
An independent vertex cover is a vertex cover that is also an independent set. Its complement is an independent set as well, since the cover condition forbids edges entirely in that complement. Thus such a cover is a side of a bipartition of the graph. This standard definition is stronger than independent dominating set on graphs without isolated vertices, and remains a different notion when isolated vertices are present. In a nonempty simple graph, two possibly repeated witnesses with and no edge outside express existence of an independent vertex cover of size at most two.
Maximal matching Created 2026-09-24 Updated 2026-10-14
A maximal matching is a matching in a graph to which no extra edge can be added while retaining all current selected edges. Equivalently, no edge joins two unmatched vertices in a matching; those vertices form an independent set. Every maximum cardinality matching is a maximal matching, but the converse fails.
Take the path graph with vertices and edges . A greedy algorithm that first selects the middle edge produces . Both remaining edges touch a matched vertex, so this size-one matching in a graph is maximal. Yet has two edges. No matching in a graph on four vertices has more than two edges, so is a maximum cardinality matching. The two remaining free vertices of , namely and , are not adjacent; that does not prevent a longer augmenting path in a matching from joining them.
Choosing the middle edge of P₄ gives a maximal matching of size one; the outer edges give a maximum cardinality matching of size two
. Details. Maximality is useful as a quick stopping rule and a modest guarantee. For any maximal matching and maximum cardinality matching in a finite simple graph, every edge of touches an endpoint of an edge of . Assign it to one such edge of . Since has disjoint endpoints, each edge of receives at most two assignments, proving . The P₄ example reaches equality. Thus maximality guarantees at least half the largest cardinality, but says nothing comparable about arbitrary edge benefits. Its selected endpoints also form a vertex cover, as explained under vertex cover.
Minimum vertex cover Created 2026-10-14 Updated 2026-10-25
A minimum vertex cover is a vertex cover of smallest cardinality among all vertex covers of the same finite simple graph. The optimum size is the vertex cover number. By the complement of a set correspondence, a minimum vertex cover leaves a largest possible independent set unselected.
Minimum size is stronger than merely being unable to remove a selected vertex. In the star graph , the three leaves form a vertex cover from which no vertex can be removed: each leaf covers its own edge. Nevertheless, the centre alone is a minimum vertex cover of size one. Such an inclusion-minimal vertex cover can therefore be much larger than a minimum vertex cover.
Minimum vertex cover of a tree 2026-10-31
Root a finite tree, and let be the optimum vertex cover sizes of a descendant subtree conditional on excluding or including its root. Excluding a parent forces all children to be included; including it permits either child state. These facts prove the displayed recurrences by structural induction. Empty child sums give at a leaf of a rooted tree. Evaluating in postorder traversal and taking the smaller root state gives a linear-time dynamic programming algorithm.
A vertex cover of an undirected graph is a subset containing at least one endpoint of every edge. The optimization version of the vertex cover problem minimizes ; the vertex cover decision problem asks whether a cover of size at most a given bound exists.
Let mean that vertex is selected. An integer program for minimum-size vertex cover isThe linear programming relaxation replaces by . The edge inequalities enforce coverage, and the objective function counts selected vertices in the integer program.
For a graph triangle with vertices , the three covering constraints areAdding them gives . Therefore the relaxed objective function is at least . The feasible solution attains that lower bound, soIn contrast, one vertex leaves the opposite edge uncovered and any two vertices cover all three edges, giving integer optimum . The example exhibits a genuinely non-integer optimal value, rather than merely a fractional feasible solution.
Past exam of the computer science course of the University of Oxford 2018 Algorithms 2 a Solution 2026-10-31
For a finite undirected graph , a vertex cover is a subset meeting every edge: for every , at least one of belongs to . The optimization problem asks for a vertex cover of minimum cardinality. Its usual decision version also supplies an integer and asks whether one exists with .
Past exam of the computer science course of the University of Oxford 2018 Algorithms 2 b Solution 2026-10-31
Construct a set cover problem instance whose universe is the set of edges . For each vertex , supply the set of all edges incident to . A collection covers the universe if and only if every edge has an endpoint in , which is precisely the vertex cover condition.
The correspondence preserves cardinality: a vertex cover of size is a feasible solution of the set cover problem using of these sets, and conversely. If two labelled vertices produce identical sets, one can keep their labels or discard duplicate choices without changing the optimum. The construction has size when incidences are listed, so it is a polynomial-time reduction.
Past exam of the computer science course of the University of Oxford 2018 Algorithms 2 c Solution 2026-10-31
Root the tree arbitrarily. For each vertex , let be the minimum vertex cover size in its descendant subtree, conditional on selecting , and the corresponding minimum conditional on omitting . Process the vertices in postorder traversal. For every child of ,At a leaf of a rooted tree, the empty sums give . Return at the root .
For algorithm correctness, if is selected, each child subtree may independently use its cheaper state, since the connecting edge is already covered by . If is omitted, each child must be selected to cover its connecting edge. Distinct child subtrees have no edges between them because the input is a tree. These observations prove the recurrences by structural induction. Each edge contributes constant work once, giving time complexity and space with adjacency lists. The single-vertex tree correctly has optimum zero. This is minimum vertex cover of a tree by dynamic programming.
Past exam of the computer science course of the University of Oxford 2018 Algorithms 2 d Solution 2026-10-31
In depth-first search of an undirected graph, every edge joins a vertex to one of its ancestors or descendants in the discovery tree. To see this directly, suppose is discovered before its neighbour . If is still undiscovered, the search from cannot finish before discovering : it eventually scans . Thus is discovered while the call for remains active and belongs to its descendant subtree.[ref]
Depth-first search by Jeff Erickson. Chapter 6, §6.1: active recursion intervals, tree/back edges and ancestor relations
For any edge , its ancestor endpoint therefore has a proper descendant and hence at least one child. It is an internal vertex of a rooted tree. Every edge has an internal endpoint, so the internal vertices form a vertex cover. The relevant leaves of a rooted tree here have no children in the rooted discovery tree; a root of vertex degree one can still be internal.
Past exam of the computer science course of the University of Oxford 2018 Algorithms 2 f Solution 2026-10-31
For a connected graph with at least one edge, run depth-first search and output the set of internal vertices of a rooted tree in its discovery tree . Part (d) proves that is a vertex cover. It is also connected: every ancestor of an internal vertex is internal, so the graph path in from that vertex to the root stays inside . The root is internal when .
For the approximation guarantee, choose a maximum-size proper matching in a rooted tree of , whose existence is supplied. It is used only in the analysis; the algorithm need not construct it. Since every matched edge uses two distinct vertices,By part (e), . ThereforeThe final inequality holds because every vertex cover of , connected or otherwise, must use at least one distinct endpoint for each of the disjoint edges in . Thus this is a 2-approximation algorithm in time complexity.
For completeness, a disconnected input needs a feasibility check: if two different connected components of a graph contain edges, no connected vertex cover can meet both. If exactly one component contains edges, run the construction on that component and ignore isolated vertices. If there are no edges, the empty vertex cover is optimal when an empty solution is permitted; if a nonempty connected solution is required, any single vertex is optimal for a nonempty input. These conventions cover the boundary cases omitted from the main approximation argument.
Past exam of the computer science course of the University of Oxford 2019 Algorithms 3 b Solution 2026-10-25
The vertex cover decision problem takes a finite simple graph and a nonnegative integer , and asks whether there is a vertex cover of cardinality at most . The optimization problem asks for a minimum vertex cover, with cost equal to its cardinality.
For the decision problem, if there are no edges, accept; if there is an edge but , reject. Otherwise choose an edge and branch: either include and recurse on with budget , or include and recurse on with budget . Accept if either branch accepts. Every vertex cover contains at least one endpoint of , so every possible solution is retained by at least one branch. Conversely, adding the selected endpoint to a vertex cover returned by the smaller instance covers all original edges. This proves correctness by induction on the remaining budget.
The search tree has depth at most and at most leaves. Processing each node in time gives running time, establishing fixed-parameter tractability.
For optimization, greedily build a maximal matching : repeatedly select an edge and discard every edge touching either endpoint. Return the set of all endpoints of . Any edge with neither endpoint in could be added to , contradicting maximality; thus is a vertex cover. Since the edges of a matching in a graph have pairwise disjoint endpoint sets, every vertex cover must contain at least one different vertex for each of them. ThereforeThe greedy construction takes polynomial time, and can be implemented in with adjacency lists. It needs only a maximal matching, not a maximum matching.
Hall's marriage theorem says that a bipartite graph with parts has a matching saturating if and only ifNecessity follows because the matched neighbours of vertices of are distinct and belong to .
For sufficiency, assume these inequalities. Let be any vertex cover, with and . Every neighbour of must belong to , since otherwise its edge from is uncovered. Therefore , and . The whole part is itself a vertex cover of size . Part (ii) now gives a matching of size exactly , so it saturates .
Let the bipartition be . Form an auxiliary graph by adding a new vertex adjacent to every vertex of and a new vertex adjacent to every vertex of . The vertices are nonadjacent, so Menger's theorem applies.
A matching of size gives internally disjoint graph paths , one for each matching edge . Conversely, every - graph path must use an edge of the original bipartite graph. Choose one such edge from each member of an internally disjoint family. Their endpoints are all distinct, so the chosen edges form a matching. Thus the maximum number of those graph paths is the maximum matching size.
An - separator contained in is exactly a vertex cover of the original graph. Indeed, an uncovered edge would leave the graph path , while removing a vertex cover removes every edge between and and hence every - graph path. The minimum separator size is therefore the minimum vertex cover size. Menger givesThis is Kőnig's theorem for bipartite matching. The auxiliary construction gives the required deduction from vertex-disjoint paths rather than assuming a matching theorem in advance.
