Skip to content

Instantly share code, notes, and snippets.

@mattgillooly
mattgillooly / README.md
Last active May 26, 2020 03:43 — forked from jdfekete/README.md
Matrix diagram that visualizes companion planting

Source: The Stanford GraphBase

A network can be represented by an adjacency matrix, where each cell ij represents an edge from vertex i to vertex j. Here, vertices represent characters in a book, while edges represent co-occurrence in a chapter.

Given this two-dimensional representation of a graph, a natural visualization is to show the matrix! However, the effectiveness of a matrix diagram is heavily dependent on the order of rows and columns: if related nodes are placed closed to each other, it is easier to identify clusters and bridges.

This example lets you try different orderings via the drop-down menu. This type of diagram can be extended with manual reordering of rows and columns, and expanding or collapsing of clusters, to allow deeper exploration. Jacques Bertin (or more specifically, his fleet of assistants) did this by hand with

@mattgillooly
mattgillooly / keybase.md
Created December 11, 2017 03:54
keybase.md

Keybase proof

I hereby claim:

  • I am mattgillooly on github.
  • I am mattgillooly (https://keybase.io/mattgillooly) on keybase.
  • I have a public key ASCHM3W9sUBIyiPZiH1ijaQPXHpxz3HFQi9958fy8xgY8wo

To claim this, I am signing this object:

#!/usr/bin/env ruby
#
# Graph dependencies from a Drakefile using Graphviz
#
# USAGE: drake --print +... | ruby drakeviz.rb out.png
#
require 'graphviz'
class Step < Struct.new(:inputs, :outputs)
require 'graphviz'
class Step < Struct.new(:inputs, :outputs)
def each_edge(&block)
inputs.product(outputs).each(&block)
end
end
unless TARGET_FILENAME = ARGV[0]
fail "missing TARGET_FILENAME"
CONVERTED_VIDEOS := $(patsubst %.AVI,%.mp4,$(wildcard *.AVI))
%.mp4 : %.AVI
ffmpeg -i $< -threads 2 -acodec libfaac -vcodec libx264 -s 484x272 $@
all : $(CONVERTED_VIDEOS)
require 'rake'
require 'csv'
require 'json'
file "Providence_Tree_Inventory.geojson" => "Providence_Tree_Inventory.csv" do |t, args|
trees = CSV.read(t.prerequisite_tasks[0].name, headers: true)
features = trees.map{|tree|
address = tree["Property Address"]
@mattgillooly
mattgillooly / hippo.rb
Created January 29, 2012 00:44
Ruby-encrusted Hippos!
# a Hunngrypotamus joint, 2012
require 'rubygems'
require 'serialport'
class Hippo
CLAIMED = 'c'
ABANDONED = 'a'
BITE = 'b'
<?xml version="1.0" encoding="utf-8"?><opml version="1.0"><head><title>RI Nexus Twits</title></head><body><outline text="RI Nexus Twits"><outline title="JackTemplin" text="JackTemplin" xmlUrl="http://twitter.com/statuses/user_timeline/JackTemplin.rss" type="rss" htmlUrl="http://twitter.com/JackTemplin"/><outline title="RINexus" text="RINexus" xmlUrl="http://twitter.com/statuses/user_timeline/RINexus.rss" type="rss" htmlUrl="http://twitter.com/RINexus"/><outline title="coreycantrell" text="coreycantrell" xmlUrl="http://twitter.com/statuses/user_timeline/coreycantrell.rss" type="rss" htmlUrl="http://twitter.com/coreycantrell"/><outline title="mikeauclair" text="mikeauclair" xmlUrl="http://twitter.com/statuses/user_timeline/mikeauclair.rss" type="rss" htmlUrl="http://twitter.com/mikeauclair"/><outline title="cpjolicoeur" text="cpjolicoeur" xmlUrl="http://twitter.com/statuses/user_timeline/cpjolicoeur.rss" type="rss" htmlUrl="http://twitter.com/cpjolicoeur"/><outline title="Kishfy" text="Kishfy" xmlUrl="http://tw
#Shoe showed me this cool new pastie-killer with the sweet-ass Github backend. Whooo!
1000.times do
puts "THanks, shoe!"
end