Pablo Galaso
Pablo Galaso

Reputation: 31

How can I make an ego graph of a given vertex (igrap)

I'm trying to make and plot an ego network of a given vertex in a larger network. I get my network from a csv file containing a weighted edge list:

art<-read.csv(file.choose("art.csv"))
g_art<-graph.data.frame(art)

Then, I use the function make_ego_graph as follows:

g_ego_art<-make_ego_graph(g_art, order=2, nodes = "PLAZA")

Then I try to plot the vertex PLAZA's ego netrwork and I get this error:

plot(g_ego_art)
Error in xy.coords(x, y, xlabel, ylabel, log) : 
  'x' is a list, but does not have components 'x' and 'y'

Any help, please? Thanks!

Upvotes: 3

Views: 2369

Answers (1)

john zhang
john zhang

Reputation: 39

make_ego_graph will return a list of ego network... if u want to see the first one, simply plot(g_ego_art[[1]])

Upvotes: 3

Related Questions