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