group_graph function

Group nodes and edges based on community structure