From 43979b0611e3269c1142574c4deaa7cda0582efb Mon Sep 17 00:00:00 2001 From: GrantAOConnor <125947296+GrantAOConnor@users.noreply.github.com> Date: Wed, 3 Jun 2026 18:45:47 -0700 Subject: [PATCH] Added SCC Partitioning Separate Enron graph by Strongly Connected Components --- scc.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 scc.py diff --git a/scc.py b/scc.py new file mode 100644 index 0000000..7daeac6 --- /dev/null +++ b/scc.py @@ -0,0 +1,21 @@ +import pickle +import networkx as nx + +# Use networkx strongly_connected_components() function to separate graph +with open("data/graph.pkl", "rb") as f: + G = pickle.load(f) + + SCCs = list(nx.strongly_connected_components(G)) + +# Print notable details +print(f"Number of SCCs: {len(SCCs)}") +print(f"Largest SCC size: {max(len(SCC) for SCC in SCCs)}") + +# Find SCCs with multiple vertices +counter = 0 +for SCC in SCCs: + if len(SCC) != 1: + counter += 1 + print(f"Size of SCC {counter}: {len(SCC)}") + +print(f"Number of SCCs with multiple vertices", counter)