Skip to main content

An app for creating and visualizing graphs and graph-related algorithms.

Project description

Grafátko [gɾafɑtko]

An app for creating and visualizing graphs and graph-related algorithms.

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:

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
  • 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

grafatko-0.2.6-py3-none-any.whl (38.1 kB view details)

Uploaded Python 3

File details

Details for the file grafatko-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: grafatko-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 38.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.4

File hashes

Hashes for grafatko-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4f3fb9de848dae7d533175299f0e34740ec57c8da8252916ffd6bee14046f70b
MD5 e730ba927fc78b0bb6f4fdf803dfee79
BLAKE2b-256 81c8547474de7427b4bb82f35c52536769cad18c9023f6a811b5ae1137dc197f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page