Skip to content

Instantly share code, notes, and snippets.

View MHenderson's full-sized avatar

Matthew Henderson MHenderson

View GitHub Profile
@MHenderson
MHenderson / octave-notebook.ipynb
Last active December 28, 2015 18:39
MATLAB exercises from Computational and Numerical Methods 2, Winter 2013/14, Nottingham Trent University.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# sudoku.py
from __future__ import print_function
import random, itertools, string, operator, copy
import constraint, networkx, sympy, glpk
####################################################################
# Basic parameters
@MHenderson
MHenderson / index.html
Last active November 4, 2021 09:57
Minimal example of vis.js (visjs.org).
<!doctype html>
<html>
<head>
<title>vis.js Graph demo</title>
<script src="http://visjs.org/dist/vis.js"></script>
<link href="http://visjs.org/dist/vis.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="graph"></div>
@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 / networkx-drawing-notebook.ipynb
Last active October 19, 2015 13:11
Graph Drawing in NetworkX
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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 / dimacs2gv
Last active August 25, 2017 00:44
Convert graphs from DIMACS to DOT format.
#!/bin/bash
echo 'graph{'
sed -r -e '/^[cp]/d'\
-e 's/[ae] ([0-9]+)\s([0-9]+)/ \1 -- \2;/g'\
$1
echo '}'