import networkx


def graph_from_dict(d):
    """ Creates a NetworkX Graph from a dictionary

    Parameters
    ----------
    d : dict

    Returns
    -------
    Graph: NetworkX Graph

    Examples
    --------
    >>> g = graph_from_dict({'a':['b'], 'b':['c', 'd'], 'c':[], 'd':[], 'e':['d']})
    """

    g = networkx.DiGraph()
    for key, children in d.items():
        for child in children:
            g.add_edge(key, child)
    return g