def METHOD_NAME(self, vertex: Vertex, dist):
    self.edges[vertex] = dist
    self.flags.add(vertex)
    vertex.r_edges[self] = dist
    if self.worst_edge is None or self.edges[self.worst_edge] < dist:
        self.worst_edge = vertex