igraph

r igraph: remove edges from 2 groups of vectors

我的未来我决定 提交于 2019-12-23 05:25:41
问题 I am trying to network my collaborations through my publication network. I used igraph which is great for it. However, since I have edges from my vertex (the one representing me in the network) to all co-authors I end up with a pretty packed graph. I would like to remove edges from my vertex to some authors that are only related through another author. Basically authors where I was only co-authoring. Anyway, I have identified these vertices and I know my vertex. Now I can't find a way to

All Paths Between 2 vertexes in R

╄→гoц情女王★ 提交于 2019-12-23 05:17:08
问题 I use igraph. I want yo find all the possible paths between 2 nodes. For the moment, there doesn't seem to exist any function to find all the paths between 2 nodes in igraph I found this subject that gives code in python: All possible paths from one node to another in a directed tree (igraph) I tried to port it to R but I have some little problems. It gives me the error: Error of for (newpath in newpaths) { : for() loop sequence incorrect Here is the code: find_all_paths <- function(graph,

igraph group vertices based on community

馋奶兔 提交于 2019-12-23 04:35:05
问题 from my previous question here Creating Variables with Group in R igraph, I want to put the vertices with the same group/color close together in my type of data just like this one https://lists.nongnu.org/archive/html/igraph-help/2012-03/pngFA9V_3yRcA.png. Thanks in advance 回答1: I have implemented such a function in my package NetPathMiner, called layoutVertexByAttribute. library(igraph) library(NetPathMiner) g <- graph.data.frame(message) g <- setAttribute(g, "sender", sender_country) l =

Error in cluster_edge_betweenness

丶灬走出姿态 提交于 2019-12-23 03:37:07
问题 I am using the function cluster_edge_betweenness provided in iGraph, but I run into error Modularity is implemented for undirected graphs only. g <- read.csv("sample.csv", header = FALSE) G <- graph.data.frame(g) cluster_edge_betweenness(G) head(g) > ` V3 V5 1 614 644 2 614 3960 3 614 4156 4 614 9902 5 614 11487 6 614 68400038` Above are the first few lines of my data. Any advice on how to solve this issue? 来源: https://stackoverflow.com/questions/51792302/error-in-cluster-edge-betweenness

Plot networks with igraph

邮差的信 提交于 2019-12-22 09:23:53
问题 I want to create a network from a correlation matrix and plot it. I'm trying to use igraph for this. This is a subset of my data. mydata Taxon CD1 CD2 Actinomycetaceae;g__Actinomyces 0.072998825 0.031399459 Coriobacteriaceae;g__Atopobium 0.040946468 0.002703265 Corynebacteriaceae;g__Corynebacterium 0.002517201 0.006446247 Micrococcaceae;g__Rothia 0.001174694 0.002703265 Porphyromonadaceae;g__Porphyromonas 0.023326061 0.114368892 Prevotellaceae;g__Prevotella 0.252894781 0.102308172

r creating an adjacency matrix from columns in a dataframe

拈花ヽ惹草 提交于 2019-12-22 05:41:38
问题 I am interested in testing some network visualization techniques but before trying those functions I want to build an adjacency matrix (from, to) using the dataframe which is as follows. Id Gender Col_Cold_1 Col_Cold_2 Col_Cold_3 Col_Hot_1 Col_Hot_2 Col_Hot_3 10 F pain sleep NA infection medication walking 14 F Bump NA muscle NA twitching flutter 17 M pain hemoloma Callus infection 18 F muscle pain twitching medication My goal is to create an adjacency matrix as follows 1) All values in

From dataframe to vertex/edge array

核能气质少年 提交于 2019-12-22 05:28:13
问题 I have the dataframe test <- structure(list( y2002 = c("freshman","freshman","freshman","sophomore","sophomore","senior"), y2003 = c("freshman","junior","junior","sophomore","sophomore","senior"), y2004 = c("junior","sophomore","sophomore","senior","senior",NA), y2005 = c("senior","senior","senior",NA, NA, NA)), .Names = c("2002","2003","2004","2005"), row.names = c(c(1:6)), class = "data.frame") > test 2002 2003 2004 2005 1 freshman freshman junior senior 2 freshman junior sophomore senior 3

Automatically curving an arc when it is overlapping with another one

淺唱寂寞╮ 提交于 2019-12-22 05:27:31
问题 I am automatically generating graphs whose nodes need to be in fixed positions. For example: There is actually an arc from node V4 to node V16, but we annot see it because there are also arcs from V4 to V10 and from V10 to V16. Note that both the nodes and the arcs are generated automatically, and that the positions may vary, so I would need an automated way to curve arcs that are hidden behind other arcs. Also note that none of these solutions are valid: igraph: Resolving tight overlapping

How to read in an edge list to make a scipy sparse matrix

时间秒杀一切 提交于 2019-12-22 05:21:41
问题 I have a large file where each line has a pair of 8 character strings. Something like: ab1234gh iu9240gh on each line. This file really represents a graph and each string is a node id. I would like to read in the file and directly make a scipy sparse adjacency matrix. I will then run PCA on this matrix using one of the many tools available in python Is there a neat way to do this or do I need to first make a graph in RAM and then convert that into a sparse matrix? As the file is large I would

How to read in an edge list to make a scipy sparse matrix

蹲街弑〆低调 提交于 2019-12-22 05:21:12
问题 I have a large file where each line has a pair of 8 character strings. Something like: ab1234gh iu9240gh on each line. This file really represents a graph and each string is a node id. I would like to read in the file and directly make a scipy sparse adjacency matrix. I will then run PCA on this matrix using one of the many tools available in python Is there a neat way to do this or do I need to first make a graph in RAM and then convert that into a sparse matrix? As the file is large I would