Блог пользователя zeldris

Автор zeldris, история, 8 лет назад, По-английски

Hello everyone

I'm writing a problem for a contest in my college, so I need generate a planar graph. I need to make sure the graph is planar. Is there any trick to generate such graphs?

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

Kuratowski's theorem gives a sufficient and necessary condition for a graph being planar. I'm unsure though how could you check that.

»
8 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

There is Gamma-algorithm, try to google it, cuz I found only russian tutorial version

»
8 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Well, when I had the problem like this, I used random dots and two treaps. You can connect dots as in a Cartesian tree, then invert priority, and connect dots again. So you have the planar graph in O(N) time.

If you want more edges, I guess it can be done from geometry easily.