[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

I need some help with an algorithm. I'm attempting to write

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 12
Thread images: 1

File: face_traversal_example.png (11KB, 424x220px) Image search: [Google]
face_traversal_example.png
11KB, 424x220px
I need some help with an algorithm. I'm attempting to write an approximation to vertex cover using the bipartite homeograph of a planar graph but I can't figure out how to actually construct this homeograph. They make it seem simple--"just turn every face into a vertex and make an edge to its adjacent faces", but I dont see any algorithms on doing that for undirected planar graphs.
>>
>>7932562
I can probably use the boost library's boyer myrvold planarity test to generate a planar embedding and use that in the planar face traversal, but this doesn't tell me how to get the adjacent faces for a geometric dual or even how the algorithm works
>>
what data structure are you using for your graphs?

the algorithm to construct the homeograph certainly depends on how a graph is stored.
>>
>>7932620
literally just an unordered set of vertices and a vector of edges, in no particular order.
I'm probably going to use boost now
>>
>>7932562
Like a square made of triangular pyramids? :^)
>>
>>7932624
what the hell dude, use an adjacency list. you can really efficiently find cycles (and with a little work) faces from those cycles and probably anything you are trying to do to a graph is in an intro data structures textbook.
>>
>>7932643
The number of verts I have is too much for an adjacency matrix, thats like 750002. If you actually mean an adjacency list of edges, im doing that already
>>
>>7932745
I mean a doubly linked list with an entry for each node where that entry is a linked list of all adjacent nodes. You don't actually have edges in there, but they are there for all intents and purposes.

https://en.wikipedia.org/wiki/Adjacency_list

>thats like 750002.

mama mia. you definitely want to choose your data structure very carefully. What you have may or may not be efficiently searchable to do what you want to do (I don't know what you mean by adjacency list of edges)
>>
>>7932761
Yeah, I'm already doing that, since that's the format of the input. Using std::vector.
>>
>>7932770
Ok. I don't know about your problem. You can modify topological sort to efficiently find all the cycles in your graph and maybe you could modify that to find only the cycles that correspond to a face. If you could do that then while you're doing it make a new graph out of each face as you find it.

If you think some shit in those libraries you mentioned would do it though that'd probably be a lot less of a pain in the ass.
>>
After looking through the source here: https://github.com/aaw/boost_planar_graph_dual
I found that once you have a planar embedded version of your graph, literally all you do is create a vertex for each new face, iterate through each edge of the original graph, and create an edge to another face on the new vertex.
If the edge doesn't already exist, then create it. Otherwise.

It seems that creating the geometric dual is simple enough, but I would say that the problem I was having is not understanding how planar_face_traversal and planar_face_visitor works because the Boost documentation is so god damn fucking shit.
>>
>>7932978
>, literally all you do is create a vertex for each new face,

how do you determine the faces though?
Thread posts: 12
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

If you need a post removed click on it's [Report] button and follow the instruction.
If you like this website please support us by donating with Bitcoin at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties. Posts and uploaded images are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that website. If you need information about a Poster - contact 4chan. This project is not affiliated in any way with 4chan.