xgi.core.views.DiEdgeView#
- class DiEdgeView(H, bunch=None)#
Bases:
IDViewAn 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
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
idsThe ids in this view.
Methods
Get the edges of a directed hypergraph.
Get the node ids that are members of an edge.
Get the node ids that are in the head of a directed edge.
Get the node ids that are in the tail of a directed edge.
Filter the IDs in this view by a statistic.
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)}. Passlistfor 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
- 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}. Passlistfor 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}. Passlistfor 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.sourceswill be removed in a future release. See xgi-org/xgi#765.See also
tailidentical 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}. Passlistfor 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