def add_nodal_positions(graph, centroids):
    """Adds the x, y, z attributes to each node in graph."""
    for roi in centroids:
        graph.nodes[roi]['x'] = float(centroids[roi][0])
        graph.nodes[roi]['y'] = float(centroids[roi][1])
        graph.nodes[roi]['z'] = float(centroids[roi][2])
    return
