https://github.com/edent/twitter-networks
Create a directed network of Twitter followers.
https://github.com/edent/twitter-networks
Last synced: 4 months ago
JSON representation
Create a directed network of Twitter followers.
- Host: GitHub
- URL: https://github.com/edent/twitter-networks
- Owner: edent
- License: mit
- Created: 2015-03-26T14:25:01.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2022-01-13T15:09:07.000Z (over 4 years ago)
- Last Synced: 2025-06-30T02:06:49.267Z (12 months ago)
- Language: Python
- Size: 7.81 KB
- Stars: 70
- Watchers: 8
- Forks: 21
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Twitter Network Graphs
Create a directed network of Twitter followers.
Based on https://shkspr.mobi/blog/2015/03/this-is-what-a-graph-of-8000-fake-twitter-accounts-looks-like/
These scripts work in three parts.
1. Taking an initial user, download information about who they follow. Repeat recursively.
2. Generate a directed graph.
3. Draw an image of the graph.
[](https://ko-fi.com/edent)
## Usage
### Extract The Information
* Choose the user you wish to track - for example `@edent`.
* Decide what recursive depth you want to go. A depth of 1 or 2 should be done in a few hours (depending on how many people they are following), a depth of 5 can take several days.
python GetFollowing.py -s edent -d 2
This will generate a directory structure like
```
.
├── following
│ ├── edent.csv
│ ├── alice.csv
│ ├── bob.csv
│ └── carol.csv
└── twitter-users
├── 3104869030.json
├── 3105479302.json
├── 3111045413.json
└── 3112012750.json
```
The `following` directory is contains the Twitter Usernames. Each is a `.csv` file showing who they are following.
The `twitter-users` directory contains a `.json` representation of each user. The file name is their Twitter ID.
### Generate The Network
This script parses the `.csv` files and creates a new `.csv` which contains the Following graph.
python GenerateNetwork.py -s edent
The file `twitter_network.csv` contains a comma delimited graph
```
3112012750,3111045413,1
3111045413,3111252693,2
```
Column 1 is the Twitter ID of a User. Column 2 is the ID of a User they follow. Column 3 is the number of followers the User has.
### Draw The Graph
If you want to create a visual representation, you can import `twitter_network.csv` into your favourite stats package. Or, you can run
python DrawGraph.py
## Credits
Some scripts based on http://mark-kay.net/2014/08/15/network-graph-of-twitter-followers/
With permission granted from the original author to adapt https://twitter.com/markleekay/status/574362042204815361
For more information, please see https://shkspr.mobi/blog/2015/03/this-is-what-a-graph-of-8000-fake-twitter-accounts-looks-like/