mdk
mdk

Reputation: 191

how to extract only the vertices with multiple edges from a graph using igraph in R

I am new to igraph and graph theory. I have a very large file (> 4 GB) and I was told it is a graph. I can see the format includes the pairs separated by tab and I can read it as a table first then convert it to graph data frame.

Number of vertices with vcount and number of edges with ecount suggest that there are vertices with multiple edges. I have been looking at various sources but I could not find the information about directly extracting the vertices with more than one edges.

Any help is appreciated.

Upvotes: 0

Views: 618

Answers (2)

mdk
mdk

Reputation: 191

Sorry, I guess I was wrong with the terminology. What I meant by vertices with multiple edges is called 'articulation_points'.

This was what I was looking for:

library(igraph)
bi <- biconnected_components(g)
bi$articulation_points

Upvotes: 0

konvas
konvas

Reputation: 14346

To get the edges incident to each vertex (if g is your igraph)

 ie <- igraph::incident_edges(g, igraph::V(g))

Then, to get the number of edges adjacent to each vertex

num.incident.edges <- sapply(ie, length)

Upvotes: 1

Related Questions