#! /bin/sh # # Quantum Walk PageRank export GDFONTPATH="/usr/share/fonts/open-sans" export GNUPLOT_DEFAULT_GDFONT="OpenSans-Semibold" # export SRAND=987654321 tmp="QW-PR.tmp" #--- N="4000" what="QW-PR-graph-$N" in="graph-$N.out" out="$what.out" gif="$what.time.gif" ranks="$what.ranks" T="100" echo "creating $in" ./graph "$N" 40 > "$in" echo "creating $out" ./QW-PR -a 100 < "$in" > "$tmp" # just keep essential parts of the output head -1 "$tmp" > "$out" tail -n +2 "$tmp" | head "-$T" | awk '{ print $1, $2, $3, $4, $5 }' >> "$out" tail -1 "$tmp" >> "$out" echo "creating $ranks" tail -1 "$out" | fmt -1 | tail -n +2 | head -10 | cat -n | sort -k2nr > "$ranks" echo "creating $gif" xlabel="Time" ylabel="PageRank" title="Quantum PageRank - graph-$N" labels="set title \"$title\"\nset xlabel \"$xlabel\"\nset ylabel \"$ylabel\"" col=2 tail -n +2 "$out" > "$tmp" printf "set key Left at $T,0.03\nset term gif\nset output\n $labels\n\ plot \ '$tmp' using 1:2 with lines title \"Node 1\",\ '$tmp' using 1:3 with lines title \"Node 2\",\ '$tmp' using 1:4 with lines title \"Node 3\",\ '$tmp' using 1:5 with lines title \"Node 4\"" | gnuplot > "$gif" gif="$what.node.gif" echo "creating $gif" xlabel="Node" title="Quantum PageRank - graph-$N" labels="set title \"$title\"\nset xlabel \"$xlabel\"\nset ylabel \"$ylabel\"" tail -1 "$out" | fmt -1 | tail -n +2 | cat -n | head -49 | (printf "set term gif\nset output\n $labels\n\ set style data boxes\nset style fill solid\nset boxwidth 0.1\n\ plot '-' notitle\n"; cat) | gnuplot > "$gif" #--- xlabel="Time" ylabel="PageRank" what="QW-PR-1" in="../data/$what.in" out="$what.out" echo "creating $out" ./QW-PR 512 < "$in" > "$out" opts="set yrange [0.1:0.65]\nset ytics 0.1,0.1,0.6" for node in 1 2 do gif="$what-$node.gif" echo "creating $gif" col=$((node+1)) title="Quantum PageRank - Node $node" labels="set title \"$title\"\nset xlabel \"$xlabel\"\nset ylabel \"$ylabel\"" tail -n +2 "$out" | (printf "$opts\nset xtics 0,50,500\nset term gif\nset output\n $labels\n\ plot '-' using 1:$col with lines notitle\n"; cat) | gnuplot > "$gif" opts="" done #--- what="QW-PR-1a" # in same as above out="$what.out" gif="$what.gif" echo "creating $out" ./QW-PR -a 200 < "$in" > "$out" tail -n +2 "$out" > "$tmp" echo "creating $gif" title="Average Quantum PageRank" labels="set title \"$title\"\nset xlabel \"$xlabel\"\nset ylabel \"$ylabel\"" printf "set key Left at 200,0.3\nset term gif\nset output\n $labels\nplot\ '$tmp' using 1:2 with lines title \"Node 1\",\ '$tmp' using 1:3 with lines title \"Node 2\",\ '$tmp' using 1:5 with lines title \"Node 4\"" | gnuplot > "$gif" #--- what="QW-PR-2a" in="../data/QW-PR-2.in" out="$what.out" gif="$what.gif" echo "creating $out" ./QW-PR -a 200 < "$in" > "$out" tail -n +2 "$out" > "$tmp" echo "creating $gif" title="Average Quantum PageRank" labels="set title \"$title\"\nset xlabel \"$xlabel\"\nset ylabel \"$ylabel\"" printf "set key Left outside top right\nset term gif\nset output\n $labels\nplot\ '$tmp' using 1:8 with lines title \"Node 7\",\ '$tmp' using 1:6 with lines title \"Node 5\",\ '$tmp' using 1:7 with lines title \"Node 6\",\ '$tmp' using 1:4 with lines title \"Node 3\",\ '$tmp' using 1:3 with lines title \"Node 2\",\ '$tmp' using 1:2 with lines title \"Node 1\",\ '$tmp' using 1:5 with lines title \"Node 4\"" | gnuplot > "$gif" rm -f "$tmp"