xgi.core.views.DiEdgeView#
- class DiEdgeView(H, bunch=None)[source]#
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
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
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 'list'>)[source]#
Get the node ids that are members of an edge.
- Parameters:
e (hashable, optional) – Edge ID. By default, None.
dtype ({list, dict}, optional) – Specify the type of the return value. By default, list.
- Returns:
list (if dtype is list, default) – Directed edges.
dict (if dtype is dict) – Directed edges.
set (if e is not None) – A single directed edge.
In all of these cases, a directed edge is
a 2-tuple of sets, where the first entry
is the tail, and the second entry is the head.
- 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()[source]#
Edges with no nodes in the head or the tail.
- Return type:
DiEdgeView containing the empty edges.
See also
- head(e=None, dtype=<class 'list'>)[source]#
Get the node ids that are in the head of a directed edge.
- Parameters:
e (hashable, optional) – Edge ID. By default, None.
dtype ({list, dict}, optional) – Specify the type of the return value. By default, list.
- Returns:
list (if dtype is list, default) – Head members.
dict (if dtype is dict) – Head members.
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 'list'>)[source]#
Get the edges of a directed hypergraph.
- Parameters:
e (hashable, optional) – Edge ID. By default, None.
dtype ({list, dict}, optional) – Specify the type of the return value. By default, list.
- Returns:
list (if dtype is list, default) – Edge members.
dict (if dtype is dict) – Edge members.
set (if e is not None) – Members of edge e.
The members of an edge are the union of
its head and tail 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
- sources(e=None, dtype=<class 'list'>)[source]#
Get the nodes that are sources (senders) in the directed edges.
See also
tail
identical method
- tail(e=None, dtype=<class 'list'>)[source]#
Get the node ids that are in the tail of a directed edge.
- Parameters:
e (hashable, optional) – Edge ID. By default, None.
dtype ({list, dict}, optional) – Specify the type of the return value. By default, list.
- Returns:
list (if dtype is list, default) – Tail members.
dict (if dtype is dict) – Tail members.
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