def mcs(graph1, graph2, max_components=1, lower_bound=0, timeout=None): assert isinstance(graph1, Graph) assert isinstance(graph2, Graph) if timeout: assert isinstance(timeout, int) Cmcs.set_timeout(timeout) size = Cmcs.max( graph1.storage, graph2.storage, max_components, lower_bound, 1) match = dict() for i in range(size): match[Cmcs.get_best(1, i)] = Cmcs.get_best(2, i) return match
def __init__(self, filename): self.content = file(filename).read() self.storage = Cmcs.read_graph(filename) if self.storage is None: raise 'The graph file is not valid'
def __init__(self, sdf): self.content = sdf self.storage = Cmcs.parse_sdf(sdf) if self.storage is None: raise 'The SDF is not valid'