This project presents a high-level analysis plan for building and analyzing a bill cosponsorship network from the United States Congress. Using data acquired through the Congress.gov API (Library of Congress), the plan describes how to construct a network where legislators are connected by shared cosponsorship of legislation — and then compare degree centrality across categorical groups, primarily party affiliation (Democrat, Republican, Independent).
🎯 Central Research Question: Does a legislator's party affiliation predict how broadly they collaborate with colleagues through bill cosponsorship?
| Element | Description |
|---|---|
| 🟢 Nodes | Members of Congress (~535 legislators per session) |
| 🔵 Edges | Cosponsorship ties — two legislators share an edge if they cosponsored the same bill |
| ⚖️ Edge Weight | Number of bills cosponsored together (stronger weight = deeper collaboration) |
| 📊 Degree Centrality | Fraction of all other legislators a given member is directly connected to |
📁 congressional-cosponsorship-network/
│
├── 📄 Congressional_Cosponsorship_Network_Analysis_Plan.docx
│ └── Full project plan document (data source, loading steps,
│ network definition, hypothetical outcomes)
│
├── 📄 Video_Presentation_Script.docx
│ └── Narrated walkthrough script for video presentation
│
├── 📄 README.md
│ └── This file
│
└── 📁 code/ (future)
└── Jupyter notebooks and Python scripts for implementation
Congress.gov API — maintained by the Library of Congress
| Detail | Info |
|---|---|
| 🔑 Authentication | Free API key from api.data.gov |
| ⚡ Rate Limit | 5,000 requests/hour |
| 📦 Format | JSON responses with pagination support |
| 📅 Coverage | Bill and member data from the 81st Congress (1949) to present |
| Endpoint | Purpose |
|---|---|
GET /v3/member |
Retrieve all legislators with party, state, and chamber |
GET /v3/bill/{congress}/{type} |
Retrieve all bills for a Congressional session |
GET /v3/bill/{congress}/{type}/{number}/cosponsors |
Get cosponsor list for each bill |
The primary grouping variable for degree centrality comparison:
| Variable | Categories | Why It Matters |
|---|---|---|
| 🟥🟦 Party (primary) | Democrat · Republican · Independent | Does one party collaborate more broadly? |
| 🏛️ Chamber | Senate · House | Does chamber structure affect connectivity? |
| 🗺️ Region | Northeast · South · Midwest · West | Are regional caucuses more insular? |
| 📍 State | 50 states + territories | Do large delegations cluster together? |
The plan describes five predicted outcomes from comparing degree centrality across party groups:
The minority party must build cross-aisle coalitions to advance legislation, forcing broader cosponsorship networks and inflating degree centrality.
The 2–3 Independent legislators show dramatically high centrality because they cosponsor freely across both parties, acting as structural bridges.
Senate vs. House differences dominate party differences — the filibuster's 60-vote threshold forces Senators into broader collaboration patterns.
A leadership-backbencher divide emerges: committee chairs and party leaders have very high centrality while rank-and-file members cluster low.
Electoral pressure drives collaboration — legislators from competitive states cosponsor more broadly to demonstrate bipartisan appeal to voters.
| Tool | Role |
|---|---|
| 🐍 Python 3.10+ | Primary language |
| 🌐 requests | API calls with authentication and pagination |
| 🕸️ NetworkX 3.x | Graph construction and centrality computation |
| 🐼 pandas | Data wrangling and group aggregation |
| 📊 scipy / scikit-posthocs | Kruskal-Wallis, Dunn's post-hoc, Mann-Whitney U |
| 🎨 matplotlib / seaborn | Visualization (box plots, violin plots, network graphs) |
graph LR
A[🔑 API Auth] --> B[👥 Fetch Members]
B --> C[📜 Fetch Bills]
C --> D[🤝 Fetch Cosponsors]
D --> E[🔗 Build Edge List]
E --> F[🕸️ Construct NetworkX Graph]
F --> G[📊 Compute Degree Centrality]
G --> H[📈 Group by Party & Compare]
Step-by-step:
- Environment Setup — Install
requests,networkx,pandas,scipy,seaborn - Fetch Members — Pull ~535 legislators with party, state, chamber from
/v3/member - Fetch Bills & Cosponsors — For each bill, retrieve the full cosponsor list
- Build Edge List — Generate pairwise combinations from each bill's collaboration group
- Construct Graph — Load into NetworkX with party as a node attribute
- Compute Centrality —
nx.degree_centrality(G)→ group by party → compare - Statistical Testing — Kruskal-Wallis across parties, Dunn's post-hoc for pairwise
- Cache Locally — Save graph as
.graphml, DataFrames as.csv
Candace Grant M.S. Data Science — CUNY School of Professional Studies
This project is submitted as coursework for the CUNY SPS Data Science program. The data is sourced from the public domain Congress.gov API.
Built with 🐍 Python · 🕸️ NetworkX · 🏛️ Congress.gov API