def bio3graph_reset_colours(input_dict): from triplet_extractor import graph_operations as gop from networkx import copy nwx = copy.deepcopy(input_dict['network']) gop.reset_edge_colors(nwx) return {'network': nwx}
def bio3graph_colour_relations(input_dict): from triplet_extractor import graph_operations as gop from networkx import copy nwx = copy.deepcopy(input_dict['network']) rels = input_dict['relations'] gop.colour_relations(nwx, rels) return {'network': nwx}
def bio3graph_remove_relations(input_dict): from networkx import copy nwx = copy.deepcopy(input_dict['network']) relations = input_dict['relations'] for (fr, to, relType) in relations: if nwx.has_edge(fr, to, relType): nwx.remove_edge(fr, to, relType) return {'pruned_graph': nwx}