igraph

Install python-igraph with the anaconda distribution (windows)

给你一囗甜甜゛ 提交于 2019-12-08 00:59:31
问题 I have problems to install python-igraph on the anaconda distribution of python. If I write pip install python-igraph (with the admin privileges) in the anaconda command, the installation doesn't work. 回答1: Check the documentation on their site: http://igraph.org/python/ It says that you need to download the .msi installer, pip does not work under windows. That is probably because you need a C compiler and windows does not supply one by default. 回答2: You can download a wheel installer from

Change attributes of one node

余生颓废 提交于 2019-12-07 21:40:21
问题 How to change a color label node from its id or name? Ex: I want to change label color node name="4" or id=3 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 回答1: V(g9)$color is an array of colors. To change color of a specific node say 2: V(g9)$color[2] ="#343434FF" If you want different color for each node, you can specify rainbow(n) where n is number of nodes and this function generates a array of colors and then you can specify: V

R: How to traverse from root node to each leaf node in an iGraph data object and get the path?

瘦欲@ 提交于 2019-12-07 19:44:44
问题 I am new to R and I have a graph object which I have created from a data frame object "allTog" as shown below: library(igraph) df.g <- graph.data.frame(d = allTog, directed = TRUE) plot(df.g, vertex.label = V(df.g)$name) The allTog data frame is given by allTog <- data.frame( source = c("chamber", "chamber", "chamber", "chamber", "chamber", "check", "check", "issue", "issue", "issue"), target = c("check", "issue", "leak", "process", "found", "power", "customer", "customer", "wafer", "replaced

How to restore attribute after union n igraphs?

允我心安 提交于 2019-12-07 19:31:46
问题 let's say I have n igraphs objects g1 , g2 ,.., gn . They are undirected and weighted graphs, i.e. new weight's attribute should be added. I'd like to union n graphs into the weighted graph g . It is known from the documentation (see ?graph.union ) if the n graphs have the weight attribute, it is renamed by adding a _1 and _2 (and _3 , etc.) suffix, i.e. weight_1 , weight_2 ,..., weight_n . I have seen the answer and wrote the code for n=3 graphs (see below). Edited: library(igraph) rm(list

Changing attribute of nodes during breadth first search in R

强颜欢笑 提交于 2019-12-07 19:18:09
问题 I have created a random (Erdos-Renyi) graph that has 100 nodes. I have set an attribute value for all 100 nodes as 0. I find the node with the maximum degree (the most neighbors), and change its attribute value from 0 to 1. Then, using the node as the root node, and another node as a second root node, I do a breadth first search (BFS) on the network. This is related to this question. I do the breadth first search like this: # BFS on the network bfs <- graph.bfs(graph, root = c(root_node, root

Problems compiling C core of igraph with Python 2.7.9 Anaconda 2.2.0 on Mac osx 10.10.2

帅比萌擦擦* 提交于 2019-12-07 17:23:13
问题 I wonder if anyone has had a similar issue to this and found a solution? I am trying to install igraph for with Python 2.7.9 Anaconda 2.2.0 on Mac osx 10.10.2. I managed to brew install homebrew/science/igraph OK but when I try to pip install python-igraph I get the following error: grep: /usr/lib/libiconv.la: No such file or directory sed: /usr/lib/libiconv.la: No such file or directory libtool: link: `/usr/lib/libiconv.la' is not a valid libtool archive make[3]: *** [libigraph.la] Error 1

Mapping a specific column of values to the scale color of vertexs in R

你说的曾经没有我的故事 提交于 2019-12-07 15:29:36
Now I have a data frame df1 : v1 v2 a 10 b 1 c 3 d 7 ....... And another data frame df2 : v1 v2 d a c a b c c d ... I'd like to plot a network based on df2 with igraph : plot(g, layout = layout_in_circle(g)) And the color of vertexes( a,b,c,d... ) should be in range of red to blue and the bigger the value in v2, the color of that vertex should be more closer to red. I have tried: require(igraph) g = graph.data.frame(df) plot(g, layout = layout_in_circle(g), vertex.color = color.scale(mention_counted$V2,c(0,1,1),c(1,1,0),0)) But the color of vertexes is not map to the value in v2 properly. Is

Use shortest path to calculate probability of connection

自作多情 提交于 2019-12-07 14:58:51
问题 I'm wondering if there is a function within igraph to calculate connection probabilities among vertices in a weighted graph, where the weights for the edges are probabilities of connection of the adjacent vertices. I've built a graph based on such an adjacency matrix where adjacent connection probabilities form the weights (this is for a river network so each node of the graph is only connected to a single downstream node). I had hoped to use something like the shortest.paths function in

R igraph - Convert a weighted adjacency matrix into weighted edgelist

吃可爱长大的小学妹 提交于 2019-12-07 08:01:07
问题 I have a nxm adjacency matrix, where (i,j) represent the score of association between i and j. I need to convert this into the following format like : i j <score1> using R' igraph package and output it into a text file. I can derive the edgelist, but its showing up without the weights. I used the following code: library(igraph) g <- graph.adjacency(myAdjacencymatrix) get.edgelist(g) However, it does not show the weights. 回答1: library(igraph) set.seed(1) # for reproducible example

Three column graph

故事扮演 提交于 2019-12-07 04:15:58
问题 The result of some process is a list of paths from A to C through B, e.g.: which.effect(A1,A2,10,1,1) [[1]] [1] 10 2 1 [[2]] [1] 10 28 1 [[3]] [1] 10 6 9 [[4]] [1] 10 24 9 [[5]] [1] 10 28 9 What I would like to have is a graph with three parallel columns, the first for the origin, the second for the intermediate point, and the third for the destination. In this example, the first column would have only the node 10 , the second 2, 6, 24, 28 and the third 1, 9 . Then, directed edges (arrows)