Converts popular graph description format used in programming competitions (ACM, topcoder, Yandex.contest) to Graphviz (*.dot) file format.
Input format:
V E
u_1 v_1 [optional weight1]
u_2 v_2 [optional weight2]
...
Input file
5 5
1 2 2
2 3 54
3 4 76
5 3 8
1 5 5
will be converted to this dot file
digraph G {
1 -> 2 [label="2"]
2 -> 3 [label="54"]
3 -> 4 [label="76"]
5 -> 3 [label="8"]
1 -> 5 [label="5"]
}
- Install graphviz (e.g by
sudo apt-get install -y graphviz
orsudo yum install -y graphviz
) ./graphviz.sh sample.in
It will produce DOT and PNG files.