pathpy  1.0
pathpy is an OpenSource python package for the modeling and analysis of pathways and temporal networks using higher-order and multi-order graphical models
 All Classes Functions Variables
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
pathpy.TemporalNetwork.TemporalNetwork Class Reference

Public Member Functions

def __init__
 
def filterEdges
 
def addEdge
 
def vcount
 
def ecount
 
def getObservationLength
 
def getInterEventTimes
 
def getInterPathTimes
 
def summary
 
def __str__
 
def ShuffleEdges
 
def GetTemporalBetweenness
 
def GetTemporalBetweennessInstantaneous
 
def GetTemporalCloseness
 
def GetTemporalClosenessInstantaneous
 

Static Public Member Functions

def readFile
 

Public Attributes

 tedges
 A list of time-stamped edges of this temporal network.
 
 nodes
 A list of nodes of this temporal network.
 
 time
 A dictionary storing all time-stamped links, indexed by time-stamps.
 
 targets
 A dictionary storing all time-stamped links, indexed by time and target node.
 
 sources
 A dictionary storing all time-stamped links, indexed by time and source node.
 
 activities
 A dictionary storing time stamps at which links (v,*;t) originate from node v.
 
 activities_sets
 A dictionary storing sets of time stamps at which links (v,*;t) originate from node v Note that the insertion into a set is much faster than repeatedly checking whether an element already exists in a list!
 
 ordered_times
 An ordered list of time-stamps.
 

Detailed Description

This class represents a sequence of time-stamped edges.
   Instances of this class can be used to generate path statistics 
   based on the time-respecting paths resulting from a given maximum
   time difference between consecutive time-stamped edges.

Constructor & Destructor Documentation

def pathpy.TemporalNetwork.TemporalNetwork.__init__ (   self,
  tedges = None 
)
Constructor that generates a temporal network instance. 

@param tedges: an optional list of (possibly unordered time-stamped) links 
    from which to construct a temporal network instance. For the default value None        
    an empty temporal network will be created.

Member Function Documentation

def pathpy.TemporalNetwork.TemporalNetwork.__str__ (   self)
Returns the default string representation of 
this temporal network instance.
def pathpy.TemporalNetwork.TemporalNetwork.addEdge (   self,
  source,
  target,
  ts 
)
Adds a directed time-stamped edge (source,target;time) to the temporal network. To add an undirected 
    time-stamped link (u,v;t) at time t, please call addEdge(u,v;t) and addEdge(v,u;t).

@param source: name of the source node of a directed, time-stamped link
@param target: name of the target node of a directed, time-stamped link
@param ts: (integer) time-stamp of the time-stamped link
def pathpy.TemporalNetwork.TemporalNetwork.ecount (   self)
Returns the number of time-stamped edges (u,v;t) in the temporal network.
This number corresponds to the sum of link weights in the (first-order)
time-aggregated network.
def pathpy.TemporalNetwork.TemporalNetwork.filterEdges (   self,
  edge_filter 
)
Filter time-stamped edges according to a given filter expression. 

@param edge_filter: an arbitrary filter function of the form filter_func(v, w, time) that 
    returns True for time-stamped edges that shall pass the filter, and False for all edges that 
    shall be filtered out.
def pathpy.TemporalNetwork.TemporalNetwork.getInterEventTimes (   self)
Returns an array containing all time differences between any 
two consecutive time-stamped links (involving any node)
def pathpy.TemporalNetwork.TemporalNetwork.getInterPathTimes (   self)
Returns a dictionary which, for each node v, contains all time differences 
between any time-stamped link (*,v;t) and the next link (v,*;t') (t'>t)
in the temporal network
def pathpy.TemporalNetwork.TemporalNetwork.getObservationLength (   self)
Returns the length of the observation time in time units.
def pathpy.TemporalNetwork.TemporalNetwork.GetTemporalBetweenness (   t,
  delta = 1,
  normalized = False 
)
Calculates the temporal betweenness centralities of all nodes based on the shortest 
time-respecting paths with a maximum waiting time of delta. This function returns a 
numpy array of temporal betweenness centrality values of nodes.
    
@param t: the temporal network for which temporal closeness centralities will be computed    
@param delta: the maximum time difference used in the time-respecting path definition (default 1).
    Note that this parameter is independent from the delta used internally for the extraction 
    of two-paths by the class TemporalNetwork
@param normalized: whether or not to normalize centralities by dividing each value by the total 
    number of shortest time-respecting paths.
def pathpy.TemporalNetwork.TemporalNetwork.GetTemporalBetweennessInstantaneous (   t,
  start_t = 0,
  delta = 1,
  normalized = False 
)
Calculates the temporal betweennness values of 
all nodes fir a given start time start_t in an empirical temporal network t.
This function returns a numpy array of (temporal) betweenness centrality values. 
The ordering of these values corresponds to the ordering of nodes in the vertex 
sequence of the igraph first order time-aggregated network. A mapping between node names
and array indices can be found in Utilities.firstOrderNameMap().
    
@param t: the temporal network for which temporal betweenness centralities will be computed
@param start_t: the start time for which to consider time-respecting paths (default 0). This is 
    important, since any unambigious definition of a shortest time-respecting path between
    two nodes must include the time range to be considered (c.f. Holme and Saramäki, Phys. Rep., 2012)
@param delta: the maximum waiting time used in the time-respecting path definition (default 1)
    Note that this parameter is independent from the delta used internally for the extraction of two-paths
    by the class TemporalNetwork
@param normalized: whether or not to normalize the temporal betweenness centrality values by
    dividing by the number of all shortest time-respecting paths in the temporal network.
def pathpy.TemporalNetwork.TemporalNetwork.GetTemporalCloseness (   t,
  delta = 1 
)
Calculates the temporal closeness centralities of all nodes based on the minimal 
shortest time-respecting paths with a maximum time difference of delta. This function 
returns a numpy array of average (temporal) closeness centrality values of nodes.
    
@param t: the temporal network for which temporal closeness centralities will be computed   
@param delta: the maximum waiting time used in the time-respecting path definition (default 1)            
def pathpy.TemporalNetwork.TemporalNetwork.GetTemporalClosenessInstantaneous (   t,
  start_t = 0,
  delta = 1 
)
Calculates the temporal closeness values of all nodes for a given start time start_t.
This function returns a numpy array of (temporal) closeness centrality values.        
    
@param t: the temporal network for which temporal closeness centralities will be computed
@param start_t: the start time for which to consider time-respecting paths (default 0). This is 
    important, since any unambigious definition of a shortest time-respecting path between
    two nodes must include the time range to be considered (c.f. Holme and Saramäki, Phys. Rep., 2012)
@param delta: the maximum time difference time used in the time-respecting path definition (default 1)
    Note that this parameter is independent from the delta used internally for the extraction of two-paths
    by the class TemporalNetwork.
def pathpy.TemporalNetwork.TemporalNetwork.readFile (   filename,
  sep = ',
  timestampformat = "%Y-%m-%d %H:%M",
  maxlines = _sys.maxsize 
)
static
Reads time-stamped links from a file and returns a new instance 
    of the class TemporalNetwork. The file is assumed to have a header 

source target time 

    where columns can be in arbitrary order and separated by arbitrary characters. 
    Each time-stamped link must occur in a separate line and links are assumed to be
    directed.
     
    The time column can be omitted and in this case all links are assumed to occur 
    in consecutive time stamps (that have a distance of one). Time stamps can be simple 
    integers, or strings to be converted to UNIX time stamps via a custom timestamp format. 
    For this, the python function datetime.strptime will be used. 

    @param sep: the character that separates columns 
    @param filename: path of the file to read from
    @param timestampformat: used to convert string timestamps to UNIX timestamps. This parameter is 
ignored, if the timestamps are digit types (like a simple int).
    @param maxlines: limit reading of file to certain number of lines, default sys.maxsize
def pathpy.TemporalNetwork.TemporalNetwork.ShuffleEdges (   self,
  l = 0,
  with_replacement = False 
)
Generates a shuffled version of the temporal network in which edge statistics (i.e.
the frequencies of time-stamped edges) are preserved, while all order correlations are 
destroyed. The shuffling procedure randomly reshuffles the time-stamps of links.

@param l: the length of the sequence to be generated (i.e. the number of time-stamped links.
    For the default value l=0, the length of the generated shuffled temporal network will be 
    equal to that of the original temporal network. 
@param with_replacement: Whether or not the sampling should be with replacement (default False)
def pathpy.TemporalNetwork.TemporalNetwork.summary (   self)
Returns a string containing basic summary statistics of this temporal network
def pathpy.TemporalNetwork.TemporalNetwork.vcount (   self)
Returns the number of vertices in the temporal network. 
This number corresponds to the number of nodes in the (first-order) 
time-aggregated network.

The documentation for this class was generated from the following file: