| | |
| | | for start in sorted( self.vertices() ): |
| | | for end in self.adjacent_of(start): |
| | | (first, second) = (start, end) if (start >= end) else (end, start) |
| | | if first in visited_edges: |
| | | #visited_adjacent = visited_edges.get(first) |
| | | visited_adjacent = visited_edges[first] |
| | | if second not in visited_adjacent: |
| | | visited_adjacent.add(second) |
| | | if first in visited_edges: |
| | | #visited_adjacent = visited_edges.get(first) |
| | | visited_adjacent = visited_edges[first] |
| | | if second not in visited_adjacent: |
| | | visited_adjacent.add(second) |
| | | action(start, end) |
| | | else: |
| | | adjacent: set[int] = set() |
| | | visited_edges[first] = adjacent |
| | | adjacent.add(second) |
| | | action(start, end) |
| | | else: |
| | | adjacent: set[int] = set() |
| | | visited_edges[first] = adjacent |
| | | adjacent.add(second) |
| | | action(start, end) |
| | | |
| | | |
| | | |
| | | def __repr__(self): |
| | | text = "" |