I have recently generated the following code to perform a social network
analysis with R in igraph. I am not sure whether the results are correct
because I don't know how to check using other programs. Any help is
appreciated! thanks. here is the code:
Import the txt file which looks as following (The first row specifies the code
for the different nodes, the other rows specifies the weights of edges).
'A','B','C','D','E','F','G','H',
0,0,5,0,0,0,4,0,4,8,2,1,5
0,0,4,0,0,0,0,0,1,0,1,0,0
5,3,0,0,10,2,7,1,0,4,3,10,3
2,0,1,0,6,0,2,4,2,1,3,0,5
2,0,10,5,0,2,8,2,4,0,4,3,3
0,2,2,0,1,0,5,0,1,0,1,1,1
2,0,8,3,9,1,0,2,5,1,5,10,11
1,1,7,2,4,1,1,0,1,0,3,0,1
Once imported I want to transform it in an adjacency matrix taking into
consideration the direction of communication and the weights.
ABC = read.table (filename, header = TRUE, sep = ",")
n <- as.matrix ( ABC )
ng <- graph.adjacency ( n, weighted = TRUE )
betw <- betweenness ( ng, directed = TRUE, weights = E ( ng )$weight )
IS it ok for igraph to have the name of the nodes just in the first row and not
in the first column to generate an adjacency matrix? i have read somewhere it
is the same as having the first column with 'A','B','C',etc
I want then to calculate the betweenness, that will return a result for each
node, but I am not sure whether the weights are inserted correctly in the
function. Can somebody pls help?
Is there a way I can check the results using other programs?
Thanks!
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help