igraph

bipartite graph matching to match two sets

老子叫甜甜 提交于 2020-01-05 09:01:29
问题 I'm a newbie to igraph package in R. I have two sets A and B , each with N vertices (A1, A2, ..., AN) and (B1, B2, ..., BN) . There is an edge between every element of A to every element of B , and I have a function fWgt(Ai, Bj) that returns the weights of the edge between Ai and Bj . I have been trying to use the igraph package in R to do a weighted maximum bipartite matching, but I haven't been able to formulate the problem as per the igraph package. For instance, in the example given for

Compiler error installing python-igraph: Warnings treated as errors

大兔子大兔子 提交于 2020-01-05 08:15:28
问题 Trying to install python-igraph with pip for Python 3, I get the following compiler error. Can I change something or is this a bug in igraph? Note the line cc1: some warnings being treated as errors in the end - if they are just warnings, can I just ignore them somehow? Extracting igraph-0.7.0.tar.gz... Configuring igraph... Build type: static extension Include path: igraphcore/include Library path: igraphcore/lib /usr/local/lib64 /usr/local/lib /usr/lib64 /usr/lib /lib64 /lib Linked dynamic

Graph.get_adjacency() is slow and the output is strange

痞子三分冷 提交于 2020-01-05 07:41:25
问题 Consider a graph object G in python-igraph 0.7. If I want the adjacency matrix A of G, I have to write A=G.get_adjacency() , but there are two problems: Even if G is sparse with 3000 nodes, A is generated in a long time on my commercial laptop. Is it possible that the creation of the adjacency matrix is so expensive? The output A is a Matrix object, so if I want to operate with the numpy module on A, I have to convert it first in a list and then in a numpy.matrix. Moreover if A is sparse I

Graph.get_adjacency() is slow and the output is strange

依然范特西╮ 提交于 2020-01-05 07:41:01
问题 Consider a graph object G in python-igraph 0.7. If I want the adjacency matrix A of G, I have to write A=G.get_adjacency() , but there are two problems: Even if G is sparse with 3000 nodes, A is generated in a long time on my commercial laptop. Is it possible that the creation of the adjacency matrix is so expensive? The output A is a Matrix object, so if I want to operate with the numpy module on A, I have to convert it first in a list and then in a numpy.matrix. Moreover if A is sparse I

Unable to plot a network on igraph

安稳与你 提交于 2020-01-05 06:59:26
问题 My binary graph is based on an edgelist. Every vertex is a ticker on stock markets (eg : BARC= Barclay's) net_full_phase1=graph.edgelist(full_phase1, directed=FALSE) V(net_full_phase1)$color=V(net_full_phase1)$name V(net_full_phase1)$size=degree(net_full_phase1) V(net_full_phase1)$color=gsub("BARC", "slategrey", V(net_full_phase1)$color) V(net_full_phase1)$color=gsub("BNP", "blue", V(net_full_phase1)$color) V(net_full_phase1)$color=gsub("CBK", "black", V(net_full_phase1)$color) V(net_full

Louvain community detection in R using igraph - format of edges and vertices

五迷三道 提交于 2020-01-05 06:49:06
问题 I have a correlation matrix of scores that I would like to run community detection on using the Louvain method in igraph, in R. I converted the correlation matrix to a distance matrix using cor2dist , as below: distancematrix <- cor2dist(correlationmatrix) This gives a 400 x 400 matrix of distances from 0-2. I then made the list of edges (the distances) and vertices (each of the 400 individuals) using the below method from http://kateto.net/networks-r-igraph (section 3.1). library(igraph)

R: Selectively display nodes when plotting an igraph

▼魔方 西西 提交于 2020-01-04 02:03:30
问题 How can I plot a selection of igraph nodes? I have an existing graph, but it is too complex. I want to be able to 'zoom in' on a subset of the nodes. I am able to delete a subset of edges, but I can't figure out how to 'turn off' the isolated nodes. When using the network package, the displayisolates=FALSE parameter does this; it does not display these isolated nodes. The layout algorithm should also ignore the 'turned off' edges. For example: g1 <- graph( c( 0,1, 1,2, 2,2, 2,3 ) ) g2 <-

R: Selectively display nodes when plotting an igraph

风格不统一 提交于 2020-01-04 02:03:07
问题 How can I plot a selection of igraph nodes? I have an existing graph, but it is too complex. I want to be able to 'zoom in' on a subset of the nodes. I am able to delete a subset of edges, but I can't figure out how to 'turn off' the isolated nodes. When using the network package, the displayisolates=FALSE parameter does this; it does not display these isolated nodes. The layout algorithm should also ignore the 'turned off' edges. For example: g1 <- graph( c( 0,1, 1,2, 2,2, 2,3 ) ) g2 <-

How to keep position of nodes in igraph + R

泄露秘密 提交于 2020-01-03 16:51:20
问题 If I have the following graph and I set the position coordinates of nodes with a vector: library(igraph) library(Cairo) g9<- graph(c(0,1,0,2,0,3,1,4,1,2,3,4,3,5,4,5,5,2),n=6,dir=FALSE) V(g9)$name<-c(1:6) V(g9)$label<-V(g9)$name coords <- c(0, 0, 1.00000000000000, 0,0.500000000000000, 0.866025403784439, 0.300000000000000, 0.200000000000000, 0.441421356237309, 0.341421356237310,0.248236190979496,0.393185165257814) coords <- matrix(coords, 6,2,byrow=T) plot(g9,layout=coords) Now if I add the

add more than one edge based on edge attributes using igraph

隐身守侯 提交于 2020-01-03 08:30:09
问题 I would like to know wether, using igraph , it is possible to add edges to a graph depending on the values of different edge attributes. I have a data.frame, which dput is the following: df <- structure(list(nodeA = c("CFTR", "CFTR", "CFTR", "CFTR", "CFTR", "CFTR"), nodeB = c("CYP7A1", "KRT16", "ABCA3", "SLC22A11", "PBK", "ACSM1"), score = c(0.239, 0.24, 0.292, 0.269, 0.233, 0.168), text = c(129L, 0L, 287L, 246L, 161L, 155L), mining = c(163L, 241L, 413L, 71L, 92L, 56L), experiments = c(0L, 0L