Arguments: num_of_nodes - the number of nodes in the graph Attributes: m_num_of_nodes - the number of nodes in the graph. m_edges - the list of edges. m_component - the dictionary which stores the index of the component which
(self, num_of_nodes: int)
| 32 | |
| 33 | class Graph: |
| 34 | def __init__(self, num_of_nodes: int) -> None: |
| 35 | """ |
| 36 | Arguments: |
| 37 | num_of_nodes - the number of nodes in the graph |
| 38 | Attributes: |
| 39 | m_num_of_nodes - the number of nodes in the graph. |
| 40 | m_edges - the list of edges. |
| 41 | m_component - the dictionary which stores the index of the component which |
| 42 | a node belongs to. |
| 43 | """ |
| 44 | |
| 45 | self.m_num_of_nodes = num_of_nodes |
| 46 | self.m_edges: list[list[int]] = [] |
| 47 | self.m_component: dict[int, int] = {} |
| 48 | |
| 49 | def add_edge(self, u_node: int, v_node: int, weight: int) -> None: |
| 50 | """Adds an edge in the format [first, second, edge weight] to graph.""" |
nothing calls this directly
no outgoing calls
no test coverage detected