Temporal Network

class TemporalNetwork[source]

Base class for temporal networks

Temporal networks are networks with time-varying edges. They consist of nodes and edges, and latter can have time-varying weights.

Variables
  • nodes (list of (str or int)) – Sorted list of node names. Node names can be either strings or integers, but they all need to be of the same type.

  • times (list of (int or float)) – Sorted list of times for which we have temporal information

  • tedges (pandas.DataFrame) – Dataframe containing tedges, also called timestamped data (potentially weighted). Columns are [‘i’, ‘j’, ‘t’, (‘weight’)] and each row represents a tedge.

  • snapshots (numpy array) – Array of shape (T, N, N) storing the instantaneous values of the adjacency matrix A_{ij}(t).

Constructors

TemporalNetwork()

Base class for temporal networks

TemporalNetwork.from_tedges(tedges[, normalise])

Creates a TemporalNetwork from a dataframe of tedges

TemporalNetwork.from_edge_timeseries(...[, ...])

Creates a TemporalNetwork from a DataFrame of edge timeseries

TemporalNetwork.from_node_timeseries(...[, ...])

Creates a temporal network by combining node timeseries into edge timeseries.

TemporalNetwork.from_static_network_and_tedges(...)

Creates a temporal network by combining a static network with tedges

TemporalNetwork.from_static_network_and_edge_timeseries(...)

Creates a temporal network by combining a static network with edge timeseries

TemporalNetwork.from_static_network_and_node_timeseries(...)

Creates a temporal network by combining a static network with node timeseries

Utils

TemporalNetwork.N()

Returns the number of nodes

TemporalNetwork.T()

Returns the number of times

TemporalNetwork.shape()

Returns the shape (N,T) of the TemporalNetwork

TemporalNetwork.number_of_edges()

Returns the number of edges in the aggregated network

TemporalNetwork.is_weighted()

Returns True if tedges are weighted

TemporalNetwork.has_node(node)

Returns True if node is in the TemporalNetwork

TemporalNetwork.has_time(time)

Returns True if time is in the TemporalNetwork

TemporalNetwork.has_tedge(tedge)

Returns True if tedge is in the TemporalNetwork, regardless of its weight

Methods for nodes and edges

TemporalNetwork.add_tedges(tedges_to_add)

Adds multiple tedges (optionally weighted)

TemporalNetwork.neighbors()

Returns a dictionary of neighboring nodes in the aggregate network.

TemporalNetwork.edge_timeseries([edges])

Returns dict of edge time series.

TemporalNetwork.tedges_of_edge(edge[, ...])

Returns a filtered DataFrame containing only the tedges of edge 'edge'.

TemporalNetwork.tedges_of_node(node[, ...])

Returns a filtered DataFrame containing only the tedges of node 'node'.

TemporalNetwork.edges_aggregated()

Returns a list of edges in the aggregated network

Methods

TemporalNetwork.aggregated_network([...])

Returns a time-aggregated network as a networkx.Graph

TemporalNetwork.to_partially_temporal()

Returns a copy of the temporal network as a PartiallyTemporalNetwork

TemporalNetwork.discard_temporal_info_from_edge(edge)

Discards temporal information from 'edge' by setting its weight to a constant

TemporalNetwork.discard_temporal_info_from_node(node)

Discards temporal information from 'node' by setting the weight of its edges to a constant

Partially Temporal Network

A PartiallyTemporalNetwork is a TemporalNetwork for which we do not have temporal information about a subset of the edges. In some sense, it is in between a static and a temporal network.

class PartiallyTemporalNetwork[source]

Base class for partially temporal networks

Partially temporal networks are temporal networks for which we do not have temporal information about all edges.

Variables
  • nodes (list of (str or int)) – Sorted list of node names. Node names can be either strings or integers, but they all need to be of the same type.

  • times (list of (int or float)) – Sorted list of times for which we have temporal information

  • tedges (pandas.DataFrame) – Dataframe containing tedges (potentially weighted). Columns are [‘i’, ‘j’, ‘t’, (‘weight’)] and each row represents a tedge.

  • snapshots (numpy array) – Array of shape (T, N, N) storing the instantaneous values of the adjacency matrix A_{ij}(t).

  • temporal_nodes (list of (str or int)) – List of nodes that are part of a temporal edge

  • temporal_edges (list of tuples) – List of edges for which we have temporal information

Specific methods

It is implemented as a child class of the TemporalNetwork class, and contains the additional attributes temporal_nodes and temporal_edges and the following methods:

PartiallyTemporalNetwork.number_of_temporal_edges()

Returns the number of temporal edges in the temporal network

PartiallyTemporalNetwork.number_of_temporal_nodes()

Returns the number of temporal nodes in the temporal network

PartiallyTemporalNetwork.fraction_of_temporal_nodes()

Returns the fraction of temporal edges in the temporal network

PartiallyTemporalNetwork.fraction_of_temporal_edges()

Returns the fraction of temporal edges in the temporal network

PartiallyTemporalNetwork.temporal_neighbors()

Returns a dict of neighbors in the aggregated network that are temporal nodes