Here is the complete R script that we have used to demonstrate product network analysis:
library(igraph, quietly = TRUE)## Creating a simple graphsimple.graph <- graph_from_literal(A-B, B-C, C-D, E-F, A-E, E-C)plot.igraph(simple.graph)## Graph propertiesE(simple.graph) # EdgesV(simple.graph) # Vertices## Graph attributesV(simple.graph)$name <- c('alice', 'bob','charlie','david', 'eli','francis')simple.graph <- set_vertex_attr(simple.graph ,"age", value = c('11', '11','15','9', '8','11'))plot.igraph(simple.graph)V(simple.graph)$color <- ifelse(V(simple.graph)$age == '11', "blue","green")plot.igraph(simple.graph)# Structural propertiesdegree(simple.graph) # degree of nodesE(simple.graph)$weight <- c(10,20,35,15,25,35) ...