Skip to content

Instantly share code, notes, and snippets.

@MHenderson
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MHenderson/26c4ac03f81f476b6526 to your computer and use it in GitHub Desktop.
Save MHenderson/26c4ac03f81f476b6526 to your computer and use it in GitHub Desktop.
Chromatic indices of small graphs with few edges.
ORDER_MIN=2
ORDER_MAX=9
SIZE_MIN=1
SIZE_MAX=10
GENG="geng -qc"
compute_chromatic()
for graph in $INPUT/*;
do
chromatic ${graph} >> $OUTPUT
done
make_distribution()
for j in `seq $ORDER_MIN $ORDER_MAX`
do
echo -e $j'\t' `grep -Fcx $j $INPUT` >> $OUTPUT
done
echo -e Total:'\t' `cut -f 2 $OUTPUT | paste -sd+ | bc` >> $OUTPUT
plot()
echo "\
clear;
reset;
set style data histogram;
set style histogram columnstacked;
set style fill solid border;
set boxwidth 0.95 relative;
unset key;
set term png;
set output \"$[OUTPUT]\";
plot for [COL=$[ORDER_MIN]:$[ORDER_MAX]] '$[INPUT]' using COL title columnheader;
" | gnuplot
split()
mkdir -p $OUTPUT
csplit -sz -b '%d.gv' -f$OUTPUT/ $INPUT '/^graph.*/' '{*}'
data/2_gv <- [-timecheck]
$GENG 2 $SIZE_MIN:$SIZE_MAX | linegraphg -q | listg -y >> $OUTPUT
data/3_gv <- [-timecheck]
$GENG 3 $SIZE_MIN:$SIZE_MAX | linegraphg -q | listg -y >> $OUTPUT
data/4_gv <- [-timecheck]
$GENG 4 $SIZE_MIN:$SIZE_MAX | linegraphg -q | listg -y >> $OUTPUT
data/5_gv <- [-timecheck]
$GENG 5 $SIZE_MIN:$SIZE_MAX | linegraphg -q | listg -y >> $OUTPUT
data/6_gv <- [-timecheck]
$GENG 6 $SIZE_MIN:$SIZE_MAX | linegraphg -q | listg -y >> $OUTPUT
data/7_gv <- [-timecheck]
$GENG 7 $SIZE_MIN:$SIZE_MAX | linegraphg -q | listg -y >> $OUTPUT
data/8_gv <- [-timecheck]
$GENG 8 $SIZE_MIN:$SIZE_MAX | linegraphg -q | listg -y >> $OUTPUT
data/9_gv <- [-timecheck]
$GENG 9 $SIZE_MIN:$SIZE_MAX | linegraphg -q | listg -y >> $OUTPUT
data/2_gv_split <- data/2_gv [method:split]
data/3_gv_split <- data/3_gv [method:split]
data/4_gv_split <- data/4_gv [method:split]
data/5_gv_split <- data/5_gv [method:split]
data/6_gv_split <- data/6_gv [method:split]
data/7_gv_split <- data/7_gv [method:split]
data/8_gv_split <- data/8_gv [method:split]
data/9_gv_split <- data/9_gv [method:split]
results/2_chromatic.txt <- data/2_gv_split [method:compute_chromatic]
results/3_chromatic.txt <- data/3_gv_split [method:compute_chromatic]
results/4_chromatic.txt <- data/4_gv_split [method:compute_chromatic]
results/5_chromatic.txt <- data/5_gv_split [method:compute_chromatic]
results/6_chromatic.txt <- data/6_gv_split [method:compute_chromatic]
results/7_chromatic.txt <- data/7_gv_split [method:compute_chromatic]
results/8_chromatic.txt <- data/8_gv_split [method:compute_chromatic]
results/9_chromatic.txt <- data/9_gv_split [method:compute_chromatic]
results/2_distribution.txt <- results/2_chromatic.txt [method:make_distribution]
results/3_distribution.txt <- results/3_chromatic.txt [method:make_distribution]
results/4_distribution.txt <- results/4_chromatic.txt [method:make_distribution]
results/5_distribution.txt <- results/5_chromatic.txt [method:make_distribution]
results/6_distribution.txt <- results/6_chromatic.txt [method:make_distribution]
results/7_distribution.txt <- results/7_chromatic.txt [method:make_distribution]
results/8_distribution.txt <- results/8_chromatic.txt [method:make_distribution]
results/9_distribution.txt <- results/9_chromatic.txt [method:make_distribution]
output/table.txt <- results/2_distribution.txt,
results/3_distribution.txt,
results/4_distribution.txt,
results/5_distribution.txt,
results/6_distribution.txt,
results/7_distribution.txt,
results/8_distribution.txt,
results/9_distribution.txt
paste $INPUTS | cut -f 1,2,4,6,8,10,12,14,16 > $OUTPUT
output/data.tsv <- output/table.txt
head -n-1 $INPUT\
| sed -e '1i X\t2\t3\t4\t5\t6\t7\t8\t9\t' >> $OUTPUT
output/histogram.png <- output/data.tsv [method:plot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment