Is there a nice way I can find all possible triangulations (or quadrangulations) of a polygon (say 10-gon)? I want to have all possible diagrams with the diagonals marked (i.e. with unique name). Please suggest me in case there already is a package for such a thing.

  • 2
    $\begingroup$ For triangulations take a look at this and this and this. $\endgroup$ Sep 17, 2018 at 0:56
  • 1
    $\begingroup$ @Rohit In particular, the last link would be worth an answer. $\endgroup$ Sep 17, 2018 at 9:47
  • $\begingroup$ Thanks @RohitNamjoshi. Last link is useful. But I need something more : 1. Vertices are numbered (such that I can identify the diagonals by unique names). 2. Print all possible triangulations for a given polygon. $\endgroup$ Sep 17, 2018 at 11:17

1 Answer 1


Based on your comments, I think this is closest to your requirements. To generate labeled vertices, add the following to the triangulation function:

labels = MapIndexed[Text[Style[First[#2], 10], #1] &, vertices * 1.1];

and add it to the Graphics argument list

Show[Graphics[{poly, edges, labels}]

With size = 5 this is the output: enter image description here

I am not sure what you mean by "Print all possible triangulations", but the symbol edges is set to a list of the edges for each triangulation. For size = 5, edges is

{{{2, 5}, {2, 4}}, {{2, 5}, {3, 5}}, {{2, 4}, {4, 1}}, {{3, 1}, {3,5}}, {{3, 1}, {4, 1}}}

You can probably use that to generate the printed form you need.

  • $\begingroup$ Thanks a lot for the answer! I think this is what I want. But somehow I couldn't generate the diagrams from that package. It would be really helpful if you can modify the code and share as a link. Thanks again! $\endgroup$ Sep 17, 2018 at 21:28
  • $\begingroup$ It's showing some errors, even if I try to run that code unaltered. $\endgroup$ Sep 17, 2018 at 21:42
  • 1
    $\begingroup$ Try this, modified to work on 11.3 $\endgroup$ Sep 17, 2018 at 22:18
  • $\begingroup$ Works fine now. Thanks! $\endgroup$ Sep 17, 2018 at 22:25
  • 1
    $\begingroup$ @PhysicsMoron Maybe you can use this. $\endgroup$ Jan 28, 2019 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.