Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arcticlampyrid/travellings-graph
This project is to build a graph of links between Travellings members, and analyze the connections between them.
https://github.com/arcticlampyrid/travellings-graph
Last synced: about 19 hours ago
JSON representation
This project is to build a graph of links between Travellings members, and analyze the connections between them.
- Host: GitHub
- URL: https://github.com/arcticlampyrid/travellings-graph
- Owner: ArcticLampyrid
- License: mit
- Created: 2024-05-02T11:35:51.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-20T02:02:13.000Z (5 months ago)
- Last Synced: 2024-06-21T14:54:29.460Z (5 months ago)
- Language: Python
- Homepage: https://travelgraph.travellings.cn/
- Size: 144 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Travellings Graph
Have you ever heard of Six Degrees of Separation? Six degrees of separation is the idea that all people are six or fewer social connections away from each other. As a result, a chain of "friend of a friend" statements can be made to connect any two people in a maximum of six steps.This project is to build a graph of links between [Travellings](https://www.travellings.cn/) members, and analyze the connections between them, showing how many steps in average are needed to connect to/by each member.
## Usage
```bash
docker buildx build -t travellings-graph .
mkdir -p data
docker run --rm -v $(pwd)/data:/app/data travellings-graph crawl
docker run --rm -v $(pwd)/data:/app/data travellings-graph analyze
ls -l data# Serve as API server
docker run --rm -v $(pwd)/data:/app/data -p 8471:8471 travellings-graph serve
```## Crawl
You can run with subcommand `crawl` to crawl the data from the source.> [!WARNING]
> Because there are no standard format for exchanging Links, the data is crawled with many tricks, and may not be accurate. If you find any error, please let me know.The member list is from [Travellings List](https://list.travellings.cn/), and saved in `data/members.json`.
The Links data is crawled from each member's Links page, and saved in `data/friends.lines.json`.## Analyze
You can run with subcommand `analyze` to analyze the data.During the analysis, the graph is firstly built with [NetworkX](https://networkx.org/), and saved in `data/graph.gexf`. All nodes are labeled with their Member ID in [Travellings List](https://list.travellings.cn/).
> [!TIP]
> You can use [Gephi](https://gephi.org/) to visualize the graph and analyze the connections. For Arch Linux, you can install Gephi with `pacman -S gephi`.Also, a basic analysis is generated and saved in `data/analysis.csv`, as well as a simple report in `data/analysis.md`. The results include the average steps needed to connect to/by each member.
# Serve
You can run with subcommand `serve` to serve as an API server. The server is built with [FastAPI](https://fastapi.tiangolo.com/), and you can access the API document at `/docs` or `/redoc` endpoint.## Results
A copy of the completed data was shared on my blog \([view it](https://alampy.com/2024/05/02/test-six-degrees-of-separation-on-travellings/)\). Note that the data may be outdated, and the results may be different from the latest.## License
Licensed under the [MIT License](LICENSE).