def _reachable(graph):
    """Return a dictionary with all reachable nodes from the graph nodes.

    Args:
        graph: dict: dictionary representing a graph. Keys are the nodes
        and values is a set containing the linked nodes.

    Returns:
        a new dictionary with the same keys, but whose values are all the
        reachable nodes from the current one.
    """
    reachable = {}
    for node in graph:
        reachable[node] = set(graph[node])
        # Add ourselves in case we were not already there.
        reachable[node].add(node)
        latest_nodes = reachable[node]
        while latest_nodes:
            new_nodes = set()
            for n in latest_nodes:
                new_nodes.update(graph[n])
            new_nodes -= reachable[node]
            reachable[node].update(new_nodes)
            latest_nodes = new_nodes

    return reachable