How can I generate all labelled connected simple graphs on n vertices?
In the image below, I drew examples with number of vertices n = 3 and n = 4.
For n = 3, there are only 4 graphs that connect all vertices.
For n = 4, I only drew some as there are many more so did not draw all here.
I would like to create a function that if I input the number of vertices then it generates all graphs like the image below.
Any idea to do this?
The layout of graphs is not important but I want to label vertices's names with number or letters. Self-loop is not possible and there is only one edge between two vertices.





allConnected[4], it will return all those graphs. – user293787 Nov 08 '22 at 18:01DeleteDuplicates[list, IsomorphicGraphQ]is very inefficient. The better way to do this isDeleteDuplicatesBy[list, CanonicalGraph]. However, OP was asking for labelled graphs. – Szabolcs Nov 08 '22 at 21:52