def get_typeid_by_target(gidx, etid, target):
    """Find the src/dst/etype id based on the target 'u', 'v' or 'e'."""
    src_id, dst_id = gidx.metagraph.find_edge(etid)
    if target in [0, "u"]:
        return src_id
    if target in [2, "v"]:
        return dst_id
    return etid
Find the src/dst/etype id based on the target 'u', 'v' or 'e'.
python/dgl/_sparse_ops.py