def _lightest_edge(graph, visited):
    """
    Return the lightest edge in graph going from a visited node to an unvisited one.
    
    @type  graph: graph
    @param graph: Graph.

    @type  visited: list
    @param visited: List of nodes.

    @rtype:  tuple
    @return: Lightest edge in graph going from a visited node to an unvisited one.
    """
    lightest_edge = None
    weight = None
    for each in visited:
        for other in graph[each]:
            if (other not in visited):
                w = graph.edge_weight((each, other))
                if (weight is None or w < weight or weight < 0):
                    lightest_edge = (each, other)
                    weight = w
    return lightest_edge


# Shortest Path
dataset/ETHPy150Open pmatiello/python-graph/core/pygraph/algorithms/minmax.py/_lightest_edge/original