I'm trying to enumerate the labeled graphs on $n$ vertices having at most $e$ edges. I thought GraphData /@ GraphData[n]
and then filtering by edge count would do the trick (albeit slowlt) but this seems to only return some named graphs and it also only has one graph per isomorphism class, which is not what I want.
$\begingroup$
$\endgroup$
1
mmax = Binomial[n,2]
forn
vertices, and select allm
-element subsets ofRange[mmax]
. Then create arrays where these positions are set to 1, the rest to 0. Finally use the values in the arrays to fill the upper triangular part of an adjacency matrix.TakeList
will be helpful for partitioning the array,PadLeft
for turning it into a matrix. Finally, symmetrix the matrix and convert to a graph withAdjacencyGraph
. I'm sorry, I don't have time to write ready to use code for this. $\endgroup$