Function vertex_clustering
has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
def vertex_clustering(json_filename, nodelist_filename, edgelist_filename, foldername, time_limit=None, ignore_lat=False):
"""
This function performs vertex clustering on the dataset passed in the parameters and saves the dendrogram resulting
from the vertex clustering as a PDF along with the visualization of the vertex cluster itself. It is recommended to
limit these graphs to 200 authors as the visualization becomes incompehensible beyond that.
Function vertex_clustering
has 26 lines of code (exceeds 25 allowed). Consider refactoring.
def vertex_clustering(json_filename, nodelist_filename, edgelist_filename, foldername, time_limit=None, ignore_lat=False):
"""
This function performs vertex clustering on the dataset passed in the parameters and saves the dendrogram resulting
from the vertex clustering as a PDF along with the visualization of the vertex cluster itself. It is recommended to
limit these graphs to 200 authors as the visualization becomes incompehensible beyond that.
Function vertex_clustering
has 6 arguments (exceeds 4 allowed). Consider refactoring.
def vertex_clustering(json_filename, nodelist_filename, edgelist_filename, foldername, time_limit=None, ignore_lat=False):
Avoid deeply nested control flow statements.
if author_graph[node['From'], to_addr] == 0:
author_graph.add_edge(node['From'], to_addr, weight=1)
else:
author_graph[node['From'], to_addr] += 1
Avoid deeply nested control flow statements.
if to_addr not in author_map:
author_map[to_addr] = index
author_graph.add_vertex(name=to_addr, label=to_addr)
index += 1
if author_graph[node['From'], to_addr] == 0:
Avoid deeply nested control flow statements.
if to_addr not in author_map:
author_map[to_addr] = index
author_graph.add_vertex(name=to_addr, label=to_addr)
index += 1
if author_graph[node['From'], to_addr] == 0:
Avoid deeply nested control flow statements.
if json_obj['Time'] < time_limit:
from_addr = email_re.search(json_obj['From'])
json_obj['From'] = from_addr.group(0) if from_addr is not None else json_obj['From']
json_obj['To'] = set(email_re.findall(json_obj['To']))
Avoid deeply nested control flow statements.
if author_graph[node['From'], to_addr] == 0:
author_graph.add_edge(node['From'], to_addr, weight=1)
else:
author_graph[node['From'], to_addr] += 1
if node['Cc'] is None:
Identical blocks of code found in 2 locations. Consider refactoring.
for i in range(1, num_vertices+1):
line = lines_in_file[i].split()
line[1] = "\"" + line[1] + "\""
del line[2:]
line.append("\n")
There are no issues that match your filters.