stream_graph
.TemporalLinkSetDF¶
-
class
stream_graph.
TemporalLinkSetDF
(df=None, disjoint_intervals=True, sort_by=None, discrete=None, weighted=False, default_closed=None, merge_function=None, operation_functions=None)[source][source]¶ DataFrame implementation of ABC.TemporalLinkSet
- Parameters
- df: pandas.DataFrame or Iterable, default=None
If a DataFrame it should contain four columns for u and v and ts, tf. If an Iterable it should produce
(u, v, ts, tf)
tuples of two NodeId (int or str) and two timestamps (Real) withts < tf
.- disjoint_intervals: Bool, default=False
Defines if for each link all intervals are disjoint.
- sort_by: Any non-empty subset of [‘u’, ‘v’, ‘ts’, ‘tf’].
The order of the DataFrame elements by which they will be produced when iterated.
- discretebool, or default=None.
- weightedbool, or default=None.
- default_closed{‘left’, ‘right’, ‘both’, ‘neither’}, default=None
- merge_functionA function applied to a list of arguments.
- operation_functions: dict {str: fun}
A dictionary of names of operations, i.e.
union/u
,intersection/i
,difference/d
, :code:`issuperset/s’. All function should be applicable between two weights. Default: +, min, hinge_loss (ignoring an interval on zero), operator.ge (ignoring an interval on zero)
- Attributes
as_stream_graph_basic
Generate the basic stream graph containing this TemporalLinkSet.
as_stream_graph_minimal
Generate the minimal stream graph containing this TemporalNodeSet.
basic_temporal_nodeset
Return the basic temporal_nodeset that contains the temporal-linkstream.
- df
discrete
Designate if the TemporalLinkSet is on discrete Time.
instantaneous
Defines if the Time Set is instantaneous.
- is_sorted_
linkset
Return the linkset that can be derived from the TemporalLinkSet.
m
Returns number of links of the TemporalLinkSet.
minimal_temporal_nodeset
Return the minimal temporal_nodeset that can be derived from the temporal-linkstream.
nodeset
Return the nodeset that can be derived from the TemporalLinkSet.
size
Returns the size of the TemporalLinkSet.
- sort_
- sort_by
- sorted_df
timeset
Return the timeset that can be derived from the TemporalLinkSet.
weighted
Designate if the TemporalLinkSet is weighted.
weighted_size
Returns the size of the TemporalLinkSet.
Methods
copy
(self[, deep])Returns a deep or shallow copy of the current TemporalLinkSet.
degree_at
(self[, u, t, direction, weights])Return the degree of a node at a certain time.
degree_of
(self[, u, direction, weights])discretize
(self[, bins, bin_size])Returns a discrete version of the current TemporalLinkSet.
duration_of
(self[, l, weights, direction])filter
(self, fun)Filter the link stream.
get_maximal_cliques
(self[, direction])induced_substream
(self, tns)issuperset
(self, tls)links_at
(self[, t])m_at
(self[, t, weights])Returns the number of links appearing at a certain time.
neighbors_at
(self[, u, t, direction])neighbors_of
(self[, u, direction])sort_df
(self, sort_by)Retrieve, store if no-order and produce a sorted version of the df
substream
(self[, nsu, nsv, ts])temporal_neighborhood
(self, tns[, direction])times_of
(self[, l, direction])-
__class__
[source]¶ alias of
abc.ABCMeta
-
__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_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__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.
-
__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
-
__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)
-
property
as_stream_graph_basic
¶ Generate the basic stream graph containing this TemporalLinkSet.
- Parameters
- None. Property.
- Returns
- stream_graphStreamGraph
Generates a StreamGraph containing the basic temporal_nodeset and time range that contain this TemporalLinkSet.
-
property
as_stream_graph_minimal
¶ Generate the minimal stream graph containing this TemporalNodeSet.
- Parameters
- None. Property.
- Returns
- stream_graphStreamGraph
Generate the StreamGraph containing the minimal TemporalNodeSet and the minimal TimeSet.
-
copy
(self, deep=True)[source]¶ Returns a deep or shallow copy of the current TemporalLinkSet.
- Parameters
- deepBool
- Returns
- temporal-linkstream_copyTemporalLinkSet
Returns a deep or shallow copy of the current TemporalLinkSet.
-
degree_at
(self, u=None, t=None, direction='out', weights=False)[source]¶ Return the degree of a node at a certain time.
- Parameters
- uNode_Id or None
- tReal, or tuple with len(t)==2 or None
TimeStamp or Interval.
- directionstring={‘in’, ‘out’, ‘both’}, default=’both’
- weightsbool, default=False
- Returns
- nodesetNodeSet or NodeCollection or TimeGenerator or NodeCollection(TimeCollection)
Return the (‘in’, ‘out’ or ‘both’) degree of node at a certain time(s). If u is None return the degree for each node at time t. If t is None return the degree for node u for all times. If u and t are None return the degree for each node at its time instant.
-
discretize
(self, bins=None, bin_size=None)[source]¶ Returns a discrete version of the current TemporalLinkSet.
- 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.
-
filter
(self, fun)[source]¶ Filter the link stream.
- Parameters
- funfunction
A function that for each a tuple as it is defined from iter, return True or False.
- Returns
- temporal_linkstreamTemporalLinkSet
Return sub-linkstream that satisfies the function.
-
property
instantaneous
¶ Defines if the Time Set is instantaneous.
-
m_at
(self, t=None, weights=False)[source]¶ Returns the number of links appearing at a certain time.
- Parameters
- tInt
- weightsbool, default=False
- Returns
- mInt
Returns the numer of links at a certain time.
-
sort_df
(self, sort_by)[source][source]¶ Retrieve, store if no-order and produce a sorted version of the df
-
property
weighted_size
¶ Returns the size of the TemporalLinkSet.
- Parameters
- None. Property.
- Returns
- sizeReal
The size \(\sum_{uv} w_{uv}|T_{uv}|\) of the stream_graph.