I am working with networks in igraph, I have a network where there are short connected nodes that overlap eachother and so we donot exaclt see the edge. I want to delete al such short connected nodes as they are not connected to the main network. The degree thing doesnt work here as the nodes are not 0 degree., they are either connected to 1 or more genes but still not in the main network.Even the main network shows some overlapping genes, I want to correct that too. net <- simplify(InnatedGraph, remove.multiple = T, remove.loops = T, ) bad.vs<-V(net)[degree(net) == 0] net <-delete.vertices(net, bad.vs) plot(net,vertex.label=NA, edge.curved=.1, edge.width = 1,edge.arrow.width = 0.3,vertex.size = 3,asp=-1,edge.arrow.size = 0.5,vertex.label.cex = 0.3)完成所有这些操作后,我得到一个像这样的网络 After doing all this i get a network like this 您在主网络中看到的基因不是孤立的节点,而是连接到其他重叠的节点.有没有办法删除这些基因并防止在主网络中重叠.The genes you see around the main network are not isolated nodes but connected to other nodes that are overlapped. Is there are way to delete these genes and prevent overlapping in the main network.推荐答案您需要主要组件.首先,找到组件,然后基于这些组件对图形进行子集化. g是您的网络:You want the main component. First, find the components and then subset the graph based on those components. Where g is your network: V(g)$comp <- components(g)$membershipmain <- induced_subgraph(g,V(g)$comp==1)对于重叠的节点,请检查igraph中可用的不同布局. ?igraph::layout.As far as overlapping nodes, check out the different layouts available in igraph. ?igraph::layout. 这篇关于从igraph中的图中删除未连接的短路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-26 17:14