I got a graph list containing 110 highly irregular graphs with 12 vertices in the following link.

enter image description here

I would like to put these graphs in my paper (LaTeX). So I chose to print or export them to pdf, but both went wrong. The graphs went out of bound in the pdf. enter image description here

I'd like to ask how I can get these graphs to fit neatly in my paper, like below. enter image description here

  • $\begingroup$ If you use TableForm instead of Grid? $\endgroup$
    – demm
    Commented Aug 1, 2022 at 14:01
  • $\begingroup$ @demm I left my computer. Once I'm back my lab, I'll try. 110 graphs may be too many and may need to be placed in several PDFs. But some graphs don't go over the margins. I don't wish some graphs to be invisible. $\endgroup$
    – licheng
    Commented Aug 1, 2022 at 15:00

2 Answers 2


For 110 simulated graphs:

g = DegreeGraphDistribution[{2, 4, 4, 4, 3, 3, 2}];
  Partition[Table[RandomGraph[g,PlotLabel->Style[i, 10],ImageSize -> 50],{i,1,110}],11],TableSpacing->{0,0}]

enter image description here

  • 2
    $\begingroup$ Nice. It would be esthetically more pleasing to align the numbers? $\endgroup$
    – chris
    Commented Aug 1, 2022 at 16:51
  • $\begingroup$ Simply add after TableSpacing->{0,0} the option for the alignment i.e. TableAlignments->Top and all the numbers will be on the same level. $\endgroup$
    – demm
    Commented Aug 1, 2022 at 19:40
  • $\begingroup$ @demm Thank you very much. Because I want to insert these graphs in pdf format in one go into my thesis (LaTex). But your code output is OK inside the notebook, but when exporting, some graphs still cross the border of a page. $\endgroup$
    – licheng
    Commented Aug 2, 2022 at 2:01
  • $\begingroup$ I tried reducing the number of graphs per line a bit and it worked. $\endgroup$
    – licheng
    Commented Aug 2, 2022 at 2:13

You can use Labeled with graph:

g = Import["http://users.cecs.anu.edu.au/~bdm/data/highlyirregular12.g6"];

    Graph[g[[i]], PlotTheme -> "Monochrome", 
     VertexSize -> .17 {1, 1}, ImageSize -> {50, 30}, 
     VertexStyle -> GrayLevel[.6]], 
    Style[i, FontFamily -> "Baskerville"], Bottom], {i, Length[g]}], 

enter image description here

  • 2
    $\begingroup$ Your code is great. But I can't give the best answer for both answers. So I chose in chronological order. This is very painful. $\endgroup$
    – licheng
    Commented Aug 2, 2022 at 2:14

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.