Skip to content

Commit

Permalink
pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
KeenanRileyFaulkner committed Nov 1, 2024
1 parent 705feda commit 2f77374
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 6 additions & 2 deletions bfasst/utils/accumulate_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def main():


def get_args():
"""Get the command line arguments."""
parser = argparse.ArgumentParser(description="Compute metrics on a graph.")
parser.add_argument(
"analysis_dir", help="The path to the folder containing all analysis files for all graphs."
Expand All @@ -57,6 +58,7 @@ def get_args():


def compute_master_metrics(analysis_dir, master_metrics_output, stats_summary_output):
"""Compute the master metrics from the analysis directory."""
master_metrics = {}
for file in Path(analysis_dir).iterdir():
if file.is_dir():
Expand Down Expand Up @@ -100,9 +102,10 @@ def sort_metrics(metrics):
return metrics


def get_stats_summary(metrics):
def get_stats_summary(master_metrics):
"""Compute the 5-number summary, mean, and standard deviation for each metric."""
summary = {}
for ip, metrics in metrics.items():
for ip, metrics in master_metrics.items():
for metric, values in metrics.items():
# Calculate statistics
if values: # Check if the list is not empty
Expand All @@ -129,6 +132,7 @@ def get_stats_summary(metrics):


def five_number_summary(data):
"""Compute the 5-number summary for the given data."""
n = len(data)
min_val = data[0]
max_val = data[-1]
Expand Down
9 changes: 5 additions & 4 deletions bfasst/utils/process_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ def compute_metrics_per_ip(adj_lists, args):
metrics_per_ip[ip]["local_clustering_coeff"].append(local_clustering)

# Debug (verbose flag only)
logger.debug(f"IP: {ip}")
logger.debug(f"Component: {label}")
logger.debug(f"Nodes: {len(adj_list)}")
logger.debug(f"Edges: {edge_count}")
logger.debug("IP: %s", ip)
logger.debug("Component: %s", label)
logger.debug("Nodes: %s", len(adj_list))
logger.debug("Edges: %s", edge_count)
logger.debug("")

return metrics_per_ip
Expand All @@ -200,6 +200,7 @@ def compute_size(adj_list):


def compute_average_diameter(adj_list):
"""Compute the average diameter of a graph."""
uf = UnionFind()

for u in adj_list:
Expand Down

0 comments on commit 2f77374

Please sign in to comment.