igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] Find six degrees of separation in Actor-Actor Network


From: Enes Abanoz
Subject: [igraph] Find six degrees of separation in Actor-Actor Network
Date: Fri, 18 Jan 2019 04:07:09 +0200 (EET)

Hi,
I've tried to find center node with using shortest.paths option in igraph. When I said the center node I meant that the node has shortest paths to all other nodes.
Sample Network
df <- structure(list(Movie.Name = structure(c(1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L), .Label = c("A", "B", "C",
"D"), class = "factor"), Actor.Name = structure(c(1L, 5L, 6L,
7L, 8L, 5L, 9L, 1L, 10L, 11L, 8L, 12L, 2L, 3L, 4L), .Label = c("Actor1",
"Actor10", "Actor11", "Actor12", "Actor2", "Actor3", "Actor4",
"Actor5", "Actor6", "Actor7", "Actor8", "Actor9"), class = "factor")), .Names = c("Movie.Name",
"Actor.Name"), class = "data.frame", row.names = c(NA, -15L))

My code:
library(igraph)
g_graph <- graph.data.frame(df,directed=FALSE)
V(g_graph)$type <- bipartite_mapping(g_graph)$type
# projecte actor-actor network only
projected_g <- bipartite_projection(g_graph, multiplicity = TRUE, which=TRUE)
# get largest component
getmax = function(g) {
V(g)$comp = clusters(g)$membership
delete.vertices(g, V(g)[V(g)$comp!=which(clusters(g)$csize==max(clusters(g)$csize))])
}
lc_projected_g <- getmax(projected_g)
# Unweight the network
E(lc_projected_g)$weight <- 1
# Find shortes path from one to all nodes
p_short <- shortest.paths(lc_projected_g)
p_df <-as.data.frame(rownames(p_short))
p_df$Total_path_length <- rowSums(p_short)
# Create infos 
projected_deg <- degree(lc_projected_g)
projected_bet <- betweenness(lc_projected_g)
projected_clos <- closeness(lc_projected_g)
projected_eig <- eigen_centrality(lc_projected_g)$vector
projected_cent_df <- data.frame(projected_deg, projected_bet, projected_clos, projected_eig) 

My question are:
- In igraph weight is considered as a cost or close relation it will effect the distance of path so it should be better to make all weight 1 in actor-actor network. Even though there are many edges between Actor01 and Actor02 , the length of path will be one! Is this right?
- When I calculate the total shortest path between all nodes, there are three nodes have same value. In this case should I look for eigenvector centrality to find right node that will be considered the center node or starting point.
-  When I projected the bipartite network into Actor-Actor network, I'am losing the the names of edges that are important for me. How can I get assign edge name into Actor-Actor network.
Best Regards,
   

--
Enes Abanoz, PhD
Ondokuz Mayıs Üniversitesi
İletişim Fakültesi
Mustafa Kemal Güneşdoğdu Kampüsü Çarşamba/Samsun
+90362 445 1138/7919

reply via email to

[Prev in Thread] Current Thread [Next in Thread]