INNER CODE UNIT · Python
add_edge
steineggerlab/Metabuli · util/gtdb_to_taxdump.py:92
def add_edge(self, vertex1, vertex2):
""" assumes that edge is of type set, tuple or list;
between two vertices can be multiple edges!
"""
try:
self.__graph_dict[vertex1].append(vertex2)
except KeyError:
self.__graph_dict[vertex1] = [vertex2]
def __generate_edges(self):
""" A static method generating the edges of the
graph "graph". Edges are represented as sets
with one (a loop back to the vertex) or two
vertices
"""
edges = []
for vertex in self.__graph_dict:
for neighbour in self.__graph_dict[vertex]: