예제 #1
0
    Gowalla.make_connected(epsilon)

    #    for line in fileinput.input(sys.argv[1]):
    #        line = line.rstrip()
    #        line = line.split("\t")
    #        userID = line.pop(0)
    #
    #        for city1, city2 in itertools.combinations(line,2):
    #            Gowalla.add_edge(city1, city2)

    #    Gowalla.graph.remove_node("NULL,NULL")
    #    Gowalla.trim()

    for node in Gowalla.nodes():
        latd, longd = coords[node]
        Gowalla.set_coord(node, latd, longd)

    Gowalla.save(out)
#    Gowalla.draw(sys.argv[3])

loadedGraph = LocationGraph()
loadedGraph.load(out)

loadedGraph.write(out)

stats = open(out + ".stats", 'w')
stats.write("Gowalla Network Summary")
stats.write("\nNodes: " + str(Gowalla.get_nodes_size()))
stats.write("\nEdges: " + str(Gowalla.get_edges_size()))
stats.close()
예제 #2
0
#locations=pickle.load(open(sys.argv[7], 'rb'))
states = pickle.load(open(sys.argv[8], 'rb'))
#need to update with actual census data
population = {}
census = pickle.load(open(sys.argv[9], 'rb'))
total_pop = 0
for p in census:
    total_pop += census[p]

for p in census:
    population[p] = (census[p] / float(total_pop)) * n

#print population

network = LocationGraph()
network.load(sys.argv[10])
print "Dictionaries loaded."

params = str(beta) + "-" + str(shape) + "-" + str(scale)
matrix = open(sys.argv[11] + "_" + params + ".out", 'w')

countID = 0
infected = {}
recovered = []


def genID():
    global countID
    countID += 1
    return countID
예제 #3
0
#locations=pickle.load(open(sys.argv[7], 'rb'))
states = pickle.load(open(sys.argv[5], 'rb'))
#need to update with actual census data
population = {}
census = pickle.load(open(sys.argv[6], 'rb'))
total_pop = 0
for p in census:
    total_pop += census[p]

for p in census:
    population[p] = (census[p] / float(total_pop)) * n

#print population

network = LocationGraph()
network.load(sys.argv[7])
print "Dictionaries loaded."

params = str(beta) + "-" + str(shape) + "-" + str(scale)
matrix = open(sys.argv[8] + "_" + params + ".out", 'w')

countID = 0
infected = {}
latent = {}
recovered = []


def genID():
    global countID
    countID += 1
    return countID
예제 #4
0
    Gowalla.make_connected(epsilon)

#    for line in fileinput.input(sys.argv[1]):
#        line = line.rstrip()
#        line = line.split("\t")
#        userID = line.pop(0)
#
#        for city1, city2 in itertools.combinations(line,2):
#            Gowalla.add_edge(city1, city2)

#    Gowalla.graph.remove_node("NULL,NULL")
#    Gowalla.trim()

    for node in Gowalla.nodes():
        latd, longd = coords[node]
        Gowalla.set_coord(node, latd, longd)

    Gowalla.save(out)
#    Gowalla.draw(sys.argv[3])

loadedGraph = LocationGraph()
loadedGraph.load(out)

loadedGraph.write(out)

stats = open(out+".stats", 'w')
stats.write("Gowalla Network Summary")
stats.write("\nNodes: " + str(Gowalla.get_nodes_size()))
stats.write("\nEdges: " + str(Gowalla.get_edges_size()))
stats.close()
예제 #5
0
#locations=pickle.load(open(sys.argv[7], 'rb'))
states = pickle.load(open(sys.argv[8], 'rb'))
#need to update with actual census data
population = {}
census = pickle.load(open(sys.argv[9], 'rb'))
total_pop = 0
for p in census:
    total_pop += census[p]

for p in census:
    population[p] = (census[p] / float(total_pop)) * n

#print population

network = LocationGraph()
network.load(sys.argv[10])
print "Dictionaries loaded."

params = str(beta) + "-" + str(shape) + "-" + str(scale)
matrix = open(sys.argv[11]+"_"+params+".out", 'w')

countID = 0
infected = {}
recovered = []

def genID():
    global countID
    countID += 1
    return countID

#choose location based on weight probabilities
예제 #6
0
#locations=pickle.load(open(sys.argv[7], 'rb'))
states = pickle.load(open(sys.argv[5], 'rb'))
#need to update with actual census data
population = {}
census = pickle.load(open(sys.argv[6], 'rb'))
total_pop = 0
for p in census:
    total_pop += census[p]

for p in census:
    population[p] = (census[p] / float(total_pop)) * n

#print population

network = LocationGraph()
network.load(sys.argv[7])
print "Dictionaries loaded."

params = str(beta) + "-" + str(shape) + "-" + str(scale)
matrix = open(sys.argv[8]+"_"+params+".out", 'w')

countID = 0
infected = {}
latent = {}
recovered = []

def genID():
    global countID
    countID += 1
    return countID