-
Notifications
You must be signed in to change notification settings - Fork 0
/
Arch.py
31 lines (25 loc) · 788 Bytes
/
Arch.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from dataclasses import dataclass
@dataclass
class Arch:
"""Representação de um Arco, com custo não negativo e rótulo.
Args:
source (int): Vértice de origem.
destiny (int): Vértice de destino.
cost (float): Custo do Arco entre a origem e o destino.
label (int): Rótulo do Arco entre a origem e o destino.
Returns:
str: A representação textual do Arco.
"""
source: int
destiny: int
cost: float
label: int
def __str__(self) -> str:
"""Retorna a representação textual do Arco."""
return (
f"Arco=["
+ f"Origem={self.source}, "
+ f"Destino={self.destiny}, "
+ f"Custo={self.cost}, "
+ f"Rótulo={self.label}];\n"
)