def run(custom_conf=False): if custom_conf: conf = ask_conf() else: conf = { 'tweets_path': '../data/clean_tweets.csv', 'delta_t': 2, 'directed': False, 'n_swiss_nodes': 10, 'n_foreign_nodes': 2, 'pop_threshold': 15000, 'save_nodes': False } print('\t Generating nodes...') nodes = Node.generate_nodes(n_swiss_nodes=conf['n_swiss_nodes'], n_foreign_nodes=conf['n_foreign_nodes'], pop_threshold=conf['pop_threshold'], save=conf['save_nodes']) print('> Starting main algorithm') print('\t Filtering users with 1 single tweet...') user_tweets = filter_users(conf['tweets_path']) print('\t Detecting flows...') flows = [] for user_id, tweets in user_tweets.items(): tmp = Flow.infer_flows(user_id, tweets, nodes, conf['delta_t'], conf['directed']) flows.extend(tmp) final_flows = Flow.agg_flows(flows) print('> Result') print('{} flows detected.'.format(len(final_flows))) for f in final_flows: print(f)