#! /bin/sh dirs=plots files=`ls data | grep [0-9][0-9][0-9][0-9]- | sed 's:.dat::'` style=check fit="" while [ $# -gt 0 ]; do case $1 in -hist) shift; dirs=hist ;; -f*) fit=$1; shift ;; -level) shift; dirs=level ;; -search)shift; dirs=search ;; -plots) shift; dirs=plots ;; -check) shift; style=check ;; -new) shift; style=new ;; -all) shift; dirs="hist level search" ;; *) echo "Bad arg: $1."; exit ;; esac done if [ $dirs != plots ]; then for d in $dirs; do ( if [ ! -d $d ]; then mkdir $d; fi if [ $d = "hist" -a ! -d hist/log ]; then mkdir hist/log; fi echo "Building $d" for f in $files; do if [ $style = check -a -s $d/$f.png ]; then continue; fi echo $f args="" if [ $d = "hist" ]; then args="-l data/fit/$f.fit $fit"; fi ./${d}graph $args $d/$f.png done ) done else if [ ! -d plots ]; then mkdir plots; fi for r in 1000 10000 100000; do if [ -f plots/rantest.$r.png ]; then continue; fi echo Random Test for $r points java RanTest $r > /tmp/random.$r gnuplot - << EOF 2>/tmp/gplog > plots/rantest.$r.png set terminal png color; set output plot "/tmp/random.$r" t "$r points" with dots EOF done echo "Building Sum Dir/Data" dir=sum if [ ! -d $dir ]; then mkdir $dir; fi awk -v dir="$dir" ' BEGIN { OFS = "" } { family=dir "/family-" $1 "X-" $3 "-" $4 ".dat" class=dir "/class-" $1 ".dat" nodes=dir "/size-" $2 ".dat" nodesbyfamily=dir "/size-" $1 "-" $2 ".dat" print "", $0 >family print "", $0 >class print "", $0 >nodes print "", $0 >nodesbyfamily } ' < summary.dat gnuplot - << EOF 2>/tmp/gplog > plots/testplot.png set terminal png color; set output test EOF gnuplot - << EOF 2>/tmp/gplog > plots/testplot.pt2.png set terminal png color; set output; set pointsize 2 test EOF java PLExample > /tmp/data sed -n '/^[0-9]/p' /tmp/data | tr ":\t " " \n" > /tmp/data1 gamma=`sed -n '1s/gamma = -//;1s/, .*//p' /tmp/data` scale=`sed '1s/^.* //;1q;' /tmp/data1` gnuplot << EOF > plots/PLExample.png set logscale xy; set grid mxtics mytics xtics ytics set terminal png color; set output plot $scale*x**-$gamma, '/tmp/data1' EOF grep SmW+ /tmp/SmW+.dat grep SmW- /tmp/SmW-.dat grep SmW+ /tmp/SmW+.dat grep SmW- /tmp/SmW-.dat echo "Building XY Plots" ./doxyplot P Pl /tmp/SmW?.dat grid > plots/PPlSmW.png ./doxyplot P Pl /tmp/SmW?.dat logxy > plots/PPlSmW.1.png ./doxyplot P Pl /tmp/SmW?.dat logy > plots/PPlSmW.2.png ./doxyplot -n Sh P Pl /tmp/SmW?.dat grid > plots/PPlSmW.3.png ./doxyplot R CP sum/size-2000.dat logxy > plots/CP2000.png ./doxyplot R CP /tmp/SmW?.dat logxy > plots/CPSmW.png ./doxyplot CP CC sum/size-2000.dat logxy > plots/CPCC2000.png ./doxyplot CP CC /tmp/SmW?.dat grid > plots/CPCCSmW.png ./doxyplot R CP /tmp/SmW?.dat logy > plots/CPSmW+-.png ./doxyplot R CC /tmp/SmW?.dat logy > plots/CCSmW+-.png ./doxyplot N Pl sum/class-Bag.dat logy > plots/NPlBag.png grep "2000 6 " sum/size-SmW+-2000.dat > /tmp/SmW+2000-6 grep "2000 6 " sum/size-SmW--2000.dat > /tmp/SmW-2000-6 ./doxyplot P CP CC /tmp/SmW?2000-6 grid lines > plots/PCPCCSmW2000.png ./doxyplot P CP CC /tmp/SmW?2000-6 grid lines 'xrange [.05:]'\ > plots/PCPCCSmW2000.1.png fsort(){ ls sum/family-*$1*dat | sed 's:-\([0-9][0-9]*\)-: \1 :' | \ sort -g +1 +2 | sed 's: :-:g' } famplot() { # X Y Class plotargs > pngfile x=$1; shift; y=$1; shift; class=$1; shift ./doxyplot $x $y `fsort $class` lines "$@" } famplot N Pl Bag logxy left "xrange [:2000]" > plots/NPlBag.1.png famplot '-n Sh N' Pl Bag logxy left "xrange [:2000]" > plots/NPlBag.2.png famplot N CC 'SmW+*0.0.' grid > plots/NCCSmW00.png famplot N CC 'TdS+' grid > plots/NCCTdS+.png famplot N CC 'SmW-' grid > plots/NCCSmW-.png famplot N CC 'RdE+' grid > plots/NCCRdE+.png famplot N CC 'Bag' grid > plots/NCCBag.png famplot N CP 'TdL-' grid left > plots/NCPTdL-.png famplot N CP 'RdE+' grid left > plots/NCPRdE+.png famplot N CP 'Bag' grid left > plots/NCPBag.png famplot N CP 'RdE+' logy > plots/NCPRdE+.1.png famplot N CP 'Bag' logx left "xrange [:2000]" > plots/NCPBag.1.png famplot N CP 'SmW+' grid left > plots/NCPSmW+.png famplot N CP 'SmW+*0.3' grid left > plots/NCPSmW+03.png famplot N CP 'SmW+*0.3' "xrange [:2000]" logx left > plots/NCPSmW+03.1.png echo "Building Class Plots" for p in E M a m CC CP D Pl D1 B1 Sh SM Sa Sm; do echo -n " $p" ./doclassplot class $p grid > plots/class-${p}.png ./doclassplot class $p logy > plots/class-${p}.1.png ./doclassplot 2000 $p grid > plots/class-${p}-2000.png ./doclassplot 2000 $p logy > plots/class-${p}-2000.1.png done echo echo "Building Normalized Class Plots" for p in Pl D1 B1; do echo -n " $p" ./doclassplot -n Sh class $p grid > plots/class-${p}-Sh.png ./doclassplot -n Sh class $p logy > plots/class-${p}-Sh.1.png ./doclassplot -n Sh 2000 $p grid > plots/class-${p}-Sh-2000.png ./doclassplot -n Sh 2000 $p logy > plots/class-${p}-Sh-2000.1.png done echo ./doclassplot -r class CC grid right > plots/class-CC.2.png ./doclassplot -r 2000 CC grid right > plots/class-CC-2000.2.png ./doclassplot -r class CP grid right > plots/class-CP.2.png ./doclassplot -r 2000 CP grid right > plots/class-CP-2000.2.png ./doclassplot -r 2000 CP logy right > plots/class-CP-2000.3.png echo "Building Misc Plots" Ax(){ echo "\$`./name2plot -c $1`" } awk "{print `Ax Pl`, `Ax B1`, `Ax D1`}"/tmp/PlB1D12000 awk "{print \$1}" < /tmp/PlB1D12000 > /tmp/PowerLaw-2000.dat awk "{print \$2}" < /tmp/PlB1D12000 > /tmp/BreadthFirst-2000.dat awk "{print \$3}" < /tmp/PlB1D12000 > /tmp/DepthFirst-2000.dat files="/tmp/PowerLaw-2000.dat /tmp/BreadthFirst-2000.dat /tmp/DepthFirst-2000.dat" cmds='ylabel "Search Length"' ./doxyplot -ns R Z $files grid left "$cmds" > plots/PlB1D12000.png ./doxyplot -ns R Z $files grid left logy "$cmds" > plots/PlB1D12000.1.png Axd(){ echo "\$`./name2plot -c $1`/\$`./name2plot -c $2`" } awk "{print `Axd Pl Sh`, `Axd B1 Sh`, `Axd D1 Sh`}"/tmp/PlB1D1S2000 awk "{print \$1}" < /tmp/PlB1D1S2000 > /tmp/PowerLaw-2000.dat awk "{print \$2}" < /tmp/PlB1D1S2000 > /tmp/BreadthFirst-2000.dat awk "{print \$3}" < /tmp/PlB1D1S2000 > /tmp/DepthFirst-2000.dat cmds='ylabel "Search Length / Shortest Path"' ./doxyplot -ns R% Z $files grid left "$cmds" > plots/PlB1D1S2000.png ./doxyplot -ns R% Z $files grid left logy "$cmds" > plots/PlB1D1S2000.1.png ./doxyplot P CC /tmp/SmW?.dat grid > plots/PCCSmW.png ./doxyplot P CP /tmp/SmW?.dat grid > plots/PCPSmW.png ./doxyplot P CP CC /tmp/SmW+.dat grid > plots/PCCCPSmW.png ./doxyplot P CP CC /tmp/SmW+.dat grid logx > plots/PCCCPSmW.1.png ./doxyplot P CP CC /tmp/SmW?.dat grid > plots/PCCCPSmW.2.png ./doxyplot P CP CC /tmp/SmW?.dat grid logx > plots/PCCCPSmW.3.png using="using `./name2plot -c P`:`./name2plot -c CP`" gnuplot - << EOF 2>&1 | grep '^[sg][ca].*=.*+/-' > /tmp/fit f(x)=scale*x**-gamma; fit [.001:] f(x) "/tmp/SmW-.dat" $using via scale,gamma EOF scale=`sed -n '1{s:^.*= ::;s: .*$::;;p;}' /tmp/fit` gamma=`sed -n '2{s:^.*= ::;s: .*$::;;p;}' /tmp/fit` gnuplot - << EOF 2>/tmp/gplog > plots/PCPSmW.1.png set grid mxtics mytics xtics ytics; set terminal png color; set output set logscale xy set xlabel "Rewiring Probability"; set ylabel "Charistic Path Length" plot "/tmp/SmW+.dat" $using t "SmW+ CharPath", \ "/tmp/SmW-.dat" $using t "SmW- CharPath", \ $scale*x**-$gamma EOF fi