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

Function find_exclude_eids

python/dgl/dataloading/base.py:317–383  ·  view source on GitHub ↗

Find all edge IDs to exclude according to :attr:`exclude_mode`. Parameters ---------- g : DGLGraph The graph. exclude : Can be either of the following, None (default) Does not exclude any edge. 'self' Exclude the given edges

(
    g,
    seed_edges,
    exclude,
    reverse_eids=None,
    reverse_etypes=None,
    output_device=None,
)

Source from the content-addressed store, hash-verified

315
316
317def find_exclude_eids(
318 g,
319 seed_edges,
320 exclude,
321 reverse_eids=None,
322 reverse_etypes=None,
323 output_device=None,
324):
325 """Find all edge IDs to exclude according to :attr:`exclude_mode`.
326
327 Parameters
328 ----------
329 g : DGLGraph
330 The graph.
331 exclude :
332 Can be either of the following,
333
334 None (default)
335 Does not exclude any edge.
336
337 'self'
338 Exclude the given edges themselves but nothing else.
339
340 'reverse_id'
341 Exclude all edges specified in ``eids``, as well as their reverse edges
342 of the same edge type.
343
344 The mapping from each edge ID to its reverse edge ID is specified in
345 the keyword argument ``reverse_eid_map``.
346
347 This mode assumes that the reverse of an edge with ID ``e`` and type
348 ``etype`` will have ID ``reverse_eid_map[e]`` and type ``etype``.
349
350 'reverse_types'
351 Exclude all edges specified in ``eids``, as well as their reverse
352 edges of the corresponding edge types.
353
354 The mapping from each edge type to its reverse edge type is specified
355 in the keyword argument ``reverse_etype_map``.
356
357 This mode assumes that the reverse of an edge with ID ``e`` and type ``etype``
358 will have ID ``e`` and type ``reverse_etype_map[etype]``.
359
360 callable
361 Any function that takes in a single argument :attr:`seed_edges` and returns
362 a tensor or dict of tensors.
363 eids : Tensor or dict[etype, Tensor]
364 The edge IDs.
365 reverse_eids : Tensor or dict[etype, Tensor]
366 The mapping from edge ID to its reverse edge ID.
367 reverse_etypes : dict[etype, etype]
368 The mapping from edge etype to its reverse edge type.
369 output_device : device
370 The device of the output edge IDs.
371 """
372 exclude_eids = _find_exclude_eids(
373 g,
374 exclude,

Callers 2

sampleMethod · 0.85
__call__Method · 0.85

Calls 3

_find_exclude_eidsFunction · 0.70
recursive_applyFunction · 0.50
copy_toMethod · 0.45

Tested by

no test coverage detected