GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Python/graphs/graph_matrix.py at master · jusing-es/Python Expand file tree/ Copy pathgraph_matrix.pyMore file actions 25 lines (19 loc) · 482 Bytes / Copy pathgraph_matrix.pyFile metadata and controls25 lines (19 loc) · 482 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 class Graph: def __init__(self, vertex): self.vertex = vertex self.graph = [[0] * vertex for i in range(vertex)] def add_edge(self, u, v): self.graph[u - 1][v - 1] = 1 self.graph[v - 1][u - 1] = 1 def show(self): for i in self.graph: for j in i: print(j, end=" ") print(" ") g = Graph(100) g.add_edge(1, 4) g.add_edge(4, 2) g.add_edge(4, 5) g.add_edge(2, 5) g.add_edge(5, 3) g.show() |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |