def access_line_edge_list(self, graph: gc.Graph, removed_nodes: [int] = None): if removed_nodes is None: removed_nodes = None assert (graph.name() == self.graph) file_name = self.__get_graph_name( removed_nodes) + ".directedweihtededgelist" if not os.path.exists(file_name): # create edge list edges = "\n".join( list( map( lambda edge: f"{str(edge[0])} {str(edge[1])} 1\n {str(edge[1])} {str(edge[0])} 1", graph.edges()))) with open(file_name, "w+") as file: file.write(edges) return file_name
def access_edge_list(self, graph: gc.Graph, removed_nodes: [int] = None, graph_description: str = None): if removed_nodes is None: removed_nodes = [] assert (all(node not in graph.nodes() for node in removed_nodes)) file_name = self.__get_graph_name(removed_nodes, graph_description) + ".edgelist" if not os.path.exists(file_name): # create edge list file edges = "\n".join( list( map(lambda edge: str(edge[0]) + " " + str(edge[1]), graph.edges()))) with open(file_name, "w+") as file: file.write(edges) return file_name