library(igraph)
##
## Attaching package: 'igraph'
## The following objects are masked from 'package:stats':
##
## decompose, spectrum
## The following object is masked from 'package:base':
##
## union
library(kableExtra)
library(bipartite)
## Loading required package: vegan
## Loading required package: permute
##
## Attaching package: 'permute'
## The following object is masked from 'package:igraph':
##
## permute
## Loading required package: lattice
## This is vegan 2.5-7
##
## Attaching package: 'vegan'
## The following object is masked from 'package:igraph':
##
## diversity
## Loading required package: sna
## Loading required package: statnet.common
##
## Attaching package: 'statnet.common'
## The following objects are masked from 'package:base':
##
## attr, order
## Loading required package: network
##
## 'network' 1.17.1 (2021-06-12), part of the Statnet Project
## * 'news(package="network")' for changes since last version
## * 'citation("network")' for citation information
## * 'https://statnet.org' for help, support, and other information
##
## Attaching package: 'network'
## The following objects are masked from 'package:igraph':
##
## %c%, %s%, add.edges, add.vertices, delete.edges, delete.vertices,
## get.edge.attribute, get.edges, get.vertex.attribute, is.bipartite,
## is.directed, list.edge.attributes, list.vertex.attributes,
## set.edge.attribute, set.vertex.attribute
## sna: Tools for Social Network Analysis
## Version 2.6 created on 2020-10-5.
## copyright (c) 2005, Carter T. Butts, University of California-Irvine
## For citation information, type citation("sna").
## Type help(package="sna") to get started.
##
## Attaching package: 'sna'
## The following objects are masked from 'package:igraph':
##
## betweenness, bonpow, closeness, components, degree, dyad.census,
## evcent, hierarchy, is.connected, neighborhood, triad.census
## This is bipartite 2.16.
## For latest changes see versionlog in ?"bipartite-package". For citation see: citation("bipartite").
## Have a nice time plotting and analysing two-mode networks.
##
## Attaching package: 'bipartite'
## The following object is masked from 'package:vegan':
##
## nullmodel
## The following object is masked from 'package:igraph':
##
## strength
library(networkD3)
library(bipartite)
entire_data <- read.table("compressed_edge.data", sep = "\t", header = FALSE)
data <- entire_data[c(1:1500),]
graph_data <- graph.data.frame(data,directed = TRUE)
head(data, 100)
## V1 V2 V3 V4
## 1 justinfernald SebLague JavaScript 0
## 2 justinfernald willgarrett610 JavaScript 0
## 3 justinfernald ikeavin JavaScript 0
## 4 justinfernald llGaetanll JavaScript 0
## 5 justinfernald CStratton00 JavaScript 0
## 6 justinfernald blok601 JavaScript 0
## 7 justinfernald TarVK JavaScript 0
## 8 justinfernald thedinosoar JavaScript 0
## 9 justinfernald brunomaletta JavaScript 0
## 10 justinfernald Jsamyn JavaScript 0
## 11 justinfernald pnghi320 JavaScript 0
## 12 justinfernald jcanode JavaScript 0
## 13 justinfernald Espence308 JavaScript 0
## 14 justinfernald AsherBearce JavaScript 0
## 15 justinfernald KyleLuster JavaScript 0
## 16 justinfernald James-Fritz JavaScript 0
## 17 justinfernald noahr1936 JavaScript 0
## 18 justinfernald Talbert500 JavaScript 0
## 19 justinfernald malikbawa JavaScript 0
## 20 justinfernald AHarris155 JavaScript 0
## 21 justinfernald RCarson10 JavaScript 0
## 22 justinfernald jlopezvaldez JavaScript 0
## 23 justinfernald natsukiabe529 JavaScript 0
## 24 justinfernald neenee21 JavaScript 0
## 25 justinfernald jammil002 JavaScript 0
## 26 justinfernald Luis-1337 JavaScript 0
## 27 justinfernald paul2kandrews JavaScript 0
## 28 justinfernald jakewhitebread JavaScript 0
## 29 willgarrett610 danydo11 Java 1
## 30 willgarrett610 llGaetanll Java 1
## 31 willgarrett610 JustanJap Java 1
## 32 willgarrett610 kraj011 Java 1
## 33 willgarrett610 brunomaletta Java 1
## 34 willgarrett610 justinfernald Java 1
## 35 ikeavin jeffheaton CSharp 1
## 36 ikeavin andersson CSharp 1
## 37 ikeavin LydiaFritz CSharp 1
## 38 ikeavin Jsamyn CSharp 1
## 39 ikeavin sylvedi CSharp 1
## 40 ikeavin justinfernald CSharp 1
## 41 ikeavin malikbawa CSharp 1
## 42 ikeavin jlopezvaldez CSharp 1
## 43 ikeavin natsukiabe529 CSharp 1
## 44 ikeavin Luis-1337 CSharp 1
## 45 ikeavin BCarlin12 CSharp 1
## 46 ikeavin ryan-shimizu CSharp 1
## 47 ikeavin brandondavid714 CSharp 1
## 48 ikeavin paul2kandrews CSharp 1
## 49 ikeavin jakewhitebread CSharp 1
## 50 llGaetanll geohot JavaScript 1
## 51 llGaetanll jonhoo JavaScript 1
## 52 llGaetanll karpathy JavaScript 1
## 53 llGaetanll BrianWill JavaScript 1
## 54 llGaetanll goodfeli JavaScript 1
## 55 llGaetanll torvalds JavaScript 1
## 56 llGaetanll cs0x7f JavaScript 1
## 57 llGaetanll maruohon JavaScript 1
## 58 llGaetanll SebLague JavaScript 1
## 59 llGaetanll zachwildd JavaScript 1
## 60 llGaetanll joelewiss JavaScript 1
## 61 llGaetanll benawad JavaScript 1
## 62 llGaetanll aleantorcha JavaScript 1
## 63 llGaetanll jonlin1000 JavaScript 1
## 64 llGaetanll laine-hallot JavaScript 1
## 65 llGaetanll SamCabV JavaScript 1
## 66 llGaetanll kraj011 JavaScript 1
## 67 llGaetanll mitchweaver JavaScript 1
## 68 llGaetanll hanhpp JavaScript 1
## 69 llGaetanll carykh JavaScript 1
## 70 llGaetanll DevonCrawford JavaScript 1
## 71 llGaetanll TarVK JavaScript 1
## 72 llGaetanll Dalvii JavaScript 1
## 73 llGaetanll hkociemba JavaScript 1
## 74 llGaetanll AbstractMath JavaScript 1
## 75 llGaetanll LukeSmithxyz JavaScript 1
## 76 llGaetanll ldoney JavaScript 1
## 77 llGaetanll BrodieRobertson JavaScript 1
## 78 llGaetanll brunomaletta JavaScript 1
## 79 llGaetanll kiedtl JavaScript 1
## 80 CStratton00 lroe7 C++ 1
## 81 CStratton00 thedinosoar C++ 1
## 82 CStratton00 mxmnci C++ 1
## 83 CStratton00 Jsamyn C++ 1
## 84 CStratton00 pnghi320 C++ 1
## 85 CStratton00 ReuelAbi C++ 1
## 86 CStratton00 jcanode C++ 1
## 87 CStratton00 Espence308 C++ 1
## 88 CStratton00 justinfernald C++ 1
## 89 CStratton00 carsonbfoley C++ 1
## 90 CStratton00 KyleLuster C++ 1
## 91 CStratton00 James-Fritz C++ 1
## 92 CStratton00 rhawks00 C++ 1
## 93 CStratton00 drewesch C++ 1
## 94 CStratton00 Austin-Chandler C++ 1
## 95 CStratton00 RCarson10 C++ 1
## 96 CStratton00 dharmab31 C++ 1
## 97 CStratton00 JakeHafele101 C++ 1
## 98 CStratton00 MicahWillis C++ 1
## 99 blok601 Eluinhost Java 1
## 100 blok601 LeonTG Java 1
wc <- cluster_walktrap(graph_data)
members <- membership(wc)
graph_d3 <- igraph_to_networkD3(graph_data, group = members)
graph_d3$links$value = 1
depth_data = aggregate(data$V4, by=list(data$V1), FUN=function(x) x[1])
graph_d3$nodes$depth = 10
graph_d3$nodes[match(depth_data$Group.1, graph_d3$nodes$name),]$depth = (5 - as.numeric(depth_data$x)) ^ 2 * 50
p = forceNetwork(
Links = graph_d3$links,
Nodes = graph_d3$nodes,
charge = -150,
Source = 'source',
Target = 'target',
NodeID = 'name',
Group = 'group',
Value = 'value',
Nodesize = 'depth',
zoom = T,
opacityNoHover = T,
arrows = T
)
p
small_data <- entire_data[c(1:30),]
small_graph_data <- graph.data.frame(small_data,directed = TRUE)
g = small_graph_data
plot(g)
library(tidyr)
##
## Attaching package: 'tidyr'
## The following object is masked from 'package:igraph':
##
## crossing
entire_lang_data <- read.table("compressed_lang.data", sep = "\t", header = FALSE)
lang_data <- entire_lang_data[c(1:12),]
lang_graph_data <- graph.data.frame(lang_data, directed = F)
V(lang_graph_data)$type <- bipartite_mapping(lang_graph_data)$type
data_attr = as.numeric(unlist(vertex_attr(lang_graph_data), FALSE))
## Warning: NAs introduced by coercion
topValue = max(lang_data$V3)
# more red less confidence
E(lang_graph_data)$color <- rgb(topValue - lang_data$V3, 0, 0, maxColorValue = topValue);
# tkplot(lang_graph_data)
la = layout.bipartite
plot(lang_graph_data, layout=la)
# count occurrences of languages
table(entire_lang_data$V2)
##
## ActionScript Arduino Assembly AutoHotkey
## 1 1 1 3
## C C++ Clojure CSharp
## 44 43 1 50
## CSS D Dart Emacs Lisp
## 4 1 1 1
## FSharp G-code Go Haskell
## 2 1 15 1
## Haxe HTML Java JavaScript
## 1 15 72 132
## Julia Jupyter Notebook Kotlin Lua
## 1 14 3 5
## Matlab MATLAB mcfunction none
## 1 1 1 53
## Objective-C OCaml Pascal PHP
## 2 2 1 15
## Processing Python Ruby Rust
## 1 121 10 17
## Scala Shell Swift SWIG
## 1 9 5 1
## TeX TypeScript VBA Vue
## 4 15 2 1
library(tidyr)
entire_lang_fix_data <- read.table("compressed_lang_fix.data", sep = "\t", header = FALSE)
lang_data_fix <- entire_lang_fix_data[c(1:12),]
lang_graph_fix_data <- graph.data.frame(lang_data_fix, directed = F)
V(lang_graph_fix_data)$type <- bipartite_mapping(lang_graph_fix_data)$type
data_attr = as.numeric(unlist(vertex_attr(lang_graph_fix_data), FALSE))
## Warning: NAs introduced by coercion
topValue = max(lang_data_fix$V3)
# more red less confidence
E(lang_graph_fix_data)$color <- rgb(topValue - lang_data_fix$V3, 0, 0, maxColorValue = topValue);
# tkplot(lang_graph_fix_data)
la = layout.bipartite
plot(lang_graph_fix_data, layout=la)
# count occurrences of languages
table(entire_lang_fix_data$V2)
##
## ActionScript Arduino ASP.NET Assembly
## 1 2 1 1
## AutoHotkey AutoIt C C++
## 3 1 28 15
## Clojure CMake CodeQL CoffeeScript
## 8 1 1 34
## CSharp CSS D Dart
## 37 28 2 8
## EJS Elixir Elm Emacs Lisp
## 1 5 2 11
## Erlang Fortran FSharp G-code
## 2 3 8 1
## Game Maker Language GDScript GLSL Go
## 1 1 1 3
## Groovy Haskell Haxe HTML
## 5 10 1 9
## Java JavaScript Jinja Julia
## 32 20 1 8
## Jupyter Notebook Kotlin Lua Makefile
## 40 9 23 1
## Matlab MATLAB mcfunction none
## 1 5 1 53
## Objective-C OCaml Pascal Perl
## 12 6 1 4
## PHP PowerShell Processing Puppet
## 15 20 3 1
## Python QML R Roff
## 10 1 16 8
## Ruby Rust Scala SCSS
## 2 25 2 5
## Shell SuperCollider Swift SWIG
## 10 1 13 1
## Tcl TeX TypeScript Vala
## 1 5 3 6
## VBA Verilog VHDL Vim script
## 3 8 1 46
## Visual Basic .NET Vue WebAssembly XSLT
## 6 5 5 1
## Zig
## 1