def __init__(self,n):
     self.average = 0.0
     self.graph = nx.random_geometric_graph(n,0.15)
     if not nx.is_connected(self.graph):
         self.graph = nx.is_connected_component_subgraphs(self.graph)[0]
     for i in range(0,len(self.graph.nodes())):
         self.initializeNode(i)
     self.average = self.average/len(self.graph.nodes())
 def __init__(self,n):
     self.realAvg = 0.0
     self.graph = nx.erdos_renyi_graph(4, 0.8, seed=None, directed=False)
     if not nx.is_connected(self.graph):
       self.graph =  nx.is_connected_component_subgraphs(self.graph)[0]
     for i in range(0,len(self.graph.nodes())):
         self.initializeNodes(i)
     self.realAvg = self.realAvg/len(self.graph.nodes())
 def __init__(self,sample):
     self.average = 0.0
     sample = "/Users/rafaelremondes/UM/MEI/Thesis/DistributedAggregationAlgortihmsSM/code/NetworkSamples/"+sample
     #self.graph = self.loadSample(sample)
     self.graph = nx.erdos_renyi_graph(1000, 0.2, seed=None, directed=False)
     if not nx.is_connected(self.graph):
         self.graph = nx.is_connected_component_subgraphs(self.graph)[0]
     for i in range(0,len(self.graph.nodes())):
         self.initializeNode(self.graph.nodes()[i])
     self.realSum = self.average
     self.average = self.average/len(self.graph.nodes())
     print self.average
     print self.realSum
 def __init__(self,sample):
     self.realAvg = 0.0
     self. realSum = 0.0
     #self.graph = nx.erdos_renyi_graph(4, 0.8, seed=None, directed=False)
     sample = "/Users/rafaelremondes/UM/MEI/Thesis/DistributedAggregationAlgortihmsSM/code/NetworkSamples/"+sample
     self.graph = utils.loadSample(sample)
     if not nx.is_connected(self.graph):
       self.graph =  nx.is_connected_component_subgraphs(self.graph)[0]
     for i in range(0,len(self.graph.nodes())):
         self.initializeNodes(self.graph.nodes()[i])
     #self.testingGraph()
     #self.realAvg = 12
     self.realAvg = self.realSum/len(self.graph.nodes())
 def __init__(self, n):
     self.graph = nx.random_geometric_graph(n, 0.8)
     if not nx.is_connected(self.graph):
         self.graph = nx.is_connected_component_subgraphs(self.graph)[0]
     for i in range(0, len(self.graph.nodes())):
         self.initNodes(i)