stream_graph.ABC
.TemporalNodeSet¶
-
class
stream_graph.ABC.
TemporalNodeSet
[source][source]¶ TemporalNodeSet Object API Specification.
A TemporalNodeSet can be abstractly be defined as a set of nodes
u
associated with a set of time intervals(ts, tf)
.- Attributes
discrete
Designate if the TemporalNodeSet is on discrete Time.
instantaneous
Defines if the Time Set is instantaneous.
n
Returns number of nodes of the TemporalNodeSet.
nodeset
Return the nodeset that can be derived from this TemporalNodeSet.
size
Returns the size of the TemporalNodeSet.
timeset
Return the timeset that can be derived from this TemporalNodeSet.
total_common_time
Returns the total time that each node shares with all the other nodes of the TemporalNodeSet.
total_time
Returns the size of the derived TimeSet.
Methods
common_time
(self[, u])Returns the common_time between a node and one other or all.
common_time_pair
(self[, l])Returns the common_time between a pair of nodes.
copy
(self[, deep])Returns a deep or shallow copy of the current TemporalNodeSet.
discretize
(self[, bins, bin_size])Returns a discrete version of the current TemporalNodeSet.
duration_of
(self[, u])Returns the duration of a node.
issuperset
(self, ns)Check if a temporal_nodeset contains another temporal_nodeset.
n_at
(self[, t])Returns number of nodes of the TemporalNodeSet at a certain time.
nodes_at
(self[, t])Return the nodes at a certain time.
times_of
(self[, u])Returns TimeSet that a nodes appears in the TemporalNodeSet.
-
abstract
__and__
(self, ns)[source][source]¶ Implementation of the
&
operator for a TemporalNodeSet object.- Parameters
- nsTemporalNodeSet
- Returns
- outTemporalNodeSet
Returns the intersection of Nodes at Intervals.
-
abstract
__bool__
(self)[source][source]¶ Implementation of the
bool
casting of a TemporalNodeSet object.- Parameters
- None.
- Returns
- outBool
Return True if an object is both initialized and contains information.
-
__class__
[source]¶ alias of
abc.ABCMeta
-
abstract
__contains__
(self, u)[source][source]¶ Implementation of the
in
operator for LinkStream.- Parameters
- ltuple, len(l) == 2
l[0] :
u
or None l[1] :t
or(ts, tf)
or None
- Returns
- containsBool
Returns True if a node
u
exists att
or through all(ts, tf)
. If an element isNone
,in
will return True if the other elements matches. If both elements areNone
output will be None.
-
__delattr__
(self, name, /)¶ Implement delattr(self, name).
-
__dir__
()¶ default dir() implementation
-
__eq__
(self, value, /)¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
(self, value, /)¶ Return self>=value.
-
__getattribute__
(self, name, /)¶ Return getattr(self, name).
-
__gt__
(self, value, /)¶ Return self>value.
-
__hash__
(self, /)¶ Return hash(self).
-
__init__
(self, /, *args, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
abstract
__iter__
(self)[source][source]¶ Implementation of the
iter
function for a TemporalNodeSet object.- Parameters
- None
- Returns
- outIterator of tuple
Each tuple is of the form
(u, ts, tf)
.
-
__le__
(self, value, /)¶ Return self<=value.
-
__lt__
(self, value, /)¶ Return self<value.
-
__ne__
(self, value, /)¶ Return self!=value.
-
__new__
(*args, **kwargs)¶ Create and return a new object. See help(type) for accurate signature.
-
abstract
__or__
(self, ns)[source][source]¶ Implementation of the
|
operator for a TemporalNodeSet object.- Parameters
- nsTemporalNodeSet
- Returns
- outTemporalNodeSet
Returns the union of Nodes at Intervals.
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
(self, /)¶ Return repr(self).
-
__setattr__
(self, name, value, /)¶ Implement setattr(self, name, value).
-
__sizeof__
()¶ size of object in memory, in bytes
-
abstract
__sub__
(self, ns)[source][source]¶ Implementation of the
-
operator for a TemporalNodeSet object.- Parameters
- nsTemporalNodeSet
- Returns
- outTemporalNodeSet
Returns the difference of Nodes at Intervals.
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__
¶ list of weak references to the object (if defined)
-
abstract
common_time
(self, u=None)[source][source]¶ Returns the common_time between a node and one other or all.
- Parameters
- uNode_Id or set(Node_Id) or None
- Returns
- total_timeReal or NodeCollection(Real)
If
u
is a Node_Id, returns \(\sum_{v\in V,\; v\neq u} |T_{u} \cap T_{v}|\). If None it returns a NodeCollection of \(\sum_{v\in V,\; v\neq u} |T_{u} \cap T_{v}|\) for each u. If u is a set of Node_Id the above is restricted onto the provided Nodes.
-
abstract
common_time_pair
(self, l=None)[source][source]¶ Returns the common_time between a pair of nodes.
- Parameters
- l(Node_Id, Node_Id) or set((Node_Id, Node_Id)) or None
- Returns
- total_timeReal or LinkCollection(Real)
If l is (Node_Id, Node_Id), return \(|T_{u} \cap T_{v}|\). If None, return a LinkCollection for all (u, v) with \(|T_{u} \cap T_{v}|\). If u is a set of Node_Id the above is restricted onto the provided Node airs.
-
copy
(self, deep=True)[source][source]¶ Returns a deep or shallow copy of the current TemporalNodeSet.
- Parameters
- deepBool
- Returns
- temporal_nodeset_copyTemporalNodeSet
Returns a deep or shallow copy of the current TemporalNodeSet.
-
abstract property
discrete
¶ Designate if the TemporalNodeSet is on discrete Time.
- Parameters
- None. Property.
- Returns
- discreteBool or None
True if the time is discrete. Returns None if empty.
-
discretize
(self, bins=None, bin_size=None)[source][source]¶ Returns a discrete version of the current TemporalNodeSet.
- Parameters
- binsIterable or None.
If None, step should be provided. If Iterable it should contain n+1 elements that declare the start and the end of all (continuous) bins.
- bin_sizeInt or datetime
If bins is provided this argument is ommited. Else declare the size of each bin.
- Returns
- timeset_discreteTimeSet
Returns a discrete version of the TimeSet.
- binslist
A list of the created bins.
-
duration_of
(self, u=None)[source][source]¶ Returns the duration of a node.
- Parameters
- uNode_Id or None
- Returns
- durationReal or NodeCollection(Real)
The total amount of time that a node exist. If None, returns a NodeCollection with the durations for all nodes in the temporal_nodeset.
-
property
instantaneous
¶ Defines if the Time Set is instantaneous.
-
abstract
issuperset
(self, ns)[source][source]¶ Check if a temporal_nodeset contains another temporal_nodeset.
- Parameters
- nsTemporalNodeSet
- Returns
- issuperset_fBool
True if all nodes of ns appear in same or lesser intervals.
-
property
n
¶ Returns number of nodes of the TemporalNodeSet.
- Parameters
- None. Property.
- Returns
- nInt
Returns the number of distinct nodes in the TemporalNodeSet.
-
n_at
(self, t=None)[source][source]¶ Returns number of nodes of the TemporalNodeSet at a certain time.
- Parameters
- tReal
- Returns
- nInt or TimeCollection(Int)
Returns the number of active nodes at time
t
. If None returns an iterator of tuples containing a timestamp and an Int.
-
abstract
nodes_at
(self, t=None)[source][source]¶ Return the nodes at a certain time.
- Parameters
- tReal or None
- Returns
- nodesNodeSet or TimeGenerator(NodeSet)
Active nodes at time t. If None returns an TimeGenerator of tuples containing a timestamp and a NodeSet.
-
abstract property
nodeset
¶ Return the nodeset that can be derived from this TemporalNodeSet.
- Parameters
- None. Property.
- Returns
- nodesetNodeSet
Returns all the distinct nodes that appear inside the TemporalNodeSet.
-
abstract property
size
¶ Returns the size of the TemporalNodeSet.
- Parameters
- None. Property.
- Returns
- sizeReal
The size \(\sum_{u} |T_{u}|\) of the stream_graph.
-
abstract
times_of
(self, u=None)[source][source]¶ Returns TimeSet that a nodes appears in the TemporalNodeSet.
- Parameters
- uNode_Id or None
- Returns
- timesetTimeSet or NodeCollection(TimeSet)
Returns the times that node
u
exists. Return a NodeCollection of the TimeSet for each node u.
-
abstract property
timeset
¶ Return the timeset that can be derived from this TemporalNodeSet.
- Parameters
- None. Property.
- Returns
- timesetTimeSet
Returns all the times that nodes appear inside the TemporalNodeSet.
-
abstract property
total_common_time
¶ Returns the total time that each node shares with all the other nodes of the TemporalNodeSet.
- Parameters
- None. Property.
- Returns
- sizeReal
The size \(\sum_{uv\in V\otimes V} |T_{u} \cap T_{v}|\) of the stream_graph.
-
property
total_time
¶ Returns the size of the derived TimeSet.
- Parameters
- None. Property.
- Returns
- total_timeReal
The total amount of time from the union of intervals that nodes exist.