r - Find name of node associated with maximum degree in igraph data frame -


i using igraph package find degree of each node (the built in degree(g) function) , returns numeric vector. how can tell node has maximum degree (not value node name)?

if have igraph data frame g, can create true/false vector degree(g)==max(degree(g)). can use find name of node(s) meet criteria - v(g)$name[degree(g)==max(degree(g))].

i created small example illustrate:

library(igraph) df = data.frame(node1=c("bob", "jim", "dave", "dave"),                 node2=c("jane", "john", "sally", "al"))  g = graph.data.frame(df) v(g)$name[degree(g)==max(degree(g))] [1] "dave" 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -