added multiple selection and corresponding features

This commit is contained in:
2024-07-01 12:57:10 +02:00
parent c09db757bc
commit df8198ef94
4 changed files with 159 additions and 41 deletions

View File

@@ -10,10 +10,10 @@ class Graph:
self.nodes: list[Node] = []
def add_node(self, x: int, y: int, name: str) -> None:
self.nodes.append(Node(x, y, name))
self.nodes.append(Node(x, y, name, len(self.nodes)))
def add_edge(self, start_index: int, end_index: int, length: float) -> None:
self.edges.append(Edge(start_index, end_index, length))
self.edges.append(Edge(start_index, end_index, length, len(self.edges)))
def number_of_nodes(self) -> int:
return len(self.nodes)