Skip to content

Instantly share code, notes, and snippets.

@emeeks
emeeks / README.md
Last active March 25, 2024 07:56 — forked from mbostock/.block
An online tool for interactive teaching of network visualization and representation principles.

The range sliders at the top change the values for the force-directed algorithm and the buttons load new graphs and apply various techniques. This will hopefully serve as a tool for teaching network analysis and visualization principles during my Gephi courses and general Networks in the Humanities presentations.

Notice this includes a pretty straightforward way to load CSV node and edge lists as exported from Gephi.

It also includes a pathfinding algorithm built for the standard data structure of force-directed networks in D3. This requires the addition of .id attributes for the nodes, however.

Now with Clustering Coefficients!

Also, it loads images for nodes but the images are not in the gist. The code also refers to different network types but the data files on Gist only refer to the transportation network.

@benmarwick
benmarwick / JSTOR2MALLET.r
Last active January 24, 2018 22:29
R code to take JSTOR DfR wordcount CSV files and convert them to the bags of words txt files ready for input to MALLET
# set working directory, ie. location of JSTOR DfR CSV
# files on the computer
setwd("C:\\some directory with JSTOR DfR CSV files")
# create a list of all the CSV files
myFiles <- list.files(pattern="*.csv|CSV")
# read in all the CSV files to an R data object
myData <- lapply(myFiles, read.csv)
@emeeks
emeeks / d3.layout.cloud.js
Last active July 22, 2021 06:03
Topic Clouds using D3 Word Cloud Layout
// Word cloud layout by Jason Davies, http://www.jasondavies.com/word-cloud/
// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf
(function(exports) {
function cloud() {
var size = [256, 256],
text = cloudText,
font = cloudFont,
fontSize = cloudFontSize,
rotate = cloudRotate,
padding = cloudPadding,