Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
3,166 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,108 @@ | ||
Graph Illustrator | ||
================= | ||
This tool reads a collection of relationships (u --> v) from the standard input a creates a graphical representation. | ||
Graph Illustrator is program to draw graphs (as in Graph Theory) interactively, lightweight and easy to use. | ||
|
||
I've created this tool mainly by two reasons: | ||
- There are many problems involving graphs and it is much more easy to understand the problem with a graphical representation. | ||
- I could not found any tool that suit my needs. | ||
Problems involving graphs are much more easy to understand with a graphical representation. I developed this tool mostly for my self, but I think it can be helpful to others too. | ||
|
||
Features | ||
======== | ||
- Reads relationships from STDIN (keyboard), although you can always read from files using pipelining. | ||
- Vertex Dragging - The positions of the vertices are generated randomly so you have to drag the vertices as you like (mouse's left button). | ||
- Plane Dragging - Use the mouse's right button to drag the drawing area. | ||
- Zoom - sometimes we need a better perspective (use the mouse wheel). | ||
|
||
For now these features are good for me but I'll add more features and improvements as needed. | ||
|
||
How to use | ||
- Draw edges and vertices using the mouse. | ||
- Custom colors for labels, background and borders. | ||
- Own JSON based file format to save your drawings. | ||
- Dragging of vertices using the mouse. | ||
- Export to SVG. | ||
- Zoom. | ||
- Other features. | ||
|
||
SGI Format | ||
========== | ||
The input consist of two parts, edges and vertex info, the latter is optional. | ||
|
||
The edge info section starts with the `[EDGES]` label. Each edge info has the following syntax: | ||
|
||
<start>,<end>[,label] | ||
|
||
The vertex info section starts with the `[VERTICES]` label. Each vertex info has the following syntax: | ||
|
||
<node>:<x>,<y>[,label_aligment] | ||
label_alignment = L | C | R | ||
|
||
|
||
Examples: | ||
|
||
input1.gi | ||
|
||
[EDGES] | ||
7,5,1 | ||
2,1,2 | ||
8,7,2 | ||
2,4,1 | ||
4,5,2 | ||
9,5,1 | ||
3,2,2 | ||
2,10,1 | ||
6,5,2 | ||
|
||
Execute: | ||
|
||
$ java -jar GraphIllustrator.jar < input1.gi | ||
|
||
![Screenshot 1](https://raw.github.com/rendon/graph_illustrator/master/screenshots/screenshot1.png) | ||
|
||
input2.gi | ||
|
||
[EDGES] | ||
alsa-lib-1.0.27.2,Firefox | ||
GTK+-2.24.22,Firefox | ||
Zip-3.0,Firefox | ||
UnZip-6.0,Firefox | ||
ATK-2.10.0,GTK+-2.24.22 | ||
gdk-pixbuf-2.30.1,GTK+-2.24.22 | ||
Pango-1.36.1,GTK+-2.24.22 | ||
Cairo-1.12.16,Pango-1.36.1 | ||
Xorg Libraries,Pango-1.36.1 | ||
GLib-2.36.4,ATK-2.10.0 | ||
LibTIFF-4.0.3,gdk-pixbuf-2.30.1 | ||
Harfbuzz-0.9.20,Pango-1.36.1 | ||
libevent-2.0.21,Firefox | ||
libvpx-v1.2.0,Firefox | ||
yasm-1.2.0,libvpx-v1.2.0 | ||
NSPR-4.10,Firefox | ||
NSS-3.15.1,Firefox,recomended | ||
SQLite-3.8.0.2,NSS-3.15.1 | ||
[VERTICES] | ||
alsa-lib-1.0.27.2:-31.229972632963495,3.372027942771954 | ||
Firefox:-31.331017090977042,32.279109722211345 | ||
GTK+-2.24.22:-55.91817931979482,20.922353520139556 | ||
Zip-3.0:-37.11919586532268,12.929888334762893 | ||
UnZip-6.0:-24.047041973546854,12.701515187859657 | ||
ATK-2.10.0:-65.087677773556,12.895996200206614 | ||
gdk-pixbuf-2.30.1:-82.24864479026462,13.213945003895038 | ||
Pango-1.36.1:-50.04081899601493,13.007280577090604 | ||
Cairo-1.12.16:-50.88370357780594,-8.704693043291002 | ||
Xorg Libraries:-59.841802174010695,-0.47646970754402673 | ||
GLib-2.36.4:-65.3872579853671,6.211241952231539 | ||
LibTIFF-4.0.3:-82.21793931954997,2.364807121555863 | ||
Harfbuzz-0.9.20:-38.99396637358616,-13.36925150943452 | ||
libevent-2.0.21:-4.444149544026786,12.856600935585014 | ||
libvpx-v1.2.0:-10.168102409969492,3.13734545175236 | ||
yasm-1.2.0:-9.968088347396659,-4.740131899689356 | ||
NSPR-4.10:11.224166939473506,13.049122347440154 | ||
NSS-3.15.1:25.686606789135453,12.875808450208062 | ||
SQLite-3.8.0.2:25.70310133083322,-0.7260536576400227 | ||
|
||
|
||
Execute: | ||
|
||
$ java -jar GraphIllustrator.jar < input2.gi | ||
|
||
|
||
![Screenshot 2](https://raw.github.com/rendon/graph_illustrator/master/screenshots/screenshot2.png) | ||
|
||
Two formats are supported, GI (Graph Illustrator) and SGI (Simple Graph Illustrator), the latter is supported for convenience, many problems in competitive programming represent a graph in the form `<from> <to> [weight]`, for example: | ||
|
||
0 1 5 | ||
1 2 1 | ||
3 1 8 | ||
0 3 7 | ||
4 0 9 | ||
|
||
Save this in a file with extension `.sgi` and this is the result: | ||
|
||
![Simple](https://github.com/rendon/graph_illustrator/blob/master/doc/screenshots/simple.png) | ||
|
||
Vertices' positions are set randomly. For anything else use the GI format. | ||
|
||
GI Format | ||
========= | ||
This format uses JSON to represent the graph and all the necessary properties, is the recommended. | ||
|
||
##Example 0 | ||
![Example 0](https://github.com/rendon/graph_illustrator/blob/master/doc/screenshots/example_0.png) | ||
|
||
This are the file contents of the previous example: | ||
|
||
{ | ||
"Graph": { | ||
"Edges": [ | ||
{ | ||
"backEdge": false, | ||
"center": { | ||
"x": -2.29741, | ||
"y": 1.666831 | ||
}, | ||
"directed": true, | ||
"end": 2, | ||
"foregroundColor": "0x000000ff", | ||
"highlighted": false, | ||
"label": "from a to b", | ||
"start": 1, | ||
"strokeColor": "0x000000ff" | ||
} | ||
], | ||
"Vertices": [ | ||
{ | ||
"backgroundColor": "0xffffffff", | ||
"borderColor": "0x000000ff", | ||
"center": { | ||
"x": -10.31746, | ||
"y": 1.211362 | ||
}, | ||
"foregroundColor": "0x000000ff", | ||
"key": 1, | ||
"label": "a", | ||
"labelAlignment": "left", | ||
"radius": 1.428791 | ||
}, | ||
{ | ||
"backgroundColor": "0xffffffff", | ||
"borderColor": "0x000000ff", | ||
"center": { | ||
"x": 5.72264, | ||
"y": 1.12782 | ||
}, | ||
"foregroundColor": "0x000000ff", | ||
"key": 2, | ||
"label": "b", | ||
"labelAlignment": "left", | ||
"radius": 1.428791 | ||
} | ||
] | ||
} | ||
} | ||
|
||
##Example 1 | ||
![Example 1](https://github.com/rendon/graph_illustrator/blob/master/doc/screenshots/example_1.png) | ||
|
||
[Source](https://github.com/rendon/graph_illustrator/blob/master/doc/examples/example_1.gi) | ||
|
||
##Example 2 | ||
![Example 2](https://github.com/rendon/graph_illustrator/blob/master/doc/screenshots/example_2.png) | ||
[Source](https://github.com/rendon/graph_illustrator/blob/master/doc/examples/example_2.gi) | ||
|
||
##Example 3 | ||
![Example 3](http://rendon.x10.mx/pictures/example_3.png) | ||
[Source](https://github.com/rendon/graph_illustrator/blob/master/doc/examples/example_3.gi) | ||
|
||
Contributions and Bug reports | ||
============================= | ||
Contributions are welcome. | ||
|
||
Bugs? For sure. Please report any bug you find, create an [issue](https://github.com/rendon/graph_illustrator/issues). |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.