def _label_nodes_by_identity(intralayer_graphs, interlayer_edges, layer_vec):
    """Go through each of the nodes and determine which ones are shared across multiple slices.	We create an attribute on each of the graphs to indicate the shared identity 	of that node.  This is done through tracking the predecessors of the node vi the interlayer	connections

	"""
    namedict = {}
    backedges = {}
    for e in interlayer_edges:
        ei, ej = e[0], e[1]
        if ei < ej:
            backedges[ej] = backedges.get(ej, []) + [ei]
        else:
            backedges[ei] = backedges.get(ei, []) + [ej]
    offset = 0
    for i, lay in enumerate(layer_vec):
        if i not in backedges:
            namedict[i] = i - offset
        else:
            pred = backedges[i][0]
            namedict[i] = namedict[pred]
            offset += 1
    for graph in intralayer_graphs:
        graph.vs['shared_id'] = list(map(lambda x: namedict[x], graph.vs[
            'nid']))
        assert len(set(graph.vs['shared_id'])) == len(graph.vs['shared_id']
            ), 'IDs within a slice must all be unique'
