def is_1D_graph(g):
    """
    Check a graph to see if it is 1D, or
    a chain of nodes with one or zero parents
    and children.

    Parameters
    ------------
    g : networkx Graph

    Returns
    ------------
    is_1D : bool
        Is graph 1D or not
    """
    # check degree of sucessors
    for v in g.succ.values():
        if len(v) not in [0, 1]:
            return False

    # check degree of predecessors
    for v in g.pred.values():
        if len(v) not in [0, 1]:
            return False

    # made it through all checks
    return True