From: erg Date: Thu, 31 Mar 2011 17:48:07 +0000 (+0000) Subject: Add a shell script to run a gvmap pipeline until the parts are integrated X-Git-Tag: LAST_LIBGRAPH~32^2~893 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c6a7ffa41d90dfe0a9d1db1ae322d61daa275d38;p=graphviz Add a shell script to run a gvmap pipeline until the parts are integrated into gvmap proper. --- diff --git a/cmd/gvmap/Makefile.am b/cmd/gvmap/Makefile.am index ff3e715ee..b3f6e184f 100644 --- a/cmd/gvmap/Makefile.am +++ b/cmd/gvmap/Makefile.am @@ -2,8 +2,8 @@ ## Process this file with automake to produce Makefile.in pdfdir = $(pkgdatadir)/doc/pdf -man_MANS = gvmap.1 cluster.1 -pdf_DATA = gvmap.1.pdf cluster.1.pdf +man_MANS = gvmap.1 cluster.1 gvmap.sh.1 +pdf_DATA = gvmap.1.pdf cluster.1.pdf gvmap.sh.1.pdf AM_CPPFLAGS = \ -I$(top_srcdir) \ @@ -56,6 +56,9 @@ gvmap.1.pdf: $(srcdir)/gvmap.1 cluster.1.pdf: $(srcdir)/cluster.1 - @GROFF@ -Tps -man $(srcdir)/cluster.1 | @PS2PDF@ - - >cluster.1.pdf +gvmap.sh.1.pdf: $(srcdir)/gvmap.sh.1 + - @GROFF@ -Tps -man $(srcdir)/gvmap.sh.1 | @PS2PDF@ - - >gvmap.sh.1.pdf + EXTRA_DIST = $(man_MANS) $(pdf_DATA) # gvmap.vcproj DISTCLEANFILES = $(pdf_DATA) diff --git a/cmd/gvmap/gvmap.1 b/cmd/gvmap/gvmap.1 index bc3f97229..817428459 100644 --- a/cmd/gvmap/gvmap.1 +++ b/cmd/gvmap/gvmap.1 @@ -8,7 +8,7 @@ gvmap \- find clusters and create a geographical map highlighting clusters. .SH SYNOPSIS .B gvmap -[\fB\-ekov?\fP] +[\fB\-ekv?\fP] [ .I options ] @@ -29,18 +29,24 @@ and nodes must not overlap. The following options are supported: .TP .BI \-a " k" -The integer k speficies the average number of artificial points added along +The integer k specifies the average number of artificial points added along the bounding box of the labels. Such artificial points are added to avoid a country boundary cutting through the boundary box of the labels. Computing -time is proportioal to k; hence, for large graphs, a small value of k is +time is proportional to k; hence, for large graphs, a small value of k is suggested. If k = -1, a suitable value of k is automatically selected based on the graph size. By default k = -1. .TP .BI \-e -If speficied, edges will be included in the final output. +If specified, edges will be included in the final output. +.TP +.BI \-k +Increases randonesss of boundary .TP .BI \-s " d" -The real number d speficies the depth of the shore in points. If 0, the depth is selected automatically. By default d = 0. +The real number d specifies the depth of the shore in points. If 0, the depth is selected automatically. By default d = 0. +.TP +.BI \-v +Set verbose mode. .SH EXAMPLES .PP @@ -51,12 +57,17 @@ format. For example, the following pipeline creates a map with edges in semi-transparent light gray and nodes laid out using sfdp: .PP -sfdp -Goverlap=prism foo.gv | gvmap -e | neato -n2 -Ecolor="#55555522" -Tpng > foo.png +sfdp -Goverlap=prism foo.gv | gvmap -e | neato -n2 -Ecolor=#55555522 -Tpng > foo.png +.PP +The shell script gvmap.sh provides a shorthand for such pipelines. For example, the +above pipeline can be achieved using +.PP +gvmap.sh -Ae -Ecolor=#55555522 -Tpng foo.gv > foo.png .SH AUTHOR Yifan Hu .SH "SEE ALSO" .PP -sfdp(1), neato(1), gvpr(1) +gvmap.sh(1), sfdp(1), neato(1), gvpr(1) .PP E. R. Gansner, Y. Hu, S. G. Kobourov, "GMap: Visualizing graphs and clusters as maps," Proc. Pacific Vis. 2010, pp. 201\(hy208. diff --git a/cmd/gvmap/gvmap.sh b/cmd/gvmap/gvmap.sh new file mode 100755 index 000000000..8a634025b --- /dev/null +++ b/cmd/gvmap/gvmap.sh @@ -0,0 +1,102 @@ +# Script for gvmap pipeline +# Use -A to add flags for gvmap; e.g., -Ae results in gvmap -e +# -K can be used to change the original layout; by default, sfdp is used +# -T is used to specify the final output format +# -G, -N and -E flags can be used to tailor the rendering +# -g, -n and -e flags can be used to tailor the initial layout +# Be careful of spaces in the flags. If these are not wrapped in quotes, the +# parts will be separated during option processing. + +LAYOUT=sfdp +trap 'rm -f $TMPFILE1 $TMPFILE2 $TMPINFILE errout; exit' 0 1 2 3 15 +OPTSTR="vVA:[gvmap flags]G:[attr=val]E:[attr=val]N:[attr=val]g:[attr=val]e:[attr=val]n:[attr=val]K:[layout]T:[output format]o:[outfile]" +FLAGS1= +FLAGS2= +FLAGS3= + +while getopts ":$OPTSTR" c +do + case $c in + v ) + VERBOSE=1 + FLAGS1="$FLAGS1 -v" + FLAGS2="$FLAGS2 -v" + FLAGS3="$FLAGS3 -v" + ;; + V ) + dot -V + exit 0 + ;; + K ) + LAYOUT=$OPTARG + ;; + A ) + FLAGS2="$FLAGS3 -$OPTARG" + ;; + T ) + FLAGS3="$FLAGS3 -T$OPTARG" + ;; + e ) + FLAGS1="$FLAGS1 -E$OPTARG" + ;; + n ) + FLAGS1="$FLAGS1 -N$OPTARG" + ;; + g ) + FLAGS1="$FLAGS1 -G$OPTARG" + ;; + E ) + FLAGS3="$FLAGS3 -E$OPTARG" + ;; + N ) + FLAGS3="$FLAGS3 -N$OPTARG" + ;; + G ) + FLAGS3="$FLAGS3 -G$OPTARG" + ;; + o ) + FLAGS3="$FLAGS3 -o$OPTARG" + ;; + :) + print -u 2 $OPTARG requires a value + exit 2 + ;; + \? ) + if [[ "$OPTARG" == '?' ]] + then + getopts -a gvmap "$OPTSTR" x '-?' + exit 0 + else + print -u 2 "gvmap: unknown flag $OPTARG - ignored" + fi + ;; + esac +done +shift $((OPTIND-1)) + +if [[ $# == 0 ]] +then + if [[ -n $VERBOSE ]] + then + print -u 2 "$LAYOUT -Goverlap=prism $FLAGS1 | gvmap $FLAGS2 | neato -n2 $FLAGS3" + fi + $LAYOUT -Goverlap=prism $FLAGS1 | gvmap $FLAGS2 | neato -n2 $FLAGS3 +else + while (( $# > 0 )) + do + if [[ -f $1 ]] + then + if [[ -n $VERBOSE ]] + then + print -u 2 "$LAYOUT -Goverlap=prism $FLAGS1 $1 | gvmap $FLAGS2 | neato -n2 $FLAGS3" + fi + $LAYOUT -Goverlap=prism $FLAGS1 $1 | gvmap $FLAGS2 | neato -n2 $FLAGS3 + else + print -u 2 "gvmap: unknown input file $1 - ignored" + fi + shift + done +fi + + + diff --git a/cmd/gvmap/gvmap.sh.1 b/cmd/gvmap/gvmap.sh.1 new file mode 100644 index 000000000..92bb49c14 --- /dev/null +++ b/cmd/gvmap/gvmap.sh.1 @@ -0,0 +1,101 @@ +.de TQ +. br +. ns +. TP \\$1 +.. +.TH GVMAP.SH 1 "31 March 2011" +.SH NAME +gvmap.sh \- pipeline for running gvmap +.SH SYNOPSIS +.B gvmap.sh +[\fB\-vV?\fP] +[ +.I options +] +[ +.BI \-o +.I outfile +] +[ +.I files +] +.SH DESCRIPTION +.B gvmap.sh +takes as input a graph in DOT format, performs an layout, runs the output through +gvmap and renders the output. At some point, it is hoped to integrate all of these +tasks into gvmap. +.SH OPTIONS +The following options are supported: +.TP +.BI \-a " k" +The integer k specifies the average number of artificial points added along +the bounding box of the labels. Such artificial points are added to avoid +a country boundary cutting through the boundary box of the labels. Computing +time is proportional to k; hence, for large graphs, a small value of k is +suggested. If k = -1, a suitable value of k is automatically selected based on +the graph size. By default k = -1. +.TP +.BI \-K " layout" +specifies which program should be use for the initial layout. By default, +sfdp is run. Also by default, the layout is passed the flag -Goverlap=prism. This can be +overridden using a -g flag. +.TP +.BI \-T " format" +specifies the final output format. This works the same way as the -T flag for any +Graphviz layout program. +.TP +.BI \-N " attr=val" +specifies the setting of a default node attribute during the rendering phase. This works the same way as +the -N flag for any Graphviz layout program. +.TP +.BI \-G " attr=val" +specifies the setting of a graph attribute during the rendering phase. This works the same way as +the -G flag for any Graphviz layout program. +.TP +.BI \-E " attr=val" +specifies the setting of a default edge attribute during the rendering phase. This works the same way as +the -E flag for any Graphviz layout program. +.TP +.BI \-n " attr=val" +specifies the setting of a default node attribute during the layout phase. This works the same way as +the -N flag for any Graphviz layout program. +.TP +.BI \-g " attr=val" +specifies the setting of a graph attribute during the layout phase. This works the same way as +the -G flag for any Graphviz layout program. +.TP +.BI \-e " attr=val" +specifies the setting of a default edge attribute during the layout phase. This works the same way as +the -E flag for any Graphviz layout program. +.TP +.BI \-A " flag" +specifies a flag to be passed to gvmap. For example, gvmap.sh -Ae -As3 causes gvmap -e -s3 to be run. +.TP +.BI \-v +Set verbose mode. +.TP +.BI \-V +Print version information and exit. +.TP +.BI \-? +Print usage information and exit. + +.SH EXAMPLES +.PP +The following invocation +creates a map with edges in semi-transparent light gray and nodes laid +out using sfdp: +.PP +gvmap.sh -Ae -Ecolor=#55555522 -Tpng foo.gv > foo.png +.PP +It is equivalent to running the pipeline +.PP +sfdp -Goverlap=prism foo.gv | gvmap -e | neato -n2 -Ecolor=#55555522 -Tpng > foo.png + +.SH AUTHOR +Yifan Hu +.SH "SEE ALSO" +.PP +gvmap(1), sfdp(1), neato(1), gvpr(1) +.PP +E. R. Gansner, Y. Hu, S. G. Kobourov, "GMap: Visualizing graphs and clusters as maps," Proc. Pacific Vis. 2010, pp. 201\(hy208.