Reputation: 554
I have a large directed network and I'm trying to create a subgraph of a subset of nodes and all nodes that connect to them. The problem is that the node names are id numbers. When I try and subset with "make_ego_graph" in igraph, I get the following error: Error in as.igraph.vs(graph, nodes) : Invalid vertex names
The subsetting seems to work fine when I create the network with names rather than numbers, but for precision's sake, I'd rather use the id numbers.
Has anyone come across this error before and could maybe provide a solution. Thank you for your help!
Upvotes: 0
Views: 350
Reputation: 48051
Vertex IDs in R-igraph have to be in the range [1; |V|] where |V| is the number of vertices. When all your node names are numbers, igraph probably expects this condition to hold, and bails out when it realizes that the condition doesn't hold. Try converting your original IDs to strings - semantically, they could stay the same but their R type has to be a string.
Upvotes: 1