dgl.DGLHeteroGraph.has_edge_between

DGLHeteroGraph.has_edge_between(u, v, etype=None)[source]

Whether the graph has an edge (u, v) of type etype.

Parameters:
  • u (int) – The node ID of source type.
  • v (int) – The node ID of destination type.
  • etype (str or tuple of str, optional) – The edge type. Can be omitted if there is only one edge type in the graph.
Returns:

True if the edge is in the graph, False otherwise.

Return type:

bool

Examples

>>> g.has_edge_between(0, 1, ('user', 'plays', 'game'))
True
>>> g.has_edge_between(0, 2, ('user', 'plays', 'game'))
False