def check_isomorphism(Arg_list): # Find unique argument structures # checking graphs for isomorphism # TODO: check for isomorphism taking into account edges (rel, sem_rel) unclassified_graphs = Arg_list graph_families = [] for unclassified_graph in unclassified_graphs: for graph_family in graph_families: family_member = graph_family[0] dm = DiGraphMatcher(unclassified_graph, family_member) if dm.is_isomorphic(): graph_family.append(unclassified_graph) break else: graph_families.append([unclassified_graph]) return graph_families
def group_into_isomorphic_families(argument_graphs): ''' Find unique argument structures and group them into families TODO: check for isomorphism taking into account edges (rel, sem_rel) ''' unclassified_graphs = argument_graphs graph_families = [] for unclassified_graph in unclassified_graphs: for graph_family in graph_families: family_member = graph_family[0] dm = DiGraphMatcher(unclassified_graph, family_member) if dm.is_isomorphic(): graph_family.append(unclassified_graph) break else: graph_families.append([unclassified_graph]) return graph_families