Skip to content

Instantly share code, notes, and snippets.

View MHenderson's full-sized avatar

Matthew Henderson MHenderson

View GitHub Profile
@MHenderson
MHenderson / Makefile
Last active August 29, 2015 13:57
vis.js DOT language support.
options.js: options.coffee
coffee --bare --compile options.coffee
CC=gcc
CFLAGS=-I/usr/local/include/igraph\
-L/usr/local/lib\
-ligraph\
-ljansson\
-lcunit
petersen_tests: petersen_tests.c
$(CC) $(CFLAGS) -o $@ $<
@MHenderson
MHenderson / index.html
Last active August 29, 2015 13:59
Demonstration of Dracula Graph Library.
<html>
<head>
<script type="text/javascript" src="dracula/js/raphael-min.js"></script>
<script type="text/javascript" src="dracula/js/dracula_graffle.js"></script>
<script type="text/javascript" src="dracula/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="dracula/js/dracula_graph.js"></script>
<script type="text/javascript">
window.onload = function() {
var width = 400;
@MHenderson
MHenderson / Makefile
Last active August 29, 2015 13:59
Demonstration of vis.js options.
options.js: options.coffee
coffee --bare --compile options.coffee
@MHenderson
MHenderson / lobster.gexf
Last active August 29, 2015 14:00
Random lobster in GEXF format
<?xml version="1.0" encoding="utf-8"?><gexf version="1.1" xmlns="http://www.gexf.net/1.1draft" xmlns:viz="http://www.gexf.net/1.1draft/viz" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/XMLSchema-instance">
<graph defaultedgetype="undirected" mode="static">
<nodes>
<node id="0" label="0" />
<node id="1" label="1" />
<node id="2" label="2" />
<node id="3" label="3" />
<node id="4" label="4" />
<node id="5" label="5" />
<node id="6" label="6" />
@MHenderson
MHenderson / Makefile
Last active August 29, 2015 14:01
Greedy colouring of Queen Graphs.
src_dir:=~/workspace/graphs-collection/src/Colouring/Trick
generate_seeds:=./generate_seeds
simulation:=./simulation2
get_colours:=get_colours.sed
output:=output.txt
approx:=chromatic_approx.txt
seeds:=seeds.txt
problem_file:=$(src_dir)/queen16_16.col
result_file=$(addsuffix .res, $(problem_file))
@MHenderson
MHenderson / colour
Last active August 29, 2015 14:01
Apply a colouring from Culberson's colouring programs output to a file in DOT format.
!#/bin/bash
r=1 # colouring number. Look at row 2r of the .res file.
n=1
p=$(( 2 * r ))
s=`sed "$p!d" $1` #generalise from 2 to 2r
while [ -n "$s" ]
do
temp=${s#?}
char=${s%"$temp"}
@MHenderson
MHenderson / Makefile
Created May 30, 2014 10:29
Drawing Coloured Queen Graphs
output_dir:=./output
svg_options:=-s\
-Tsvg\
-Gsize=4,4\!\
-Nwidth=1\
-Nheight=1\
-Nfixedsize=true\
-Nlabel=\
-Nshape=box\
@MHenderson
MHenderson / Makefile
Created June 5, 2014 13:33
Colouring the Frucht graph with gvpr.
output_dir:=./output
src_dir=.
svg_options:=-s\
-Tsvg\
-Gsize=4,4\!\
-Groot=3\
-Nwidth=0.3\
-Nfixedsize=true\
-Nlabel=\
@MHenderson
MHenderson / simulation
Created June 27, 2014 11:01
Improved greedy colouring of small graphs with ccli.
#!/bin/bash
orders=( 0 0 1 3 10 33 155 1043 12345 274667 )
type=simple
for ordering in random incdeg decdeg inorder
do
for n in {2..8}
do
src_folder=/home/matthew/workspace/graphs-collection/src/Small/$n