xgi.core.views.DiEdgeView#

class DiEdgeView(H, bunch=None)#

Bases: IDView

An IDView that keeps track of edge ids.

Warning

This is currently an experimental feature.

Parameters:
  • hypergraph (DiHypergraph) – The hypergraph whose edges this view will keep track of.

  • bunch (optional iterable, default None) – The edge ids to keep track of. If None (default), keep track of all edge ids.

See also

IDView

Notes

In addition to the methods listed in this page, other methods defined in the stats package are also accessible via the EdgeView class. For more details, see the tutorial.

Attributes

ids

The ids in this view.

Methods

members

Get the edges of a directed hypergraph.

dimembers

Get the node ids that are members of an edge.

head

Get the node ids that are in the head of a directed edge.

tail

Get the node ids that are in the tail of a directed edge.

filterby

Filter the IDs in this view by a statistic.

filterby_attr

Filter the IDs in this view by an attribute.

dimembers(e=None, dtype=<class 'dict'>)#

Get the node ids that are members of an edge.

Parameters:
  • e (hashable, optional) – Edge ID. By default, None.

  • dtype ({dict, list}, optional) – Container type for the no-arg call. By default, dict, giving {edge_id: (tail_set, head_set)}. Pass list for a plain list of (tail, head) tuples without edge ids.

Returns:

  • dict (if dtype is dict, default) – Mapping from edge id to a (tail, head) tuple of node sets.

  • list (if dtype is list) – List of (tail, head) tuples, in view iteration order.

  • tuple (if e is not None) – A single directed edge as a (tail, head) tuple of node sets.

Raises:
  • TypeError – If e is not None or a hashable

  • XGIError – If dtype is not dict or list

  • IDNotFound – If e does not exist in the hypergraph

empty()#

Edges with no nodes in the head or the tail.

Return type:

DiEdgeView containing the empty edges.

See also

EdgeView.empty()

head(e=None, dtype=<class 'dict'>)#

Get the node ids that are in the head of a directed edge.

Parameters:
  • e (hashable, optional) – Edge ID. By default, None.

  • dtype ({dict, list}, optional) – Container type for the no-arg call. By default, dict, giving {edge_id: head_set}. Pass list for a plain list of head sets, without edge ids.

Returns:

  • dict (if dtype is dict, default) – Mapping from edge id to the set of head members.

  • list (if dtype is list) – List of head sets, in view iteration order.

  • set (if e is not None) – Members of the head of edge e.

Raises:
  • TypeError – If e is not None or a hashable

  • XGIError – If dtype is not dict or list

  • IDNotFound – If e does not exist in the hypergraph

members(e=None, dtype=<class 'dict'>)#

Get the edges of a directed hypergraph.

The members of an edge are the union of its head and tail sets.

Parameters:
  • e (hashable, optional) – Edge ID. By default, None.

  • dtype ({dict, list}, optional) – Container type for the no-arg call. By default, dict, giving {edge_id: head_union_tail}. Pass list for a plain list of member sets, without edge ids.

Returns:

  • dict (if dtype is dict, default) – Mapping from edge id to the set of node members.

  • list (if dtype is list) – List of member sets, in view iteration order.

  • set (if e is not None) – Members of edge e.

Raises:
  • TypeError – If e is not None or a hashable

  • XGIError – If dtype is not dict or list

  • IDNotFound – If e does not exist in the hypergraph

sources(e=None, dtype=<class 'dict'>)#

Get the nodes that are sources (senders) in the directed edges.

Deprecated since version 1.0: Use tail() instead. sources will be removed in a future release. See xgi-org/xgi#765.

See also

tail

identical method

tail(e=None, dtype=<class 'dict'>)#

Get the node ids that are in the tail of a directed edge.

Parameters:
  • e (hashable, optional) – Edge ID. By default, None.

  • dtype ({dict, list}, optional) – Container type for the no-arg call. By default, dict, giving {edge_id: tail_set}. Pass list for a plain list of tail sets, without edge ids.

Returns:

  • dict (if dtype is dict, default) – Mapping from edge id to the set of tail members.

  • list (if dtype is list) – List of tail sets, in view iteration order.

  • set (if e is not None) – Tail members of edge e.

Raises:
  • TypeError – If e is not None or a hashable

  • XGIError – If dtype is not dict or list

  • IDNotFound – If e does not exist in the hypergraph

targets(e=None, dtype=<class 'dict'>)#

Get the nodes that are targets (receivers) in the directed edges.

Deprecated since version 1.0: Use head() instead. targets will be removed in a future release. See xgi-org/xgi#765.

See also

head

identical method