Example #1
0
    def get_permutation_reaction(self, G1, G2):
        (h1, P1) = G1.hash_with_perm()
        (h2, P2) = G2.hash_with_perm()
        
        if (compare_hashes(h1, h2, self.ignore_chirality) != 0):
            raise ReactionException("Hashes do not match !!!")

        P = [0] * G1.get_num_nodes() # a permutation mapping the nodes in G1 to nodes in G2
        for n in range(G1.get_num_nodes()):
            P[P2[n]] = P1[n]
        
        return ["hidden", None, [Reaction("permutation", P, None, None)]]
Example #2
0
    def get_permutation_reaction(self, G1, G2):
        (h1, P1) = G1.hash_with_perm()
        (h2, P2) = G2.hash_with_perm()

        if compare_hashes(h1, h2, self.ignore_chirality) != 0:
            raise ReactionException("Hashes do not match !!!")

        P = [0] * G1.get_num_nodes()  # a permutation mapping the nodes in G1 to nodes in G2
        for n in range(G1.get_num_nodes()):
            P[P2[n]] = P1[n]

        return ["hidden", None, [Reaction("permutation", P, None, None)]]
Example #3
0
 def compare_graph_to_hash(G1, h2):
     h1 = G1.hash(ignore_chirality=self.ignore_chirality)
     return compare_hashes(h1, h2, self.ignore_chirality)
Example #4
0
 def compare_graph_to_hash(G1, h2):
     h1 = G1.hash(ignore_chirality=self.ignore_chirality)
     return compare_hashes(h1, h2, self.ignore_chirality)