def process_input_graph(func):
    """Decorator, ensuring first argument is a networkx graph object.
    If the first arg is a dict {node: succs}, a networkx graph equivalent
    to the dict will be send in place of it."""
    @wraps(func)
    def wrapped_func(*args, **kwargs):
        input_graph = args[0]
        if isinstance(input_graph, nx.DiGraph):
            return func(*args, **kwargs)
        else:
            nx_graph = dict_to_nx(args[0], oriented=True)
            args = [nx_graph] + list(args[1:])
            return func(*args, **kwargs)
    return wrapped_func
def process_input_graph ( func ) : @ wraps ( func ) def wrapped_func ( * args , ** kwargs ) : input_graph = args [ 0 ] if isinstance ( input_graph , nx . DiGraph ) : return func ( * args , ** kwargs ) else : nx_graph = dict_to_nx ( args [ 0 ] , oriented = True ) args = [ nx_graph ] + list ( args [ 1 : ] ) return func ( * args , ** kwargs ) return wrapped_func
Decorator, ensuring first argument is a networkx graph object.
    If the first arg is a dict {node: succs}, a networkx graph equivalent
    to the dict will be send in place of it.