WOLFRAM

VertexCoverQ[g,vlist]

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 all

Basic Examples  (2)Summary of the most common use cases

Test whether a set of vertices is a vertex cover in a graph:

Out[1]=1

Not all set of vertices are vertex covers in a graph:

Out[1]=1

Scope  (6)Survey of the scope of standard use cases

Test undirected graphs:

Out[1]=1

Directed graphs:

Out[1]=1

Multigraphs:

Out[1]=1

Mixed graphs:

Out[1]=1

VertexCoverQ gives False for expressions that are not graphs:

Out[1]=1

VertexCoverQ works with large graphs:

Out[2]=2

Applications  (2)Sample problems that can be solved with this function

Enumerate all vertex covers for a cycle graph:

Out[1]=1

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

Out[2]=2
Out[3]=3

Highlight covers:

Out[4]=4

Enumerate all minimum vertex covers for a Petersen graph:

Out[1]=1

Find the size of a minimum vertex cover:

Out[2]=2
Out[3]=3

Enumerate all minimum vertex covers:

Out[4]=4

Highlight minimum covers:

Out[5]=5

Properties & Relations  (7)Properties of the function, and connections to other functions

The VertexList of a graph is a vertex (typically non-minimal) cover:

Out[1]=1
Out[2]=2

A smallest vertex cover can be found using FindVertexCover:

Out[1]=1
Out[2]=2

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

Out[1]=1
Out[2]=2

Check that the complement set of vertices is independent:

Out[3]=3

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

Out[1]=1
Out[2]=2

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

Out[1]=1

Compute the complement using the same embedding:

Out[2]=2
Out[3]=3

Its complement is a clique:

Out[4]=4
Out[5]=5
Out[6]=6

The complete bipartite graph has a vertex cover of size :

Out[1]=1
Out[2]=2

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

Out[1]=1
Out[2]=2
Out[3]=3
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).

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 ]}

@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 ]}

@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 ]}