Add API get network link nodes

This commit is contained in:
DingZQ
2024-12-08 21:08:06 +08:00
parent 8b818185ff
commit de5ae4d1e5
2 changed files with 17 additions and 0 deletions

View File

@@ -839,6 +839,16 @@ def get_network_coords(name: str) -> dict[str, dict[str, float]]:
result[node_id] = api.get_node_coord(name, node_id)
return result
# DingZQ, 2024-12-08, get all links' start and end node
# link_id:node_id1:node_id2
def get_network_link_nodes(name: str) -> list[str]:
links = api.get_links(name)
result = []
for link_id in links:
nodes = api.get_link_nodes(name, link_id)
result.append(f"{link_id}:{nodes[0]}:{nodes[1]}")
return result
############################################################
# vertex 25.[VERTICES]
############################################################