Creating a hierarchical graph

To test some procedures, I am trying to create “toy models” of graphs with communities present. I want to create two distinct types of graphs: “flat” and hierarchical.

Hierarchical graphs should have clusters which form clusters among them (for example, page 41 of this presentation: http://www2.cs.uh.edu/~chengu/Teaching/Spring2013/Lecs/Lec15.pdf ). Flat graphs should have a cluster structure but with no hierarchy.

My idea so far is to create flat graphs with networkx.connected_caveman_graph (python), and hierarchical graphs by joining a number of these flat graphs, but I am unsure this is the best approach.

If it helps to know, I want to create such graphs to test a model which distinguishes between hierarchical and flat graphs.

I hope I made myself clear, and that this question is not out of place here. Thanks!