Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disconnect all vertices in a graph - Algorithm

I am looking for an algorithm that finds minimal subset of vertices such that by removing this subset (and edges connecting these vertices) from graph all other vertices become unconnected (i.e. the graph won't have any edges).

  • Is there such algorithm?
  • If not: Could you recommend some kind of heuristics to designate the vertices.

I have a basic knowledge of graph theory so please excuse any incorrectness.

like image 825
NefariousOctopus Avatar asked Jun 23 '15 12:06

NefariousOctopus


People also ask

How do you disconnect from a graph?

A graph is disconnected if at least two vertices of the graph are not connected by a path. If a graph G is disconnected, then every maximal connected subgraph of G is called a connected component of the graph G.

How do you remove the vertex from a graph?

Removing a Vertex in the Graph: To remove a vertex from the graph, we need to check if that vertex exists in the graph or not and if that vertex exists then we need to shift the rows to the left and the columns upwards of the adjacency matrix so that the row and column values of the given vertex gets replaced by the ...

Can a graph have disconnected vertices?

An undirected graph G is therefore disconnected if there exist two vertices in G such that no path in G has these vertices as endpoints. A graph with just one vertex is connected. An edgeless graph with two or more vertices is disconnected.

Can Prims algorithm be used in disconnected graphs?

1 Answer. Easiest explanation - Prim's algorithm iterates from one node to another, so it can not be applied for disconnected graph.


2 Answers

IIUC, this is the classic Minimum Vertex Cover problem, which is, unfortunately, NP Complete.

Fortunately, the most intuitive and greedy possible algorithm is as good as it gets in this case.

like image 72
Ami Tavory Avatar answered Nov 08 '22 23:11

Ami Tavory


The greedy algorithm is a 2-approximation for vertex cover, which in theory, under the Unique Games Conjecture, is as good as it gets. In practice, solving a formulation of vertex cover as an integer program will most likely yield much better results. The program is

min sum_{v in V} x(v)
s.t.
forall {u, v} in E, x(u) + x(v) >= 1
forall v in V, x(v) in {0, 1}.
like image 45
David Eisenstat Avatar answered Nov 08 '22 23:11

David Eisenstat