(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.
Constructor that generates a temporal network instance.
Constructor that generates a temporal network instance .
def __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.
        """

        ## A list of time-stamped edges of this temporal network
        self.tedges = []        

        ## A list of nodes of this temporal network
        self.nodes = []

        ## A dictionary storing all time-stamped links, indexed by time-stamps
        self.time = _co.defaultdict( lambda: list() )

        ## A dictionary storing all time-stamped links, indexed by time and target node
        self.targets = _co.defaultdict( lambda: dict() )

        ## A dictionary storing all time-stamped links, indexed by time and source node 
        self.sources = _co.defaultdict( lambda: dict() )

        ## A dictionary storing time stamps at which links (v,*;t) originate from node v
        self.activities = _co.defaultdict( lambda: list() )

        ## 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!
        self.activities_sets = _co.defaultdict( lambda: set() )

        ## An ordered list of time-stamps
        self.ordered_times = []        

        nodes_seen = _co.defaultdict( lambda:False )

        if tedges is not None:
            Log.add('Building index data structures ...')

            for e in tedges:
                self.activities_sets[e[0]].add(e[2])
                self.time[e[2]].append(e)
                self.targets[e[2]].setdefault(e[1], []).append(e)
                self.sources[e[2]].setdefault(e[0], []).append(e)
                if not nodes_seen[e[0]]:
                    nodes_seen[e[0]] = True
                if not nodes_seen[e[1]]:
                    nodes_seen[e[1]] = True
            self.tedges = tedges
            self.nodes = list(nodes_seen.keys())

            Log.add('Sorting time stamps ...')

            self.ordered_times = sorted(self.time.keys())
            for v in self.nodes:
                self.activities[v] = sorted(self.activities_sets[v])
            Log.add('finished.')
def __init__ ( self , tedges = None ) : ## A list of time-stamped edges of this temporal network self . tedges = [ ] ## A list of nodes of this temporal network self . nodes = [ ] ## A dictionary storing all time-stamped links, indexed by time-stamps self . time = _co . defaultdict ( lambda : list ( ) ) ## A dictionary storing all time-stamped links, indexed by time and target node self . targets = _co . defaultdict ( lambda : dict ( ) ) ## A dictionary storing all time-stamped links, indexed by time and source node  self . sources = _co . defaultdict ( lambda : dict ( ) ) ## A dictionary storing time stamps at which links (v,*;t) originate from node v self . activities = _co . defaultdict ( lambda : list ( ) ) ## 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! self . activities_sets = _co . defaultdict ( lambda : set ( ) ) ## An ordered list of time-stamps self . ordered_times = [ ] nodes_seen = _co . defaultdict ( lambda : False ) if tedges is not None : Log . add ( 'Building index data structures ...' ) for e in tedges : self . activities_sets [ e [ 0 ] ] . add ( e [ 2 ] ) self . time [ e [ 2 ] ] . append ( e ) self . targets [ e [ 2 ] ] . setdefault ( e [ 1 ] , [ ] ) . append ( e ) self . sources [ e [ 2 ] ] . setdefault ( e [ 0 ] , [ ] ) . append ( e ) if not nodes_seen [ e [ 0 ] ] : nodes_seen [ e [ 0 ] ] = True if not nodes_seen [ e [ 1 ] ] : nodes_seen [ e [ 1 ] ] = True self . tedges = tedges self . nodes = list ( nodes_seen . keys ( ) ) Log . add ( 'Sorting time stamps ...' ) self . ordered_times = sorted ( self . time . keys ( ) ) for v in self . nodes : self . activities [ v ] = sorted ( self . activities_sets [ v ] ) Log . add ( 'finished.' )