stream_graph.ABC.ITemporalLinkSet

class stream_graph.ABC.ITemporalLinkSet[source][source]

Instantaneous Temporal LinkSet Object API Specification.

A ITemporalLinkSet can be abstractly be defined as a set of links (u, v) associated with a timestamp ts.

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.

discrete

Designate if the TemporalLinkSet is on discrete Time.

instantaneous

Defines if the Time Set is instantaneous.

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.

number_of_interactions
size

Returns the size of the TemporalLinkSet.

timeset

Return the timeset that can be derived from the TemporalLinkSet.

weighted

Designate if the TemporalLinkSet is weighted.

weighted_number_of_interactions
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])

Return the time-degree of a node at a certain time.

discretize(self[, bins, bin_size])

Returns a discrete version of the current TemporalLinkSet.

duration_of(self[, l, direction, weights])

Returns the total duration of a link.

filter(self, fun)

Filter the link stream.

get_maximal_cliques(self[, direction])

Returns the maximal cliques of the temporal-linkstream.

induced_substream(self, ns)

Returns the induced substream from a TemporalNodeSet.

issuperset(self, ls)

Check if a TemporalLinkSet contains another TemporalLinkSet.

links_at([t])

Return the links at a certain time.

m_at(self[, t, weights])

Returns the number of links appearing at a certain time.

neighbors_at(self[, u, t, direction])

Return the NodeSet of neighbors of node at a certain time.

neighbors_of(self[, u, direction])

Return the temporal_nodeset of a neighbors of a node.

substream(self[, nsu, nsv, ts])

Return the subtream occuring from two nodesets and a timeset.

temporal_neighborhood(self, ns[, direction])

Returns the neighborhood of a TemporalNodeSet.

times_of(self[, l, direction])

Return the times that a link appears.

abstract __and__(self, ls)[source]

Implementation of the & operator of a TemporalLinkSet object.

Parameters
lsTemporalLinkSet
Returns
outTemporalLinkSet

Returns the intersection of Links at Intervals.

abstract __bool__(self)[source]

Implementation of the bool casting of a TemporalLinkSet 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, l)[source]

Implementation of the in operator for TemporalLinkSet.

Parameters
ltuple, len(l) == 3

l[0] : u l[1] : v l[2] : t or (ts, tf)

Returns
containsBool

Returns true if the link (u, v) exists at t or through all (ts, tf).

__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]

Implementation of the iter function for a TemporalLinkSet object.

Parameters
None
Returns
outIterator of tuple

Each tuple is of the form (u, v, 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, ls)[source]

Implementation of the | operator for a TemporalLinkSet object.

Parameters
lsTemporalLinkSet
Returns
outTemporalLinkSet

Returns the union of Links 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, ls)[source]

Implementation of the - operator for a TemporalLinkSet object.

Parameters
lsTemporalLinkSet
Returns
outTemporalLinkSet

Returns the difference of Links 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)

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.

abstract property basic_temporal_nodeset

Return the basic temporal_nodeset that contains the temporal-linkstream.

Parameters
None. Property.
Returns
temporal_nodesetTemporalNodeSet

Returns a TemporalNodeSet covering all nodes of the TemporalLinkSet from minimum time to maximum time.

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.

degree_of(self, u=None, direction='out', weights=False)[source][source]

Return the time-degree of a node at a certain time.

Parameters
uNode_Id
directionstring={‘in’, ‘out’, ‘both’}, default=’both’
weightsbool, default=False
Returns
degreeNumber or LinkCollection

Return the (‘in’, ‘out’ or ‘both’) time-degree of a node. If u is None return the degree for all node at time t.

abstract property discrete

Designate if the TemporalLinkSet 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]

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.

duration_of(self, l=None, direction='out', weights=False)[source][source]

Returns the total duration of a link.

Parameters
l(Node_Id, Node_Id) or None
directionstring={‘in’, ‘out’, ‘both’}, default=’both’
Returns
timeReal or dict

Returns the the total time that link(s) (u, v)[direction=’out’], (v, u)[direction=’in’] or ‘both’ (u, v) and (v, u) appear. If l is None returns a dictionary of all links with their times.

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.

abstract get_maximal_cliques(self, direction='both')[source]

Returns the maximal cliques of the temporal-linkstream.

Parameters
directionstring={‘in’, ‘out’, ‘both’}, default=’both’
Returns
maximal_cliquesset

Returns a set of tuples containing a frozenset of clique nodes and a tuple of the interval this nodes are active.

abstract induced_substream(self, ns)[source]

Returns the induced substream from a TemporalNodeSet.

Parameters
nsTemporalNodeSet
Returns
substreamTemporalLinkSet

Returns the TemporalLinkSet with nodes that appear inside the temporal_nodeset and only for that time.

property instantaneous

Defines if the Time Set is instantaneous.

abstract issuperset(self, ls)[source]

Check if a TemporalLinkSet contains another TemporalLinkSet.

Parameters
lsTemporalLinkSet
Returns
issuperset_fBool

True if all links of ls appear in same or lesser intervals.

Return the links at a certain time.

Parameters
tReal or None
Returns
linksLinkSet or TimeGenerator(LinkSet)

Active links at time t. If t is None, return a continuous TimeGenerator of LinkSet

abstract property linkset

Return the linkset that can be derived from the TemporalLinkSet.

Parameters
None. Property.
Returns
linksetLinkSet

Returns al the links that appear in the TemporalLinkSet.

property m

Returns number of links of the TemporalLinkSet.

Parameters
None. Property.
Returns
mInt

Returns the number of links in the TemporalLinkSet.

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.

abstract property minimal_temporal_nodeset

Return the minimal temporal_nodeset that can be derived from the temporal-linkstream.

Parameters
None. Property.
Returns
temporal_nodesetTemporalNodeSet

Returns a TemporalNodeSet where each node appears only when it exists in at least one link.

abstract neighbors_at(self, u=None, t=None, direction='out')[source]

Return the NodeSet of neighbors of 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’
Returns
nodesetNodeSet or NodeCollection or TimeGenerator or NodeCollection(TimeSparseCollection)

Return the (‘in’, ‘out’ or ‘both’) neighbors of node at a certain time(s). If u is None return the NodeSet of neighbors for each node at time t. If t is None return the NodeSet of neighbors for node u for all times. If u and t are None return for each node the NodeSet of neighbors at its time instant.

abstract neighbors_of(self, u=None, direction='out')[source]

Return the temporal_nodeset of a neighbors of a node.

Parameters
uNode_Id or None
directionstring={‘in’, ‘out’, ‘both’}, default=’both’
Returns
temporal_nodesetTemporalNodeSet or NodeCollection(TemporalNodeSet)

Return the (‘in’, ‘out’ or ‘both’) temporal_nodeset of neighbors at a certain time(s). Return a dictionary of nodes as keys assigned by their neighboring temporal_nodeset.

abstract property nodeset

Return the nodeset that can be derived from the TemporalLinkSet.

Parameters
None. Property.
Returns
nodesetNodeSet

Returns all the nodes that appear in links.

property size

Returns the size of the TemporalLinkSet.

Parameters
None. Property.
Returns
sizeInt

If discrete returns total number of interactions. Else returns zero.

abstract substream(self, nsu=None, nsv=None, ts=None)[source]

Return the subtream occuring from two nodesets and a timeset.

Parameters
nsuNodeSet or None
nsvNodeSet or None
tsTimeSet or None
Returns
temporal_linkstreamTemporalLinkSet

Return substream containing starting nodes from nsu, end nodes of nsv, contained from the intersection with ts. If a nodeset is None, all nodes and considered. If a timeset is None, all time is considered.

abstract temporal_neighborhood(self, ns, direction='out')[source]

Returns the neighborhood of a TemporalNodeSet.

Parameters
nsTemporalNodeSet
directionstring={‘in’, ‘out’, ‘both’}, default=’both’
Returns
neighborhoodTemporalNodeSet

Returns the temporal_nodeset of neighbors of nodes inside ns for a set amount of time.

abstract times_of(self, l=None, direction='out')[source]

Return the times that a link appears.

Parameters
l(Node_Id, Node_Id) or None
directionstring={‘in’, ‘out’, ‘both’}, default=’both’
Returns
timesetTimeSet or LinkCollection(TimeSet)

Return the times where a link starting from u to v (direction=’out’) or from v to u (direction=’in’) or ‘both’ exist. If l is None, returns the timesets corresponding to all links

abstract property timeset

Return the timeset that can be derived from the TemporalLinkSet.

Parameters
None. Property.
Returns
timesetTimeSet

Returns all the times where there exists at least one link.

property weighted

Designate if the TemporalLinkSet is weighted.

Parameters
None. Property.
Returns
discreteBool or None

True if weighted. Returns None if empty.

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.