VertexCoverQ
✖
VertexCoverQ
yields True if the vertex list vlist is a vertex cover of the graph g, and False otherwise.
Details

- A vertex cover is a set of vertices that are incident to every edge.
- VertexCoverQ works with undirected graphs, directed graphs, multigraphs, and mixed graphs.

Background & Context
- VertexCoverQ tests if a specified set of vertices forms a vertex cover for a given graph, where a vertex cover is a set of vertices satisfying the condition that each edge of the graph is incident to some vertex in the set. VertexCoverQ returns True if the set is a vertex cover and False otherwise.
- The entire vertex set of a graph is always a vertex cover (of maximum possible size). The smallest possible vertex cover for a given graph is known as a minimum vertex cover, and its size is known as the vertex cover number.
- Vertex covers are closely related to independent vertex sets (which are sets of vertices having the property that no two vertices are part of the same edge). In particular, a set of vertices is a vertex cover if and only if its complement forms an independent vertex set. As a result, the counts of vertex covers and independent vertex sets in a graph are the same.
- FindVertexCover can be used to find a single minimum vertex cover or a single vertex cover of any fixed size, but not all vertex covers. A trivial implementation for finding all vertex covers of a graph can be constructed by applying VertexCoverQ to all subsets of a graph's vertices. EdgeCoverQ performs the analogous test to VertexCoverQ for edge covers of a graph. FindIndependentVertexSet can be used to find one or more maximal independent vertex sets in a graph (each of whose complements is a vertex cover).
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Scope (6)Survey of the scope of standard use cases

https://wolfram.com/xid/0dc3e0saikzn-c4jban


https://wolfram.com/xid/0dc3e0saikzn-d92a8t


https://wolfram.com/xid/0dc3e0saikzn-15kl6n


https://wolfram.com/xid/0dc3e0saikzn-czvddh

VertexCoverQ gives False for expressions that are not graphs:

https://wolfram.com/xid/0dc3e0saikzn-3l2bwe

VertexCoverQ works with large graphs:

https://wolfram.com/xid/0dc3e0saikzn-hlltv6

https://wolfram.com/xid/0dc3e0saikzn-hrht0p

Applications (2)Sample problems that can be solved with this function
Enumerate all vertex covers for a cycle graph:

https://wolfram.com/xid/0dc3e0saikzn-k7ld2c

Enumerate all subsets of vertices and select the ones that are covers:

https://wolfram.com/xid/0dc3e0saikzn-hyw7qp


https://wolfram.com/xid/0dc3e0saikzn-htjso


https://wolfram.com/xid/0dc3e0saikzn-b9l00i

Enumerate all minimum vertex covers for a Petersen graph:

https://wolfram.com/xid/0dc3e0saikzn-hiv33l

Find the size of a minimum vertex cover:

https://wolfram.com/xid/0dc3e0saikzn-zjd84


https://wolfram.com/xid/0dc3e0saikzn-mqn8zl

Enumerate all minimum vertex covers:

https://wolfram.com/xid/0dc3e0saikzn-c7l5n7


https://wolfram.com/xid/0dc3e0saikzn-nuwksv

Properties & Relations (7)Properties of the function, and connections to other functions
The VertexList of a graph is a vertex (typically non-minimal) cover:

https://wolfram.com/xid/0dc3e0saikzn-cou4t4


https://wolfram.com/xid/0dc3e0saikzn-jhwg5r

A smallest vertex cover can be found using FindVertexCover:

https://wolfram.com/xid/0dc3e0saikzn-fds0n0


https://wolfram.com/xid/0dc3e0saikzn-habyrc

A set of vertices is a vertex cover iff its complement is an independent set:

https://wolfram.com/xid/0dc3e0saikzn-8asoh


https://wolfram.com/xid/0dc3e0saikzn-cj29j9

Check that the complement set of vertices is independent:

https://wolfram.com/xid/0dc3e0saikzn-jg28gl

The total size of the vertex cover and the largest independent set equals the vertex count:

https://wolfram.com/xid/0dc3e0saikzn-dme9ws


https://wolfram.com/xid/0dc3e0saikzn-grp108

The complement of the vertex cover in GraphComplement is a clique in its original graph:

https://wolfram.com/xid/0dc3e0saikzn-d0kb5r

Compute the complement using the same embedding:

https://wolfram.com/xid/0dc3e0saikzn-eblt1f


https://wolfram.com/xid/0dc3e0saikzn-d1c34


https://wolfram.com/xid/0dc3e0saikzn-ed5oub


https://wolfram.com/xid/0dc3e0saikzn-qfwrfz


https://wolfram.com/xid/0dc3e0saikzn-fbxu48

The complete bipartite graph has a vertex cover of size
:

https://wolfram.com/xid/0dc3e0saikzn-ex4zx8


https://wolfram.com/xid/0dc3e0saikzn-idoe5c

The largest independent edge set in a bipartite graph has the same size as the smallest vertex cover:

https://wolfram.com/xid/0dc3e0saikzn-ecgbva


https://wolfram.com/xid/0dc3e0saikzn-bicsi8


https://wolfram.com/xid/0dc3e0saikzn-hcbva

Wolfram Research (2010), VertexCoverQ, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexCoverQ.html (updated 2014).
Text
Wolfram Research (2010), VertexCoverQ, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexCoverQ.html (updated 2014).
Wolfram Research (2010), VertexCoverQ, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexCoverQ.html (updated 2014).
CMS
Wolfram Language. 2010. "VertexCoverQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/VertexCoverQ.html.
Wolfram Language. 2010. "VertexCoverQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/VertexCoverQ.html.
APA
Wolfram Language. (2010). VertexCoverQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VertexCoverQ.html
Wolfram Language. (2010). VertexCoverQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VertexCoverQ.html
BibTeX
@misc{reference.wolfram_2025_vertexcoverq, author="Wolfram Research", title="{VertexCoverQ}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/VertexCoverQ.html}", note=[Accessed: 26-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_vertexcoverq, organization={Wolfram Research}, title={VertexCoverQ}, year={2014}, url={https://reference.wolfram.com/language/ref/VertexCoverQ.html}, note=[Accessed: 26-April-2025
]}