MCPcopy
hub / github.com/dmlc/dgl / _locate_eids_to_exclude

Function _locate_eids_to_exclude

python/dgl/sampling/utils.py:12–23  ·  view source on GitHub ↗

Find the edges whose IDs in parent graph appeared in exclude_eids. Note that both arguments are numpy arrays or numpy dicts.

(frontier_parent_eids, exclude_eids)

Source from the content-addressed store, hash-verified

10
11
12def _locate_eids_to_exclude(frontier_parent_eids, exclude_eids):
13 """Find the edges whose IDs in parent graph appeared in exclude_eids.
14
15 Note that both arguments are numpy arrays or numpy dicts.
16 """
17 if not isinstance(frontier_parent_eids, Mapping):
18 return np.isin(frontier_parent_eids, exclude_eids).nonzero()[0]
19 result = {}
20 for k, v in frontier_parent_eids.items():
21 if k in exclude_eids:
22 result[k] = np.isin(v, exclude_eids[k]).nonzero()[0]
23 return recursive_apply(result, F.zerocopy_from_numpy)
24
25
26class EidExcluder(object):

Callers 1

_find_indicesMethod · 0.85

Calls 3

nonzeroMethod · 0.80
recursive_applyFunction · 0.50
itemsMethod · 0.45

Tested by

no test coverage detected