Watts-College / crj-507-spring-2024

https://watts-college.github.io/crj-507-spring-2024/
MIT License
1 stars 0 forks source link

Lab 4 Part 1 Question 5 #22

Closed n-galanos closed 6 months ago

n-galanos commented 6 months ago

I am having an issue with "Calculate the graph centralization for degree, closeness, and betweenness centrality."

To calculate graph centralization I used the following code which worked;

cent.u <- centralization( LondonGangNet, degree, mode="graph" )

But when I try to code it for closeness and betweenness, I receive the following error;

centralization(closeness(LondonGangNet)) Error in as.edgelist.sna(dat) : as.edgelist.sna input must be an adjacency matrix/array, edgelist matrix, network, or sparse matrix, or list thereof.

I also tried the following code and received same error;

closeness(cent.u) Error in as.edgelist.sna(dat) : as.edgelist.sna input must be an adjacency matrix/array, edgelist matrix, network, or sparse matrix, or list thereof.

Same issue when trying to code for betweenness

n-galanos commented 6 months ago

I might have figured it out... would it be;

centralization( LondonGangNet, closeness, mode="graph" )

centralization( LondonGangNet, betweenness, mode="graph" )

CGUEVARR commented 6 months ago

@n-galanos that's the code I used as well. Following to confirm this is correct.

jacobtnyoung commented 6 months ago

Hi @n-galanos ! Yes, that is correct! Nice job figuring it out. Thanks @CGUEVARR for chiming in!