简体   繁体   English

如何在R中使用igraph从图中仅提取具有多个边的顶点

[英]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. 我有一个很大的文件(> 4 GB),并被告知这是一个图形。 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. 具有vcount的顶点数量和具有vcount的边缘ecount表明存在具有多个边缘的顶点。 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. 任何帮助表示赞赏。

To get the edges incident to each vertex (if g is your igraph) 获取入射到每个顶点的边(如果g是您的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)

Sorry, I guess I was wrong with the terminology. 对不起,我想我用错了术语。 What I meant by vertices with multiple edges is called 'articulation_points'. 我所说的具有多个边的顶点的意思是“ articulation_points”。

This was what I was looking for: 这就是我想要的:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM