#!/usr/bin/env python3 from node_ranking import ( csv_loader, build_graph, Node, ) import networkx as nx def main(): edges = csv_loader('./dist-edges.csv') g = build_graph(edges) count_map = {} for node in g: count_map[node.node] = len(list(g.successors(node))) sum_out = 0 known = Node('34.204.196.211', 9796) for k, v in count_map.items(): if k.ip == known.ip: print(f'known: {k} {v}') sum_out += v min_out = min(count_map.items(), key=lambda kv: kv[1]) max_out = max(count_map.items(), key=lambda kv: kv[1]) avg_out = float(sum_out) / len(count_map.keys()) known_out = count_map[known] print(f'avg_out: {avg_out}') print(f'min_out: {min_out}') print(f'max_out: {max_out}') print(f'known_out: {known} {known_out}') # g = build_graph(e, initial_rank=initial_rank) if __name__ == "__main__": main()