How do I select maximum vertices in a graph in this case:-?

Revision en2, by umsh1ume, 2017-02-12 21:17:55

I need to select maximum vertices in a graph such that the distance between any two selected vertices is less than the given limit? distance between adjacent nodes is 1. Input n,d meaning number of nodes and the limit d, n-1 lines follows denoting edges. Example 6 5 2 1 2 3 4 2 1 6 5 6

Output 5 As all 5 vertices can be selected within the range d

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English umsh1ume 2017-02-12 21:17:55 192
en1 English umsh1ume 2017-02-12 21:15:20 230 Initial revision (published)