Given the number of vertices N of a graph. The task is to determine the Edge cover.
Edge Cover: Minimum number of edge required to cover all vertex is known as Edge Cover.
Input : N = 5 Output : 3 Input : N = 4 Output : 2
Example 1: For N = 5 vertices,
Edge Cover is: 3 (Choosing the edges marked in Red, all of the vertices will get covered)
Example 2: For N = 8 vertices,
Edge Cover is: 4 (Choosing the edges marked in Red, all of the vertices will get covered)
Edge Cover = ceil (no. of vertices / 2)
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Finding minimum vertex cover size of a graph using binary search
- Shortest Path in a weighted Graph where weight of an edge is 1 or 2
- Check if removing a given edge disconnects a graph
- Maximum Possible Edge Disjoint Spanning Tree From a Complete Graph
- Tree, Back, Edge and Cross Edges in DFS of Graph
- Maximize number of nodes which are not part of any edge in a Graph
- Edge Coloring of a Graph
- Add and Remove Edge in Adjacency List representation of a Graph
- Check if a given Graph is 2-edge connected or not
- Add and Remove Edge in Adjacency Matrix representation of a Graph
- Maximum cost path in an Undirected Graph such that no edge is visited twice in a row
- Find the maximum component size after addition of each edge to the graph
- Find weight of MST in a complete graph with edge-weights either 0 or 1
- Vertex Cover Problem | Set 1 (Introduction and Approximate Algorithm)
- Minimum squares to cover a rectangle
- Maximum number of tiles required to cover the floor of given size using 2x1 size tiles
- Calculate number of nodes between two vertices in an acyclic Graph by Disjoint Union method
- Calculate number of nodes between two vertices in an acyclic Graph by DFS method
- Find maximum number of edge disjoint paths between two vertices
- Delete Edge to minimize subtree sum difference
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.