'Determine butterfly subtopologies in a network topology

I recently got a project where I have to identify all the butterfly subtopologies in a network. The network has to be implemented using a graph. Fortunately, I found out the networkx library that helps me a lot regarding building a random graph. The problem that I face is that I do not know how can I determine butterfly subtopologies. The only documentation that I found at this moment is the one from wikipedia that explains the building of a butterfly subtopology in a matrix where the position of every vertice is at a fixed position. enter image description here

The question is, is there any way to generate vertices that are at a fixed position (like every node is placed at the intersection of a row with a colmn in a matrix) ? or maybe is it another solution that could help me determining this type of subtopologies?.The code that i started with is the one from this link (https://plotly.com/python/network-graphs/), and what I want to do is to color the butterfly subtopologies in the generated graph.

The document from Wikipedia regarding Butterfly subtopologies: https://en.wikipedia.org/wiki/Butterfly_network#:~:text=A%20butterfly%20network%20is%20a,nodes%20in%20a%20multiprocessor%20system.

Thanks for help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source