'Initializes GMState object.
Pass in the GraphMatcher to which this GMState belongs and the
new node pair that will be added to the GraphMatcher\'s current
isomorphism mapping.'

def __init__(self, GM, G1_node=None, G2_node=None):

    self.GM = GM
    self.G1_node = None
    self.G2_node = None
    self.depth = len(GM.core_1)
    if ((G1_node is None) or (G2_node is None)):
        GM.core_1 = {}
        GM.core_2 = {}
        GM.inout_1 = {}
        GM.inout_2 = {}
    if ((G1_node is not None) and (G2_node is not None)):
        GM.core_1[G1_node] = G2_node
        GM.core_2[G2_node] = G1_node
        self.G1_node = G1_node
        self.G2_node = G2_node
        self.depth = len(GM.core_1)
        if (G1_node not in GM.inout_1):
            GM.inout_1[G1_node] = self.depth
        if (G2_node not in GM.inout_2):
            GM.inout_2[G2_node] = self.depth
        new_nodes = set([])
        for node in GM.core_1:
            new_nodes.update([neighbor for neighbor in GM.G1[node] if (neighbor not in GM.core_1)])
        for node in new_nodes:
            if (node not in GM.inout_1):
                GM.inout_1[node] = self.depth
        new_nodes = set([])
        for node in GM.core_2:
            new_nodes.update([neighbor for neighbor in GM.G2[node] if (neighbor not in GM.core_2)])
        for node in new_nodes:
            if (node not in GM.inout_2):
                GM.inout_2[node] = self.depth
