Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/chapter09graphs/GraphsAdjacenyList.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,15 @@ def setPrevious(self, current):
def getPrevious(self, current):
return self.previous

def getEdges(self):
def get_edges(self):
edges = []
for v in G:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

---> 47 for v in G:
48 for w in v.get_connections():
49 vid = v.get_vertex_ID()

NameError: name 'G' is not defined

for w in v.getConnections():
vid = v.getVertexID()
wid = w.getVertexID()
edges.append((vid, wid, v.getWeight(w)))
return edges
for k,v in self.vertDictionary.items():
for w in v.get_connections():
vid = v.get_vertex_ID()
wid = w.get_vertex_ID()
edges.append([vid,wid,v.get_weight(w)])

return edges

if __name__ == '__main__':

Expand Down