Adds an edge to the graph
(self, head, tail, weight)
| 18 | self.num_vertices += 1 |
| 19 | |
| 20 | def add_edge(self, head, tail, weight): |
| 21 | """ |
| 22 | Adds an edge to the graph |
| 23 | |
| 24 | """ |
| 25 | |
| 26 | self.add_vertex(head) |
| 27 | self.add_vertex(tail) |
| 28 | |
| 29 | if head == tail: |
| 30 | return |
| 31 | |
| 32 | self.adjacency[head][tail] = weight |
| 33 | self.adjacency[tail][head] = weight |
| 34 | |
| 35 | def distinct_weight(self): |
| 36 | """ |