Skip to content

Instantly share code, notes, and snippets.

using Plots, DataFrames, CSV, Statistics
## Get positions for each state
# From https=> //github.com/jkbren/covid19-cases-grid-gartogram/blob/master/covid19-cases-grid-gartogram.ipynb
state_posx = Dict("ak"=> (0, 0), "me"=> (0, 10),"gu"=> (7, 0), "vi"=> (7, 9), "pr"=> (7, 8), "mp"=> (7, 1),
"vt"=> (1, 9), "nh"=> (1, 10),"wa"=> (2, 0), "id"=> (2, 1), "mt"=> (2, 2), "nd"=> (2, 3), "mn"=> (2, 4),
"il"=> (2, 5), "wi"=> (2, 6), "mi"=> (2, 7), "ny"=> (2, 8), "ri"=> (2, 9), "ma"=> (2, 10),"or"=> (3, 0),
"nv"=> (3, 1), "wy"=> (3, 2), "sd"=> (3, 3), "ia"=> (3, 4), "in"=> (3, 5), "oh"=> (3, 6), "pa"=> (3, 7),
"nj"=> (3, 8), "ct"=> (3, 9), "ca"=> (4, 0), "ut"=> (4, 1), "co"=> (4, 2), "ne"=> (4, 3), "mo"=> (4, 4),
"ky"=> (4, 5), "wv"=> (4, 6), "va"=> (4, 7), "md"=> (4, 8), "de"=> (4, 9), "az"=> (5, 1), "nm"=> (5, 2),
"ks"=> (5, 3), "ar"=> (5, 4), "tn"=> (5, 5), "nc"=> (5, 6), "sc"=> (5, 7), "d
@dgleich
dgleich / triangle-law.jl
Last active September 25, 2018 20:44
Eigenvalues of Triangle Normalized Laplacian in Julia Code
##
using LinearAlgebra
using SparseArrays
using StatsBase
using Plots
using MatrixNetworks
# for Julia 1.0, you need to run
# using Pkg; Pkg.add("MatrixNetworks#2f5c59c")
# to get the latest 1.0 compatible version.
pyplot()
@dgleich
dgleich / failure.degs
Last active August 29, 2016 16:40
A set of degree that cause an underflow for a plfit command (https://github.com/ntamas/plfit/issues/13)
171
563
43
53
82
69
27
20
270
30

Keybase proof

I hereby claim:

  • I am dgleich on github.
  • I am dgleich (https://keybase.io/dgleich) on keybase.
  • I have a public key whose fingerprint is D734 F90F 005B 5BEB 993A EFA4 47D9 CBF5 CC13 99D7

To claim this, I am signing this object:

@dgleich
dgleich / hk_comm_demo.py
Created August 27, 2014 12:46
Heat Kernel Based Community Detection
# Heat Kernel Based Community Detection
# by Kyle Kloster and David F. Gleich
# supported by NSF award CCF-1149756.
#
# This demo shows our algorithm running on the Twitter graph.
# Our other codes are available from David's website:
#
# https://www.cs.purdue.edu/homes/dgleich/codes/hkgrow/
#
# To use this demo, you need pylibbvg graph by David Gleich, Wei-Yen Day, and
@dgleich
dgleich / gexpmq.py
Last active August 29, 2015 13:58
A Gauss-Seidel based method to approximate the matrix exponential of a stochastic matrix using a queue
"""
demo_gexpmq.py
A demonstration of the Gauss-Seidel coordinate relaxation scheme
to estimate a column of the matrix exponential that operates
only on significant entries.
Written by Kyle Kloster and David F. Gleich
"""
@dgleich
dgleich / matlabmail.m
Last active June 12, 2023 12:23
A function to send an email from a gmail account in matlab
function recipient = matlabmail(recipient, message, subject, sender, psswd)
% MATLABMAIL Send an email from a predefined gmail account.
%
% MATLABMAIL( recipient, message, subject )
%
% sends the character string stored in 'message' with subjectline 'subject'
% to the address in 'recipient'.
% This requires that the sending address is a GMAIL email account.
%
% MATLABMAIL( recipient, message, subject, sender, passwd )
@dgleich
dgleich / hkrelax.py
Last active September 12, 2017 09:00
"""
hkrelax.py
A demonstration of a relaxation method for computing a heat-kernel based
community that implements the algorith from "Heat-kernel based community
detection" by Kloster & Gleich.
Written by Kyle Kloster and David F. Gleich
"""
@dgleich
dgleich / netflix_svd.m
Last active January 3, 2017 04:21
SVD testing code for the netflix matrix, by David F. Gleich and Yangyang Hou.
%% Read Netflix dataset
A = readSMAT('/scratch/dgleich/netflix/netflix.smat');
k = [10 25 50 100 150 200];
l = size(k,2);
%% Matlab's SVDS
for i= 1:l
tic;
[U,S,V] = svds(A,k(i));
@dgleich
dgleich / pprcd.py
Last active October 15, 2020 03:13
Personalized PageRank community detection
import collections
import sys
# setup the graph
G = {
1:set([ 2, 3, 5, 6,]),
2:set([ 1, 4,]),
3:set([ 1, 6, 7,]),
4:set([ 2, 5, 7, 8,]),
5:set([ 1, 4, 6, 8, 9, 10,]),