def graph_db_inverse_refs(self, edgeIndex=False):
    'return kwargs for inverse of this graph, or edge index of this graph'
    if edgeIndex: # TO CONSTRUCT AN EDGE INDEX
        db = ('edgeDB', 'sourceDB', 'targetDB')
    else: # DEFAULT: TO CONSTRUCT AN INVERSE MAPPING OF THE GRAPH
        db = ('targetDB', 'sourceDB', 'edgeDB')
    try:
        d = dict(sourceDB=getattr(self, db[0]), targetDB=getattr(self, db[1]))
        try:
            d['edgeDB'] = getattr(self, db[2]) # EDGE INFO IS OPTIONAL
        except __HOLE__:
            pass
    except AttributeError:
        d = dict(simpleKeys=True) # NO SOURCE / TARGET DB, SO USE IDs AS KEYS
    try: # COPY THE LOCAL UNPACKING METHOD, IF ANY
        if not edgeIndex:
            d['unpack_edge'] = self.__dict__['unpack_edge']
    except KeyError:
        pass
    return d
dataset/ETHPy150Open cjlee112/pygr/pygr/mapping.py/graph_db_inverse_refs