def get_end_nodes(graph):
    nodelist = [
        i
        for i in graph.nodes_iter()
        if len(graph.neighbors(i))==1
        ]
    return nodelist
Returns list of nodes with just one neighbor node.
dataset/ETHPy150Open ungarj/label_centerlines/src_create_centerlines.py/get_end_nodes