def _init(graph):
    """
    Initialize nodes' distances and predecessors and return two dicts.
    
    graph -- a networkx graph
    
    Create three dicts, called dist, pred and finalized, mapping nodes to 
    distances, predecessors, and whether or not their distances are final
    respectively, initialize all distances to infinity, all predecessors to 
    None, all nodes as not finalized, and return the tuple:
    (dist, pred, finalized)
    """
    dist, pred, finalized = dict(), dict(), dict()
    inf = float('inf')
    for node in graph.nodes_iter():
        dist[node] = inf
        pred[node] = None
        finalized[node] = False
    return dist, pred, finalized