def within_ts_range(sts, curr_ts):
    curr_ts = int(curr_ts)
    ets = sts + 3600 * 24 * 30  # hardcode 30 days
    if curr_ts >= sts and curr_ts < ets:
        return True
    else:
        return False


data_path = "../DataSet/Transition/"
graph_path = "../DataSet/GraphData/"
venue_path = "../DataSet/VenueData/"

trsn_list = VH.load_pickle_file(data_path, "sf_trsn_small_new")
time_list = VH.load_pickle_file(data_path, "sf_time_small_new")
full_venue_dict = VH.GetFullVenueDict(venue_path, "venues-CA-new.json")
category_dict = VH.load_json(venue_path, "category_map.json")
pcategory_dict = VH.load_json(venue_path, "pcategory_map.json")

vid_map = create_vid_map(trsn_list)
ts_list = TH.gen_ts_list("201201010000", "201301010000", 30)

venue_g = snap.TNEANet.New()
for ts_idx, ts in enumerate(ts_list):
    for trsn_idx, trsn in enumerate(trsn_list):
        src_ts = time_list[trsn_idx][0]  # only need check one ts
        dst_ts = time_list[trsn_idx][1]
        if within_ts_range(ts, src_ts):
            src_nid = vid_map[trsn[0]]
    c_lat = center[0]
    c_lng = center[1]
#    print lat, c_lat, lng, c_lng
#    print abs(lat-c_lat), abs(lng-c_lng)
    if abs(lat-c_lat) <= radius and abs(lng-c_lng) <= radius:
        return True
    else:
        print "catch a false"
        return False
    

data_path = '../DataSet/'
graph_path = '../DataSet/GraphData/'
venue_path = '../DataSet/VenueData/'

trsn_list = VH.load_pickle_file(data_path, 'sf_trsn')
time_list = VH.load_pickle_file(data_path, 'sf_time')

full_venue_dict = VH.GetFullVenueDict(venue_path, 'venues-CA-new.json')
category_dict = VH.load_json(venue_path, 'category_map.json')
pcategory_dict = VH.load_json(venue_path, 'pcategory_map.json')
lng_list = [GH.get_lat_lng(full_venue_dict, trsn[1]) for trsn in trsn_list]
lng_list.sort(key=lambda t:t[1], reverse=True)
print lng_list[0]
'''
vid_map = create_vid_map(trsn_list)

venue_g = snap.TNEANet.New()
lngs = []
for trsn_idx, trsn in enumerate(trsn_list):
    # only need check one vid