Embedding

34 views
Skip to first unread message

Vincent S.

unread,
May 27, 2021, 7:11:50 AM5/27/21
to ogdf
Hello dear OGDF team,

 I would appreciate help very much as I am working with OGDF at my bachelor thesis:

My question is:
How can I preserve an embedding of a planar ogdf::Graph,
if I want to replace a node by a couple of nodes
 like this:
keepEmbedded.png
I can't find how the embedding of the adjacency lists are implemented, so I don't know how to insert the edges and nodes correctly.

Thank you!
Vincent

Dagobert Smart

unread,
May 27, 2021, 7:48:14 AM5/27/21
to ogdf

Hello Vincent,

every node (=NodeElement*) has its own list of adjacency entries in the form of myNode->adjEntries. The order of these adjacency entries in the list determines their clockwise ordering around the node and hence the embedding.

In your case, it seems like it would suffice to use Graph::split, see https://ogdf.uos.de/doc/classogdf_1_1_graph.html#ac3be54a0554615b50cf6661029abb592 .
The node n would not be replaced, but the resulting graph would be isomorphic to your example:

edge edge_wBar_w = G.split(edge_n_w);
edge edge_yBar_y = G.split(edge_n_y);
node yBar = edge_yBar_y->source();
...

However, if you need to construct a (sub-)graph with the correct embedding from scratch, e.g. because you have to delete n for some reason, you can use one of the Graph::newEdge-methods that take a previously created adjEntry as a parameter (https://ogdf.uos.de/doc/classogdf_1_1_graph.html#a828ce5716995ae452cc8e2842b45e313 and below):

node vBar = G.newNode();
edge e = G.newEdge(vBar, v);
edge f = G.newEdge(e->adjSource(), x);
...

Best regards,
Dagobert

Vincent S.

unread,
May 27, 2021, 11:16:41 AM5/27/21
to ogdf
Dagobert,
Thank you a lot for the quick and useful answer, using the split method works very well here for me! :)
Reply all
Reply to author
Forward
0 new messages