Skip to content
Snippets Groups Projects
Commit 5e6a4953 authored by Victor Zimmermann's avatar Victor Zimmermann
Browse files

Formatting.

parent 9af20889
No related branches found
No related tags found
No related merge requests found
......@@ -148,6 +148,8 @@ def induce(topic_name: str, result_list: list) -> (nx.Graph, list, dict):
node_freq_dict = json.load(node_file)
edge_freq_dict = json.load(edge_file)
edge_freq_dict = {(key1,key2):value2 for key1,value1 in edge_freq_dict.items() for key2,value2 in value1.items()}
continue
if graph_in_existence == False:
......@@ -157,6 +159,15 @@ def induce(topic_name: str, result_list: list) -> (nx.Graph, list, dict):
with open(config.graph+node_dict_name, 'w') as node_file, open(config.graph+edge_dict_name, 'w') as edge_file:
json.dump(node_freq_dict, node_file)
new_dict = dict()
for key,value in edge_freq_dict.items():
if key[0] in new_dict:
key[0].add({key[1]:value})
else:
key[0] = {key[1]:value}
edge_freq_dict = new_dict
json.dump(edge_freq_dict, edge_file)
#builds graph from these dictionaries, also applies multiple filters
......
......@@ -366,6 +366,8 @@ def induce(topic_name: str, result_list: list) -> (nx.Graph, list, dict):
node_freq_dict = json.load(node_file)
edge_freq_dict = json.load(edge_file)
edge_freq_dict = {(key1,key2):value2 for key1,value1 in edge_freq_dict.items() for key2,value2 in value1.items()}
continue
if graph_in_existence == False:
......@@ -375,6 +377,15 @@ def induce(topic_name: str, result_list: list) -> (nx.Graph, list, dict):
with open(config.graph+node_dict_name, 'w') as node_file, open(config.graph+edge_dict_name, 'w') as edge_file:
json.dump(node_freq_dict, node_file)
new_dict = dict()
for key,value in edge_freq_dict.items():
if key[0] in new_dict:
key[0].add({key[1]:value})
else:
key[0] = {key[1]:value}
edge_freq_dict = new_dict
json.dump(edge_freq_dict, edge_file)
#builds graph from these dictionaries, also applies multiple filters
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment