python/data_mining/graph.py
def put(self, edge):
        """Process next item (graph edge) in the stream.

        Args:
            edge ((int, int)): an _added edge_ connecting nodes edge[0] and edge[1].

        Combination of main loop and `SampleEdge` function in [1]: Algorithm 1.
        """
        self.t += 1
        if self.t <= self.size:
            self.reservoir.put_edge(edge)
            self.update_counters(self.ADD, edge)
        elif with_probability(self.size / self.t):
            remove_edge = random.sample(self.reservoir.edges, 1)[0]
            self.reservoir.pop_edge(remove_edge)
            self.update_counters(self.REMOVE, remove_edge)
            self.reservoir.put_edge(edge)
            self.update_counters(self.ADD, edge)
        else:
            pass
Process next item (graph edge) in the stream.

        Args:
            edge ((int, int)): an _added edge_ connecting nodes edge[0] and edge[1].

        Combination of main loop and `SampleEdge` function in [1]: Algorithm 1.
        
Process next item (graph edge) in the stream.
Process next item ( graph edge ) in the stream .
def put(self, edge):
        self.t += 1
        if self.t <= self.size:
            self.reservoir.put_edge(edge)
            self.update_counters(self.ADD, edge)
        elif with_probability(self.size / self.t):
            remove_edge = random.sample(self.reservoir.edges, 1)[0]
            self.reservoir.pop_edge(remove_edge)
            self.update_counters(self.REMOVE, remove_edge)
            self.reservoir.put_edge(edge)
            self.update_counters(self.ADD, edge)
        else:
            pass
def put ( self , edge ) : self . t += 1 if self . t <= self . size : self . reservoir . put_edge ( edge ) self . update_counters ( self . ADD , edge ) elif with_probability ( self . size / self . t ) : remove_edge = random . sample ( self . reservoir . edges , 1 ) [ 0 ] self . reservoir . pop_edge ( remove_edge ) self . update_counters ( self . REMOVE , remove_edge ) self . reservoir . put_edge ( edge ) self . update_counters ( self . ADD , edge ) else : pass
Process next item (graph edge) in the stream.
Process next item ( graph edge ) in the stream .
"""Process next item (graph edge) in the stream.

        Args:
            edge ((int, int)): an _added edge_ connecting nodes edge[0] and edge[1].

        Combination of main loop and `SampleEdge` function in [1]: Algorithm 1.
        """
self
edge
an _added edge_ connecting nodes edge[0] and edge[1].
an _added edge_ connecting nodes edge [ 0 ] and edge [ 1 ] .