0

I am trying to calculate degree centrality, eigenvetor centrality and bonacich power centrality using igraph package in R. My data is South Korea's commuting data.

My data looks like this1st column: orientation region code, 2nd column: destination region code, 3rd column: commuting times between the two regions

I have made igraph graph using function graph_from_data_frame() like the picture below. od18 is the data I used. The same one mentioned at the first picture. But here are my problems.

  1. I can't make an adjacency matrix using this graph.

: Error in get.adjacency.sparse(graph, type = type, attr = attr, edges = edges, : Sparse matrices must be either numeric or logical,and the edge attribute is not

this is the code I executed. this is the error.

Actually, I don't care about the adjacency matrix if centrality calculations don't have problems. But I am worrying what if this means that I am not going to get correct results of centrality calculations.

  1. I tried to calculate the degree centrality using function degree() but the results values are all same. All of my nodes have the same degree values as 250.

  2. Any help about Bonacich power centrality using -beta.

Can you help me with these problems?

Mir
  • 63
  • 6
  • Please read how to create a reproducible example so you can get help easier. https://stackoverflow.com/help/minimal-reproducible-example – programandoconro Jul 27 '21 at 10:05
  • As noted by @programandoconro your question does not really provide enough information, but based on what you have shown it appears that all nodes may in fact have a degree of 250. If you have 250 nodes and there is a nonzero commuting time between all nodes, then all nodes have a degree of 250 (they have a tie to each other node) . I'm not sure that bonacich power centrality is well defined for this kind of network. Your issue may have more to do with network measurement than coding. – tvg Jul 27 '21 at 12:00

0 Answers0