# Planarity functions

**URL:** <https://forum.compas-framework.org/t/planarity-functions/42>\
**Category:** compas\
**Created:** [February 6, 2018, 2:25pm UTC](https://forum.compas-framework.org/t/planarity-functions/42 "2018-02-06T14:25:25Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![SalMo](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@SalMo](https://forum.compas-framework.org/u/SalMo)\
**Post date:** [February 6, 2018, 2:25pm UTC](https://forum.compas-framework.org/t/planarity-functions/42/1 "2018-02-06T14:25:25Z")

</div>

“network\_is\_xy” function does not seem to work correctly.

---

<div class="post-metadata">

**Author:** ![andrewliew](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.compas-framework.org/andrewliew/32/88_2.png) [@andrewliew](https://forum.compas-framework.org/u/andrewliew)\
**Post date:** [February 6, 2018, 2:41pm UTC](https://forum.compas-framework.org/t/planarity-functions/42/2 "2018-02-06T14:41:04Z")

</div>

Hi Salmo,

If this seems like a bug, Can you provide some more details and create an issue on the [issue tracker](https://github.com/compas-dev/compas/issues)?

Please let us know what you have input, and what error message you are getting.

Thanks

---

<div class="post-metadata">

**Author:** ![SalMo](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@SalMo](https://forum.compas-framework.org/u/SalMo)\
**Post date:** [February 6, 2018, 2:48pm UTC](https://forum.compas-framework.org/t/planarity-functions/42/3 "2018-02-06T14:48:52Z")

</div>

Hi Andrew,

I get the following error on “network\_is\_xy”, while using “network\_is\_planar\_embedding”:  
"TypeError: ‘Network’ object is not iterable"  
however the other two functions “network\_is\_planar” and “network\_is\_crossed” are not giving me errors, meaning the input “network” is OK.

---

<div class="post-metadata">

**Author:** ![tomvanmele](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.compas-framework.org/tomvanmele/32/13_2.png) [@tomvanmele](https://forum.compas-framework.org/u/tomvanmele)\
**Post date:** [February 6, 2018, 3:20pm UTC](https://forum.compas-framework.org/t/planarity-functions/42/4 "2018-02-06T15:20:33Z")

</div>

hi all,

this is a leftover from old functionality that allowed the iteration over the vertices of the data structures by doing the following:

```python
for key in network:
    print(key)

```

this has been removed in the more recent versions.  
will update the algorithm accordingly…

best,  
tom

---

<div class="post-metadata">

**Author:** ![tomvanmele](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.compas-framework.org/tomvanmele/32/13_2.png) [@tomvanmele](https://forum.compas-framework.org/u/tomvanmele)\
**Post date:** [February 6, 2018, 3:33pm UTC](https://forum.compas-framework.org/t/planarity-functions/42/5 "2018-02-06T15:33:14Z")

</div>

fixed in hotfix 0.1.0-#35

---

<div class="post-metadata">

**Author:** ![SalMo](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@SalMo](https://forum.compas-framework.org/u/SalMo)\
**Post date:** [February 6, 2018, 3:39pm UTC](https://forum.compas-framework.org/t/planarity-functions/42/6 "2018-02-06T15:39:56Z")

</div>

Thanks Tom.

I also have a question/comment on “network\_embed\_in\_plane” function:

It looks like that for a handful of planar networks it is unable to embed the network (i.e. returns False), even the ones that I easily can draw the embedding on the paper (it works fine for the fink truss). Is there any other way to draw the embedding of a planar network?

---

<div class="post-metadata">

**Author:** ![tomvanmele](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.compas-framework.org/tomvanmele/32/13_2.png) [@tomvanmele](https://forum.compas-framework.org/u/tomvanmele)\
**Post date:** [February 6, 2018, 7:18pm UTC](https://forum.compas-framework.org/t/planarity-functions/42/7 "2018-02-06T19:18:04Z")

</div>

`network_embed_in_plane` is a bit experimental and indeed not very robust. it was specifically designed for the examples in the _Algebraic Graphic Statics_ paper and not really tested beyond that scope.

creating planar straight-line drawings of graphs is not an easy task, especially if a particular type of result is desired, as in the case of using these drawings for AGS-style purposes. usually _force layout_ algorithms are used, which is also what happens in the `network_embed_in_plane` function.

development on `compas_ags` will start to pick up again soon, but i cannot promise that we will immediately find a much better solution for the embedding stuff.

just for my information, could you provide a bit more context to your questions and perhaps a (few) small example(s)?

best,  
tom

---

<div class="post-metadata">

**Author:** ![SalMo](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@SalMo](https://forum.compas-framework.org/u/SalMo)\
**Post date:** [February 7, 2018, 7:14am UTC](https://forum.compas-framework.org/t/planarity-functions/42/8 "2018-02-07T07:14:16Z")

</div>

Hi Tom,

At this point I am aware that it is not an easy task to draw a crossing-free embedding as you have mentioned in your AGS paper. I have some truss patterns as the output of my ground truss optimization algorithm and I would like to be able to create their dual.

Below are examples of the output patterns. The “network\_is\_planar” returns True for all of them, however “network\_embed\_in\_plane” returns False.

 ![upl](https://us1.discourse-cdn.com/flex015/uploads/compas_framework1/original/1X/e0edfb019f366291a1ca6d63dc9958e5d74f297b.jpg)

Hope that provides you a bit of context.

---

<div class="post-metadata">

**Author:** ![SalMo](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@SalMo](https://forum.compas-framework.org/u/SalMo)\
**Post date:** [February 7, 2018, 10:38am UTC](https://forum.compas-framework.org/t/planarity-functions/42/9 "2018-02-07T10:38:16Z")

</div>

Another observation:

“network\_find\_crossings” provides repetitive edge pairs, one is opposite the other, is it a bug?

---

<div class="post-metadata">

**Author:** ![tomvanmele](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.compas-framework.org/tomvanmele/32/13_2.png) [@tomvanmele](https://forum.compas-framework.org/u/tomvanmele)\
**Post date:** [February 7, 2018, 12:23pm UTC](https://forum.compas-framework.org/t/planarity-functions/42/10 "2018-02-07T12:23:27Z")

</div>

yes that is a bug.  
please add it to the issue tracker, then i will fix it!

BTW, will try to get back to you about your examples as soon as possible…
