# building gv from source
# otherwise: "Error: remove_overlap: Graphviz not built with triangulation library"
wget https://graphviz.gitlab.io/pub/graphviz/stable/SOURCES/graphviz.tar.gz
gunzip graphviz.tar.gz
tar xvf graphviz.tar
sudo apt install -y libgd-dev
sudo apt install -y fontconfig
sudo apt install -y libcairo2-dev
sudo apt install -y libpango1.0-dev
sudo apt install -y libgts-dev
sudo pkg-config --libs gts
sudo pkg-config --cflags gts
cd graphviz-2.40.1/
sudo ./configure --with-gts --prefix ~
sudo make
sudo make install
It is important to use --prefix ~
[1] NOT --prefix ~/bin
[2]. With [1] the binaries will endup in ~/bin
, but with [2] they would end up in ~/bin/bin
which is not what I want.
mingle
is for edge bundling. ANN needs to be there:
sudo apt -y install libann-dev
Also, create a file called ann.pc
with the contents below and put it at /usr/lib/x86_64-linux-gnu/pkgconfig/ann.pc
!
prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib/x86_64-linux-gnu
includedir=${prefix}/include
Name: ANN
Description: Approximate Nearest Neighbors Library
Version: 1.1.2+doc-5
Requires:
Libs: -L${libdir} -lann -lm
Cflags: -I${includedir}
The configure line becomes:
sudo ./configure --with-ann --with-gts --prefix ~
time sfdp -Goverlap=scale foo.dot | mingle | neato -n2 -Tpdf -o out.pdf
# make an example gv input file. f.e. in R like this:
# a scale-free graph according to the Barabasi-Albert model w/h 1000 nodes:
library(igraph)
erg <- sample_pa(1000)
write_graph(erg, file = "~/tmp/nelout.gv", format="dot")
# okay now I have built sfdp and can use it!
time ~/bin/sfdp -Tpdf -Goverlap=scale -Gsplines=curved nelout.gv > nelout_vpsc.pdf
time convert -resize 1600 nelout.pdf nelout.png
awk '{print "\x22" $1 "\x22 -- \x22" $2 "\x22;"}' ~/git/assets/YeastNet.v3.txt > tmp/out.gv
# manually add "graph {" and "}"
vi tmp/out.gv
time ~/bin/bin/sfdp -Goverlap=prism tmp/out.gv\
| ~/bin/bin/gvmap -e\
| neato -n2 -Ecolor=#55555522 -Tpdf\
> tmp/map.pdf
- what Yifan Hu does is, he colors the edges by their length. http://yifanhu.net/GALLERY/GRAPHS/index.html how is this possible? it requires some form of INTROSPECTION I think. how can I query the edge length?
- how can I control the SIZE (in cm or whatever) and ASPECT RATIO of a graph in gv?
- very, very large PDF to PNG: yes I can do it! SVG would not have worked
- how to view and zoom a very, very large PNG: with GIMP! PDF would not have worked.
- another way of displaying very large bitmap images is OpenSeaDragon https://openseadragon.github.io/
- how to rescale a very, very large PDF or PNG into a smaller PNG: GIMP works but is manual, convert (imagemagick) works very well!
- THE ONLY WAY THAT SEEMS TO WORK: dot -[sfdp]-> pdf, pdf -[convert]-> png
Converting an extremely large PDF to PNG can be very painful with imagemagick convert. Recently I had extremely good results with pdftoppm
:
time pdftoppm -r 0.1 foobar.pdf foobar -png
Also see:
https://gitlab.com/graphviz/graphviz/issues/1237
ellson/MOTHBALLED-graphviz#1237