def position_graph_nodes(g, mesh):
    """
    Label the triangle that contains terminal layers.

    Parameters
    ----------
    g : NetworkX graph object
        Graph nodes are updated with labels
    n : int
        Node id in the graph
    label : gdspy object
        Label objec from the gdspy library that contains the label text and position.
    poly : list
        Points of the triangle polygon.

    Returns
    -------
    g : NetworkX graph object
        Updated graph with labels are returned.
    """
    for n, tri in enumerate(mesh['cells']['triangle']):
        pp = mesh['points']
        n1, n2, n3 = pp[tri[0]], pp[tri[1]], pp[tri[2]]
        sum_x = 100000000.0 * (n1[0] + n2[0] + n3[0]) / 3.0
        sum_y = 100000000.0 * (n1[1] + n2[1] + n3[1]) / 3.0
        g.nodes[n]['vertex'] = tri
        g.nodes[n]['pos'] = [sum_x, sum_y]
    return g
