'Iterator over candidate pairs of nodes in G1 and G2.'

def candidate_pairs_iter(self):

    G1_nodes = self.G1_nodes
    G2_nodes = self.G2_nodes
    T1_inout = [node for node in G1_nodes if ((node in self.inout_1) and (node not in self.core_1))]
    T2_inout = [node for node in G2_nodes if ((node in self.inout_2) and (node not in self.core_2))]
    if (T1_inout and T2_inout):
        for node in T1_inout:
            (yield (node, min(T2_inout)))
    elif 1:
        other_node = min((G2_nodes - set(self.core_2)))
        for node in self.G1:
            if (node not in self.core_1):
                (yield (node, other_node))
