saladi
saladi

Reputation: 3263

Using the nodes argument for centrality metrics in sna

I am trying to calculate centrality metrics for a specific node within a graph using statnet (I can't just use igraph since it doesn't have certain metrics I'd like).

How do I use the nodes argument of these functions to specify this? For example, take prestige

# use the faux.magnolia.high dataset from ergm (1461 vertices and 974 edges)
library("ergm")
data(“faux.magnolia.high”)

# Try calculating for node 1
sna::prestige(faux.magnolia.high, nodes = 1, gmode = "graph")

1

# Try calculating for node 2
sna::prestige(faux.magnolia.high, nodes = 2, gmode = "graph")

NA

Upvotes: 0

Views: 107

Answers (1)

saladi
saladi

Reputation: 3263

Looks like this is a bug in degree-related versions of prestige. This will work but calculations will be done on the whole graph:

sna::prestige(faux.magnolia.high, gmode = "graph")[2] 

See Skye's full response on the statnet mailing list: http://mailman13.u.washington.edu/pipermail/statnet_help/2016/002175.html

Upvotes: 1

Related Questions