This is the interactive version of the network graph #86. You should first understand how this one works.

The graph is made interactive thanks to the networkD3 R package that produces HTML code using d3.js.

Thanks to Koba Khitalishvili for his contribution !

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# Libraries library("networkD3") library('randomNames') library("igraph") # Create data with the randomNames package : NUMOFLINKS = 100 relations = data.frame(source = randomNames(1000,which.names='both'), target = "") relations = relations[rep(seq_len(nrow(relations)), sample(1:10,nrow(relations), replace=T)),] relations = relations[sample(nrow(relations),NUMOFLINKS),] relations$target = sample(relations$source,nrow(relations), replace = T) relations = relations[relations[,1]!=relations[,2], ] vertices<-data.frame("name" = unique(unlist(relations))) # node names g = graph.data.frame(relations, directed=F, vertices=vertices) # raw graph vertices$group = edge.betweenness.community(g)$membership # betweeness centrality for each node for grouping # create indices for each name to fit forceNetwork data format relations$source.index = match(relations$source, vertices$name)-1 relations$target.index = match(relations$target, vertices$name)-1 # sophisticated network graph d3 = forceNetwork(Links = relations, Nodes = vertices, Source = "source.index", Target = "target.index", NodeID = "name", Group = "group", # color nodes by betweeness calculated earlier charge = -70, # node repulsion linkDistance = 25, zoom = T) # If you want to show the graph #show(d3) #If you want to save the graph as html file saveNetwork(d3,file = '#87_Interactive_network.html',selfcontained = F) |

Not what you are looking for ? Make a new search !

`[mediatagger]`

thanks. thank you so much

i want to save my networkD3. i can do it because of this posting