2023-02-23 20:00:40 +08:00
|
|
|
# File: vertex.py
|
|
|
|
# Created Time: 2023-02-23
|
|
|
|
# Author: Krahets (krahets@163.com)
|
|
|
|
|
2023-04-09 05:05:35 +08:00
|
|
|
|
2023-02-23 20:00:40 +08:00
|
|
|
class Vertex:
|
2023-04-09 05:05:35 +08:00
|
|
|
"""顶点类"""
|
|
|
|
|
2023-07-24 22:34:05 +08:00
|
|
|
def __init__(self, val: int):
|
2023-02-23 20:00:40 +08:00
|
|
|
self.val = val
|
|
|
|
|
2023-04-09 05:05:35 +08:00
|
|
|
|
|
|
|
def vals_to_vets(vals: list[int]) -> list["Vertex"]:
|
|
|
|
"""输入值列表 vals ,返回顶点列表 vets"""
|
2023-02-23 20:00:40 +08:00
|
|
|
return [Vertex(val) for val in vals]
|
|
|
|
|
2023-04-09 05:05:35 +08:00
|
|
|
|
|
|
|
def vets_to_vals(vets: list["Vertex"]) -> list[int]:
|
|
|
|
"""输入顶点列表 vets ,返回值列表 vals"""
|
2023-02-23 20:00:40 +08:00
|
|
|
return [vet.val for vet in vets]
|