# Vertex Cover

## 1. Introduction

A Vertex Cover (VC) of a connected undirected (un)weighted graph G is a subset of vertices V of G such that for every edge in G, at least one of its endpoints is in V. A Minimum Vertex Cover (MVC) (Minimum Weight Vertex Cover (MWVC) for the weighted variant) of G is a VC that has the smallest cardinality (if unweighted) or total weight (if weighted) among all possible VCs. A graph can have multiple VC but the cardinality/total weight of its MVC/MWVC is unique.

There is another problem called Maximum Independent Set (MIS) that attempts to find the largest subset of vertices in a (un)weighted graph G without any adjacent vertices in the subset. Interestingly, the complement of an MVC of a graph is an MIS.

At the end of every visualization, when an algorithm highlights an MVC solution to a graph, it will also highlight its MIS (which is its complement) with light blue color.

### 1-1. Two Modes

There are two available modes: Unweighted (default) and Weighted. You can switch between the two modes by clicking the respective tab.

There are algorithms that work in both modes and there are algorithms that only work in a certain mode.

## 2. Visualization

View the visualisation of the selected MVC algorithms here.

Originally, all vertices and edges in the input graph are colored with the standard black outline. As the visualization goes on, the color light blue will be used to denote covered edges and the color orange on edge will be used to show traversed edges.

At the end of the selected MVC algorithm, if it finds a minimum VC, it will highlight the MVC vertices with orange color and the non MVC vertices (a.k.a. the MIS vertices) with lightblue color. Otherwise, if the found vertex cover is not proven to be the minimal one (e.g. the algorithm used is an approximation algorithm), it will highlight the vertices that belong to the found vertex cover with orange color without highlighting the MIS vertices.

## 3. Input

There are two different sources for specifying an input graph:

1. Draw Graph: You can draw any connected (un)directed weighted graph as the input graph.
2. Example Graphs: You can select from the list of example connected undirected weighted graphs to get you started.

## 4. Bruteforce

Bruteforce: It tries all possible 2^V subsets of vertices. In every iteration, it checks whether the currently selected subset of vertices is a valid vertex cover by iterating over all E edges and checking whether there is any edge that is not covered by the vertices in the currently selected subset. This bruteforce algorithm keeps the smallest size of the valid vertex cover as the answer.

This bruteforce algorithm is available in both weighted and unweighted version.

Its time complexity is O(2^V × E), i.e., very slow.

Discussion: But there is an alternative O(2^k × E) parameterized solution if we are told that k is 'not-that-large'.

### 4-1. Parameterized Solution

[This is a hidden slide]