This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Undirected Graph ADT with edge data stored as adj_vertices dict for each Vertex | |
| # The key to each edge is a nomalized tuple of the vertex ids ordered from low to high | |
| # edge id (eid) for v1, v2 is (v1,v2) or (v2,v1) such that the first tuple item is less than second | |
| def edge_id(v1,v2): # normalize key v1,v2 to tuple (v_low,v_hi) | |
| return (v1, v2) if v1 <= v2 else (v2, v1) | |
| class Vertex(object): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.