stream_graph
.StreamGraph¶
-
class
stream_graph.
StreamGraph
(nodeset=None, timeset=None, temporal_nodeset=None, temporal_linkset=None, discrete=None, weighted=False)[source][source]¶ A StreamGraph \(S=(T, V, W, E)\) is a collection of four elements:
\(V\), a node-set
\(T\), a time-set
\(W\subseteq T \times V\), a temporal-node-set
\(E\subseteq T \times V \otimes V\), a temporal-link-set
- Attributes
- aggregated_graph
coverage
Calculate the coverage of the stream-graph.
- data_cube
density
Calculate the density of the temporal-link-set.
- discrete
- empty
- linkset
m
Calculate the number of edges of the stream-graph.
n
Calculate the number of nodes of the stream-graph.
- nodeset
- temporal_linkset
- temporal_nodeset
- timeset
- weighted
weighted_density
Calculate the weighted density of the temporal-link-set.
Methods
density_at
(self[, t, weights])Calculate the density at a time instant inside the stream_graph.
discretize
(self[, bins, bin_size])Returns a discrete version of the current TemporalLinkSet.
induced_substream
(self, tns)Calculate the induced substream of the stream-graph from a TemporalNodeSet.
link_contribution_at
(self[, t])Calculate the contribution of a link inside the stream_graph.
link_density_of
(self[, l, weights, direction])Calculate the density of a link inside the stream_graph.
mean_degree_at
(self[, t, weights])Calculate the mean degree at a give time.
neighbor_coverage_at
(self[, u, t, …])Calculate the coverage of a node inside the stream_graph.
node_contribution_at
(self[, t])Calculate the node contribution at a time instant inside the stream_graph.
node_contribution_of
(self[, u])Calculate the contibution of a node inside the stream_graph.
node_density_of
(self[, u, direction, weights])Calculate the node density of a node inside the stream_graph.
graph_at
issuperset
substream
-
__init__
(self, nodeset=None, timeset=None, temporal_nodeset=None, temporal_linkset=None, discrete=None, weighted=False)[source][source]¶
-
property
coverage
¶ Calculate the coverage of the stream-graph.
- Parameters
- None. Property.
- Returns
- ns_coverageReal
Returns \(c(S)=\frac{|W|}{|V\times T|}\)
-
property
density
¶ Calculate the density of the temporal-link-set.
- Parameters
- None. Property.
- Returns
- ns_coverageReal
Returns \(\delta(S) = \frac{|E|}{\sum_{uv \in V\times V}|T_{u} \cap T_{v}|}\)
-
density_at
(self, t=None, weights=False)[source][source]¶ Calculate the density at a time instant inside the stream_graph.
- Parameters
- t: time or None
- Returns
- link_coverageReal or TimeCollection
Returns \(l_{t}=\frac{|E_{t}|}{V(t)*(V(t)-1)}\). Returns the time collection for each link at each time-event.
-
discretize
(self, bins=None, bin_size=None)[source][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.
-
induced_substream
(self, tns)[source][source]¶ Calculate the induced substream of the stream-graph from a TemporalNodeSet.
- Parameters
- tns: TemporalNodeSet
- Returns
- stream_graphStreamGrpah
Returns the induced substream.
-
link_contribution_at
(self, t=None)[source][source]¶ Calculate the contribution of a link inside the stream_graph.
- Parameters
- t: time or None
- Returns
- node_coverageReal or TimeCollection
Returns \(l_{t}=\frac{|E_{t}|}{|V*(V-1)|}\). If None returns the time coverage for each node at each time-event.
-
link_density_of
(self, l=None, weights=False, direction='out')[source][source]¶ Calculate the density of a link inside the stream_graph.
- Parameters
- l: (NodeId, NodeId) or None
- direction: ‘in’, ‘out’ or ‘both’, default=’out’
- Returns
- time_coverageReal or LinkCollection
Returns \(\frac{|T_{uv}|}{|T_{u} \cap T_{v}|}\). If l is None, returns a dictionary of all links and their coverages.
-
property
m
¶ Calculate the number of edges of the stream-graph.
- Parameters
- None. Property.
- Returns
- nReal
Returns \(\frac{|E|}{|T|}\)
-
mean_degree_at
(self, t=None, weights=False)[source][source]¶ Calculate the mean degree at a give time.
- Parameters
- t: Time or None
- Returns
- time_coverageReal or TimeCollection
Returns \(\frac{|E_{t}|}{|V_{t}|}\) Returns mean degree at each time t.
-
property
n
¶ Calculate the number of nodes of the stream-graph.
- Parameters
- None. Property.
- Returns
- nReal
Returns \(\frac{|W|}{|T|}\)
-
neighbor_coverage_at
(self, u=None, t=None, direction='out', weights=False)[source][source]¶ Calculate the coverage of a node inside the stream_graph.
- Parameters
- u: NodeId or None
- t: Time or None
- direction: ‘in’, ‘out’ or ‘both’, default=’out’
- Returns
- time_coverageReal
Returns \(\frac{|N_{t}(u)|}{|V(t)|}\). If u is None return the neighbor coverage for each node at time t. If t is None return the neighbor coverage for node u for all time-events. If u and t are None return the neighbor coverage for each node at each time-event.
-
node_contribution_at
(self, t=None)[source][source]¶ Calculate the node contribution at a time instant inside the stream_graph.
- Parameters
- t: time or None
- Returns
- node_coverageReal or TimeCollection
Returns \(k_{t}=\frac{|V_{t}|}{|V|}\). If None returns the time coverage for each node at each time-event.
-
node_contribution_of
(self, u=None)[source][source]¶ Calculate the contibution of a node inside the stream_graph.
- Parameters
- u: NodeId or None
- Returns
- time_coverage_nodeReal or NodeCollection(Real)
Returns \(n_{u}=\frac{|T_{u}|}{|T|}\). If u is None, returns a dictionary of all nodes and their coverages.
-
node_density_of
(self, u=None, direction='out', weights=False)[source][source]¶ Calculate the node density of a node inside the stream_graph.
- Parameters
- u: NodeId or None
- direction: ‘in’, ‘out’ or ‘both’, default=’out’
- weigths: bool, default=False
- Returns
- neighbor_coverageReal or dict
Returns \(\frac{\sum_{u\in V, u\neq v}|T_{uv}|}{\sum_{v\in V, v\neq u}{|T_{u}\cap T_{v}|}}\) If u is None, returns a dictionary of all nodes and their neighbor coverages.
-
property
weighted_density
¶ Calculate the weighted density of the temporal-link-set.
- Parameters
- None. Property.
- Returns
- ns_coverageReal
Returns \(\delta_{w}(S)\frac{|E_{w}|}{\sum_{uv \in V\times V}|T_{u} \cap T_{v}|}\)