nx.compose Return a new graph of G composed with H. Composition is the simple union of the node sets and edge sets. ref link
nx.compose