Skip to content

Instantly share code, notes, and snippets.

View maruthiprithivi's full-sized avatar
👨‍💻
Builder @typeless

Maruthi Prithivirajan maruthiprithivi

👨‍💻
Builder @typeless
View GitHub Profile
@maruthiprithivi
maruthiprithivi / index.html
Last active August 29, 2015 14:12 — forked from mbostock/.block
<!DOCTYPE html>
<meta charset="utf-8">
<title>Force-Directed Graph</title>
<style>
.node {
cursor: pointer;
stroke: #3182bd;
stroke-width: 1.5px;
}
doInstall <- TRUE
toInstall <- c("sna", "igraph")
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
adjacencyList <- read.csv("https://dl.dropbox.com/s/8wabcrtqxysp03u/Twitter_network.R.csv?dl=1")
head(adjacencyList)
adjacencyMatrix <- table(adjacencyList)
as.matrix(sort(rowSums(adjacencyMatrix))) # Out-degree