I made two-mode network to analyze if it's scale free or not.
I used igraph package in R. I made two-mode to one-mode network by cross-product. And I made igraph for each period data. It is an undirected network. I know how to make scale-free network but I can't see my graph is scale-free.
My code is
# Load and Make 1-mode matrix
function_1mode <- function(x) {
p_csv <- read.csv(x, header=T)
p_csv <- p_csv %>% select(-X)
A <- as.matrix(p_csv)
R <- t(A)%*%A
diag(R) <- 0
return(R)
}
# Make 2-mode matrix
Mode_1 = function_1mode(x = "P1_IPC.csv")
Mode_2 = function_1mode(x = "P2_IPC.csv")
Mode_3 = function_1mode(x = "P3_IPC.csv")
# Make a graph for each matrix
g1 = graph.adjacency(Mode_1, mode='undirected', weighted = TRUE, diag=FALSE)
g2 = graph.adjacency(Mode_2, mode='undirected', weighted = TRUE, diag=FALSE)
g3 = graph.adjacency(Mode_3, mode='undirected', weighted = TRUE, diag=FALSE)
# Vertex and Edge info
v_count3 <- vcount(g3)
e_count3 <- ecount(g3)
e_weight3 <- get.data.frame(g3)
# Degree Centrality
deg_g3 <- degree(g3)
D3 <- as.matrix(deg_g3)
# Betweeness Centrality
btw3 <- betweenness(g3)
B3 <- as.matrix(btw3)
# Evcent Centrality
evc3 <- evcent(g3)$vector
E3 <- as.matrix(evc3)
# Centralization
ctrl3 <- centralization.degree(g3)$centralization
# Density
dnsty3 <- edge_density(g3, loops=TRUE)
# Components
cmp3_no <- components(g3)$no
cmp3_size <- components(g3)$csize
I wanna see if my network 'g3' is scale-free or not by using code in R.