Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8408249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:34:52+00:00 2026-06-09T23:34:52+00:00

So, I have a graph of vertices which have certain weights and edges. I’m

  • 0

So, I have a graph of vertices which have certain weights and edges. I’m trying to find the minimum weighted vertex cover. For example if I have a vertex cover of size 10 but each node has a weight of 10, then the weight of the total cover is 100. But if I have a vertex cover of size 99 with each node of weight 1, then I would pick this cover over the previous one.

This is NP-Complete I believe, so there’s no efficient algorithm, but I think even an exhaustive search would work for me because the number of nodes will be relatively small. The only way I can think to do this then would be to generate the power set of the set [1 … n] (where each integer corresponds to a node on the graph), then test every individual set to see if it is 1) a valid vertex cover, and 2) keep track of the vertex cover of lowest weight.

But this seems horribly inefficient. Is this the best way to go about it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:34:53+00:00Added an answer on June 9, 2026 at 11:34 pm

    Minimum weight vertex cover is NP-Complete so you couldn’t expect better than exhaustive search in general, but you could use backtracking to find a minimum weight vertex cover, something like this :

    MinCover(Graph G, List<Vertex> selectedVertices, int min)
    {
       var coveredAll = covered(G,selectedVertices);
       if ( coveredAll && weight(selectedVertices) < min)
       {
           cover = selectedVertices.ToList();
           min = weight(cover);
       }
       else if (!coveredAll && weight(selectedVertices) < min)
       {
          select another unvisited vertex and add it to selectedVertices
          call MinCover
          remove the previously selected vertex from the list
       }
    
       return;
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have defined a 'vertex' class which, when combined, form a graph. these vertices
I have my graph implemented with linked lists, for both vertices and edges and
I have a large graph (30k vertices, 250m edges) and using boost graph library
Given a directed graph, I need to find the minimum set of vertices from
I have a directed graph with millions of vertices and edges. A set of
I have a directed, weighted, complete graph with 100 vertices. The vertices represent movies,
The graph is composed of many vertices each of which have some properties, and
I have a nice graph (a list) containing 81 vertices (each vertex is an
I have a graph which contains an unknown number of disconnected subgraphs. What's a
I have oriented graph. Graph can be strongly connected. Every vertex can have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.