split_graph function

Split graph into invariant subgraphs