stream_graph.ITemporalLinkSetDF

class stream_graph.ITemporalLinkSetDF(df=None, no_duplicates=True, sort_by=None, discrete=None, weighted=None, merge_function=None, operation_functions=None)[source][source]

DataFrame implementation of ABC.ITemporalLinkSet.

Parameters
df: pandas.DataFrame or Iterable, default=None

If a DataFrame it should contain three columns for u and v and ts. If an Iterable it should produce (u, v, ts) tuples of two NodeId (int or str) and one timestamps (Real) with ts.

no_duplicates: Bool, default=False

Defines if for each link there are no duplicate timestamps.

sort_by: Any non-empty subset of [‘u’, ‘v’, ‘ts’].

The order of the DataFrame elements by which they will be produced when iterated.

discretebool, or default=None.
weightedbool, or 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.

number_of_interactions
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_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[, delta, direction])

induced_substream(self, ns)

issuperset(self, ls)

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, ns[, direction])

times_of(self[, l, direction])

closeness

ego_betweeness

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

degree_of(self, u=None, direction='out', weights=False)[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.

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]

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.

property instantaneous

Defines if the Time Set is instantaneous.

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.

property size

Returns the size of the TemporalLinkSet.

Parameters
None. Property.
Returns
sizeInt

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

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.