algorithm - Accommodate maximum peoples in tour -


i have arrange tour. there n peoples want attend tour. of them enemies each other. (enemy of enemy may or may not enemy. if enemy of b, b enemy of a) if accommodate person in tour, can not accommodate enemy.

now want accommodate maximum possible number of persons in tour. how can find number?

ex: if there 5 tourists, , let's call them a-e. enemy b , d, b enemy of e, , c enemy of d.

      b   c   d   e   +---+---+---+---+---+ | - | x |   | x |   |   +---+---+---+---+---+ b | x | - |   |   | x |   +---+---+---+---+---+ c |   |   | - | x |   |   +---+---+---+---+---+ d | x |   | x | - |   |   +---+---+---+---+---+ e |   | x |   |   | - |   +---+---+---+---+---+ 

in case following trips possible: empty, a, b, c, d, e, ac, ae, bc, bd, ace, ce, de etc. out of these, best tour ace accommodates 3 tourist , hence answer 3.

my approach:

  • i tried looping , trying combinations bitmaps, slow.
  • i using dfs trying find better method.
  • i tried work creating friendship graph , prepare some
    spanning tree. doesn't work can travel b , b can
    travel c not guarantee , travel c.
  • i tried creating enemity graph , finding weak links ended clueless.

i thankful, if can give me hint or point resource solve problem.

create graph tourists :

  • each node tourist
  • if 2 tourists enemies draw edge between them
  • find maximum independent set

there detailed algorithms finding maximum independent set in paper: algorithms maximum independent sets

and parallel approach has been provided in one:lecture notes on parallel algorithm generating maximal independent set

and this java implementation.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -