Пример #1
0
def init_scudict():
    global scu_dict
    global scu_file_path
    global pyr_id
    if scu_file_path == "":
        print 'setting default scu path in gwmin.py'
        scu_file_path = os.path.join(config.scu_path, "scu")
    if pyr_id == "":
        print 'setting default pyramid name in gwmin.py'
        pyr_id = "12_10_09_MATTER.pyr"
    # scu_dict = getSCU("12_10_09_MATTER.pyr", "/Users/ananyapoddar/Desktop/ResearchProject, Spring 2015/TestCode/scu_YINGHUI/scu")
    scu_dict = getSCU(pyr_id, scu_file_path)

    # Adding max. values to scu-dictionary for sentence id's
    for i in xrange(-50, 0):
        scu_dict[i] = 5
"""
Example/Dummy input:
Graph = {
'A' : [1, 5],
'B' : [2, 4],
'C' : [2, 3],
'D' : [3],
'E' : [1, 4, 5]
}
"""
import sys

# scu_dict = {1:5, 2:5, 3:4, 4:4, 5:3} # Dummy scu_dict #
from data_analytics import getSCU
scu_dict = getSCU("12_10_09_MATTER.pyr", "/Users/ananyapoddar/Desktop/ResearchProject, Spring 2015/TestCode/scu_YINGHUI/scu")

# Adding max. values to scu-dictionary for sentence id's
for i in xrange(-18, 0):
	scu_dict[i] = 5



""" Algo_type = 1 : greedy algo 1 using den = degree + 1 | Algo_type = 2 : greedy algo 2 using den = weight(neighborhood) 
Default is algo_type = 2"""
algo_type = 0 # 1 / 2

class Vertex(object):
	def __init__(self, name, elements):
		self.name = name
		self.scu_ids = elements
		self.weight = self.__get_weight() # -- #