|
1 | 1 | # Graph-Python-scripts |
2 | 2 |
|
3 | | -This repository contains Python scripts for parsing meeting summaries and visualizing them as directed graphs using NetworkX and Matplotlib, plus exporting to GEXF for use in Gephi. |
4 | | - |
5 | | -## Contents |
6 | | -- `Scripts/Nodes-Edges.py`: Build a directed graph from a single meeting summary and save `graph.png`. |
7 | | -- `Scripts/Nodes-Edges2.py`: Build a directed graph from multiple meeting summaries and save `graph2.png`. |
8 | | -- `Scripts/GEXF-export.py`: Build a comprehensive directed graph and export `all_workgroups_graph_sanitized.gexf`. |
9 | | -- `Scripts/count.py`: Print top-level workgroup names from the remote JSON. |
10 | | -- `Scripts/Import-JSON.py`: Generate `workgroup_meetings_summary.txt` with counts and meeting listings per workgroup. |
11 | | -- `graph.png`, `graph2.png`: Example rendered graphs. |
12 | | -- `Scripts/all_workgroups_graph_sanitized.gexf`: Example GEXF export ready for Gephi. |
13 | | - |
14 | | -## Prerequisites |
15 | | -- Python 3.9+ |
16 | | -- Packages: |
17 | | - - `requests` |
18 | | - - `networkx` |
19 | | - - `matplotlib` |
20 | | - |
21 | | -Install packages: |
| 3 | +Scripts to fetch meeting summaries, generate graphs, and produce analysis reports. |
22 | 4 |
|
| 5 | +## Quickstart |
| 6 | +1. Create a virtual environment and install dependencies: |
23 | 7 | ```bash |
24 | | -pip install requests networkx matplotlib |
| 8 | +python3 -m venv .venv |
| 9 | +source .venv/bin/activate |
| 10 | +python -m pip install --upgrade pip |
| 11 | +pip install -r requirements.txt |
25 | 12 | ``` |
26 | 13 |
|
27 | | -## Data Source |
28 | | -All scripts fetch JSON from a public URL: |
29 | | - |
30 | | -- `https://raw.githubusercontent.com/SingularityNET-Archive/SingularityNET-Archive/refs/heads/main/Data/Snet-Ambassador-Program/Meeting-Summaries/2025/meeting-summaries-array.json` |
31 | | - |
32 | | -The scripts handle both top-level list and dict JSON structures. |
33 | | - |
34 | | -## Usage |
35 | | -Run scripts from the project root or the `Scripts/` directory. |
36 | | - |
37 | | -### 1) Build a graph from a single meeting: `Scripts/Nodes-Edges.py` |
38 | | -- Purpose: Parse one meeting object and produce a directed graph of relationships among workgroup, meeting, people, documents, agenda items, action items, decision items, tags, and emotions. |
39 | | -- Output: Saves an image `graph.png` in the project root. |
40 | | - |
41 | | -Command: |
| 14 | +2. Run common tasks: |
| 15 | +- Single-meeting graph → saves `graph.png`: |
42 | 16 | ```bash |
43 | 17 | python Scripts/Nodes-Edges.py |
44 | 18 | ``` |
45 | | - |
46 | | -### 2) Build a graph from multiple meetings: `Scripts/Nodes-Edges2.py` |
47 | | -- Purpose: Iterate all meetings/workgroups and build a combined directed graph. |
48 | | -- Output: Saves `graph2.png` in the project root. |
49 | | - |
50 | | -Command: |
| 19 | +- Multi-meeting graph → saves `graph2.png`: |
51 | 20 | ```bash |
52 | 21 | python Scripts/Nodes-Edges2.py |
53 | 22 | ``` |
54 | | - |
55 | | -### 3) Export a GEXF for Gephi: `Scripts/GEXF-export.py` |
56 | | -- Purpose: Build a comprehensive, sanitized directed graph across all workgroups and export to GEXF. |
57 | | -- Output: Writes `Scripts/all_workgroups_graph_sanitized.gexf`. |
58 | | - |
59 | | -Notes: |
60 | | -- Ensures node IDs are strings and unique. |
61 | | -- Sanitizes node/edge attributes to primitive types for GEXF compatibility. |
62 | | -- Emits diagnostics (counts, sample nodes) before/after sanitization. |
63 | | - |
64 | | -Command: |
| 23 | +- Export Gephi file → writes `Scripts/all_workgroups_graph_sanitized.gexf`: |
65 | 24 | ```bash |
66 | 25 | python Scripts/GEXF-export.py |
67 | 26 | ``` |
68 | | - |
69 | | -Open the GEXF in Gephi to explore the network. |
70 | | - |
71 | | -### 4) Quick inspection of workgroups: `Scripts/count.py` |
72 | | -- Purpose: Print the `workgroup` field for each top-level item in the JSON (list or dict). |
73 | | - |
74 | | -Command: |
| 27 | +- Workgroup summary → writes `Scripts/workgroup_meetings_summary.txt`: |
75 | 28 | ```bash |
76 | | -python Scripts/count.py |
| 29 | +python Scripts/Import-JSON.py |
77 | 30 | ``` |
78 | | - |
79 | | -### 5) Generate a text summary: `Scripts/Import-JSON.py` |
80 | | -- Purpose: Create `workgroup_meetings_summary.txt` listing counts per workgroup and meeting info (date + title/type). |
81 | | -- Output: `Scripts/workgroup_meetings_summary.txt`. |
82 | | - |
83 | | -Command: |
| 31 | +- Degree (co-attendance) analysis → writes `Graph Analysis/Degree_Analysis/degree_analysis_report.md`: |
84 | 32 | ```bash |
85 | | -python Scripts/Import-JSON.py |
| 33 | +python "Graph Analysis/Degree_Analysis/degree_analysis_to_md.py" |
| 34 | +``` |
| 35 | +- JSON path structure report → writes `reports/path_analysis_report.md`: |
| 36 | +```bash |
| 37 | +python "Graph Analysis/Path_Analysis/path_analysis_report.py" |
| 38 | +``` |
| 39 | +- Field centrality report → writes `reports/centrality_analysis_report.md`: |
| 40 | +```bash |
| 41 | +python "Graph Analysis/Path_Analysis/Centrality_Analysis/json_centrality_analysis.py" |
86 | 42 | ``` |
87 | 43 |
|
88 | | -## Outputs |
89 | | -- `graph.png`: Single-meeting graph. |
90 | | -- `graph2.png`: Multi-meeting graph. |
91 | | -- `Scripts/all_workgroups_graph_sanitized.gexf`: GEXF for Gephi. |
92 | | -- `Scripts/workgroup_meetings_summary.txt`: Human-readable summary. |
| 44 | +## Repository Map |
| 45 | +- `Scripts/` — data fetching and basic graph generation. See `Scripts/README.md`. |
| 46 | +- `Graph Analysis/` — analysis utilities (degree, path, centrality). See `Graph Analysis/README.md`. |
| 47 | +- `reports/` — generated Markdown reports. See `reports/README.md`. |
93 | 48 |
|
94 | | -To preview generated images on macOS/Linux: |
| 49 | +## Data Source |
| 50 | +All scripts read from a shared public JSON: |
| 51 | +`https://raw.githubusercontent.com/SingularityNET-Archive/SingularityNET-Archive/refs/heads/main/Data/Snet-Ambassador-Program/Meeting-Summaries/2025/meeting-summaries-array.json` |
95 | 52 |
|
96 | | -```bash |
97 | | -$BROWSER graph.png |
98 | | -$BROWSER graph2.png |
99 | | -``` |
| 53 | +## Outputs |
| 54 | +- `graph.png`, `graph2.png` — rendered graphs |
| 55 | +- `Scripts/all_workgroups_graph_sanitized.gexf` — Gephi import |
| 56 | +- Markdown reports in `reports/` |
100 | 57 |
|
101 | | -## Notes |
102 | | -- All scripts are designed to run headlessly; graphs are saved to files instead of opening GUI windows. |
103 | | -- The code uses defensive accessors and type checks to tolerate missing or differently shaped fields. |
104 | | -- For reproducible layouts, the drawing functions use a fixed seed for `spring_layout` where applicable. |
| 58 | +Notes: Scripts run headlessly and save files to disk; images can be opened via your OS default viewer. |
0 commit comments