I have a material science problem which I am reasonably sure can be solved using networkx, but I'm not sure how.
Firstly I would like to find all unique combinations of 3 elements, with replacement. This I have already done with itertools as follows:
elements = ["Mg","Cu","Zn"]
combinations = list(itertools.combinations_with_replacement(elements, 3))
For each of these combinations, I would like to find all unique permutations over a simple graph. The graph has three nodes and three edges, where each node is connected to two other nodes. Importantly, the edges have a distance of 1, but one of the edges has a distance of 2. Basically, like a right-angle triangle.
e.g. something like Node1 <-Distance=1-> Node2 <-Distance=2-> Node3 <-Distance=1-> Node1
So for the combination ["Mg", "Cu", "Cu"] there should be two unique permutations:
a) Mg(site1) -1- Cu(site2) -1- Mg(site3) -2- Mg(site1)
b) Mg(site1) -1- Mg(site2) -1- Cu(site3) -2- Mg(site1)
c) Cu(site1) -1- Mg(site2) -1- Mg(site3) -2- Cu(site1) (This is the same as b)
NOTE: I'm not sure of the best way to define the graph, it could be something like:
import networkx as nx
FG = nx.Graph()
FG.add_weighted_edges_from([(1, 2, 1), (2, 3, 1), (3, 1, 2)])