Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xiaoxiae/grafatko
An app for creating and visualizing graphs and graph-related algorithms.
https://github.com/xiaoxiae/grafatko
computer-science graph-algorithms graph-theory graph-visualizer pyqt5 python
Last synced: 3 days ago
JSON representation
An app for creating and visualizing graphs and graph-related algorithms.
- Host: GitHub
- URL: https://github.com/xiaoxiae/grafatko
- Owner: xiaoxiae
- License: gpl-3.0
- Created: 2019-04-08T18:38:42.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-11T20:18:57.000Z (almost 3 years ago)
- Last Synced: 2024-11-09T03:39:51.627Z (6 days ago)
- Topics: computer-science, graph-algorithms, graph-theory, graph-visualizer, pyqt5, python
- Language: Python
- Homepage:
- Size: 579 KB
- Stars: 27
- Watchers: 3
- Forks: 7
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Grafátko [gɾafɑtko]
An app for creating and visualizing graphs and graph-related algorithms.![](https://raw.githubusercontent.com/xiaoxiae/Grafatko/master/example.png)
## Running Grafátko
First, install the app by running `pip install grafatko`.
Then you can simply run the `grafatko` command from a terminal of your choice.---
Another way to run Grafátko (albeit a little more difficult) is to first clone the repository, go to the base directory and run the project as a Python module:
```console
xiaoxiae@thinkpad ~> git clone https://github.com/xiaoxiae/Grafatko.git
xiaoxiae@thinkpad ~> cd Grafatko/
xiaoxiae@thinkpad ~> pip install -r requirements.txt
xiaoxiae@thinkpad ~> python -m grafatko.__init__
```## Controls
### Mouse
- **right button** creates new nodes/vertices
- **+ shift** doesn't deselect the currently selected nodes:
- **left button** selects and drags nodes/vertices around the screen
- if held, drags nodes along with the mouse
- **+ shift** toggles selection on nodes/vertices
- if held, moves the entire graph component
- **middle button** pans
- **mouse wheel** zooms
- **+ shift** rotates nodes about the currently selected ones### Keyboard
- **r** toggles 'tree mode' for smoother visualisation of trees
- essentially applies special forces on the nodes to group them by distance from the currently selected node
- only works if a single node is selected
- **space** centers on the currently selected nodes
- **delete** deletes the currently selected items### Other
- `complement` -- makes the graph [complemented](https://en.wikipedia.org/wiki/Complement_graph)
- `reorinet` -- changes the directions of the vertices of the graph## Visualizing algorithms
The app allows for visualising custom algorithms on the currently edited graph.
Examples of valid programs can be found in the `examples/` folder.After creating a graph, you can go to `Algorithms -> Run` and select the one you want to run on the graph.
The program then calls a function with the same name as the file, the only parameter being the `DrawableGraph` object to run the algorithm on.When the animation is running, you can use the `pause`, `resume` and `clear` to control it.
## Importing/exporting graphs
The app uses a simple text-based format for importing and exporting graph.
Each line of the file the format `n1 [direction] n2 [weight]`, where:
- `n1` and `n2` are labels of the nodes forming the vertex, containing no whitespace characters
- `[direction]` is used in directed graphs and is either `->` or `<-`
- `[weight]` is used in weighted graphs, denotes the weight of the vertex (either int or float)Examples of valid graphs can be found in the `examples/` folder.