We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c74a4e9 commit 1086ab4Copy full SHA for 1086ab4
graphs/graph.py
@@ -113,8 +113,8 @@ def edges(self):
113
"""
114
edge_list = []
115
for node in self.nodes():
116
- for each in self.neighbors(node):
117
- edge_list.append((node, each))
+ edges = [(node, each) for each in self.neighbors(node)]
+ edge_list.extend(edges)
118
return edge_list
119
120
# Methods for setting properties on nodes and edges
0 commit comments