Generate a graph from the Erdős–Rényi (ER) model. It can be called with either (n,p) or (n,m) options. We apply a layout after the graph is generated.