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.

• For triangulations take a look at this and this and this. Sep 17, 2018 at 0:56
• @Rohit In particular, the last link would be worth an answer. Sep 17, 2018 at 9:47
• 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. Sep 17, 2018 at 11:17

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:

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.

• 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! Sep 17, 2018 at 21:28
• It's showing some errors, even if I try to run that code unaltered. Sep 17, 2018 at 21:42
• Try this, modified to work on 11.3 Sep 17, 2018 at 22:18
• Works fine now. Thanks! Sep 17, 2018 at 22:25
• @PhysicsMoron Maybe you can use this. Jan 28, 2019 at 21:52