X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=home%2Fbin%2Fseq2dot;h=0d6a3c47fa0e3fe57ae2235439243724ee9785ae;hb=773a0061dccdd6763fbff37335038aa636960add;hp=d91e45b24b2bc358a7c941f20e36150268f58f0c;hpb=ddc6816246140f30a1fbb3742e5b236708cd2b88;p=khome.git diff --git a/home/bin/seq2dot b/home/bin/seq2dot index d91e45b..0d6a3c4 100755 --- a/home/bin/seq2dot +++ b/home/bin/seq2dot @@ -4,24 +4,46 @@ # highlighting frequencies of pairings. # -BEGIN {print "digraph {"} - { - prev = prev ? prev : "--" curr = $0 +} + +NR == 1 { + init = curr +} + +NR > 1 { ++nlinks[prev] ++nlinks_to[prev, curr] +} + +{ prev = curr } END { + final = curr + print "digraph {" + if (init == final) { + printf \ + "\"%s\" [penwidth=10, style=filled, fillcolor=tomato , fontcolor=white, color=yellowgreen];\n", \ + init + } else { + printf \ + "\"%s\" [penwidth=0, style=filled, fillcolor=yellowgreen, fontcolor=white];\n", \ + init + printf \ + "\"%s\" [penwidth=0, style=filled, fillcolor=tomato , fontcolor=white];\n", \ + final + } + for (src_dst in nlinks_to) { split(src_dst, sd, SUBSEP); src = sd[1] dst = sd[2] m = nlinks[src] n = nlinks_to[src, dst] - penwidth = num_scale(n, m, 1, 9) + penwidth = num_scale(n, m, 1, 5) color = sprintf("/orrd9/%d", num_scale(n, m, 2, 9)) label = sprintf("%s %.2f%%", src, (n / m) * 100) printf \