## Not run:
# require(igraph)
# igraph_network <- graph.famous("Walther")
#
# # get data and plot :
# data <- toVisNetworkData(igraph_network)
# visNetwork(nodes = data$nodes, edges = data$edges)
#
# # or plot directly
# visIgraph(igraph_network)
#
# # change layout
# visIgraph(igraph_network, layout = "layout_in_circle")
#
# # options
# visIgraph(igraph_network, layout = "layout_in_circle",
# physics = FALSE, smooth = TRUE)
#
# # passing some info
# g <- graph.star(8)
# V(g)$color <- c("green", "grey")
# V(g)$size <- 1:8 *5
# V(g)$label <- LETTERS[1:8]
# V(g)$label.cex = seq(1, 2,length.out = 8)
# V(g)$label.color = "red"
# visIgraph(g, layout = "layout.circle", idToLabel = FALSE)
#
# g <- graph.full(5)
# E(g)$weight <- runif(ecount(g))
# E(g)$width <- 1
# E(g)$color <- "red"
# E(g)[ weight < 0.5 ]$width <- 4
# E(g)[ weight < 0.5 ]$color <- "green"
# E(g)$label <- LETTERS[1:10]
# E(g)$label.cex = seq(1, 2,length.out = 10)
# E(g)$label.color = "red"
# visIgraph(g)
#
# # color vertices of the largest component
# largest_comp <- function(graph) {
# cl <- components(graph)
# V(graph)[which.max(cl$csize) == cl$membership]
# }
# g <- sample_(gnp(100, 2/100),
# with_vertex_(size = 3, label = ""),
# with_graph_(layout = layout_with_fr)
# )
# giant_v <- largest_comp(g)
# V(g)$color <- "blue"
# V(g)[giant_v]$color <- "orange"
# plot(g)
# visIgraph(g)
# ## End(Not run)
Run the code above in your browser using DataLab