Rewrite a function to generate graph

I put the function in the EM_SBM folder. However, it is a function we
will use globally.