Blame view

MODFIRE-Prototype/res/initialize_graph.py 662 Bytes
16f90fbc   Eduardo Eloy   database and impl...
1
2
import csv, re, sqlite3

a4f37eed   Eduardo Eloy   initizalyzers for...
3
con = sqlite3.connect("database2.db")
16f90fbc   Eduardo Eloy   database and impl...
4
cur = con.cursor()
a4f37eed   Eduardo Eloy   initizalyzers for...
5
6
f = open("graph_init", "w+")
f2 = open("area_init", "w+")
16f90fbc   Eduardo Eloy   database and impl...
7
8
9
10


toWrite = ''

a4f37eed   Eduardo Eloy   initizalyzers for...
11
12

for i in range(0, 1373):
16f90fbc   Eduardo Eloy   database and impl...
13
14
	cur.execute("Select ug2 from adj where ug1 like "+str(i))
	result = cur.fetchall()
a4f37eed   Eduardo Eloy   initizalyzers for...
15
	if(result == []):
16f90fbc   Eduardo Eloy   database and impl...
16
17
18
19
20
		toWrite = "0\n"
	else:
		for j in range(0, len(result)):	
			toWrite += str(result[j]).replace(')','').replace('(','')
		toWrite = toWrite[:-1]+"\n"
a4f37eed   Eduardo Eloy   initizalyzers for...
21
	f.write(toWrite)
16f90fbc   Eduardo Eloy   database and impl...
22
	
a4f37eed   Eduardo Eloy   initizalyzers for...
23
	cur.execute("SELECT area FROM area where ug like "+str(i)) 
16f90fbc   Eduardo Eloy   database and impl...
24
	result = cur.fetchall()
a4f37eed   Eduardo Eloy   initizalyzers for...
25
26
27
28
	toWrite = str(result[0]).replace(')','').replace('(','')
	toWrite = toWrite[:-1]+"\n"
	f2.write(toWrite)
	toWrite = ''
16f90fbc   Eduardo Eloy   database and impl...