igraph

Combine non NA values for n Lists R

落爺英雄遲暮 提交于 2019-12-24 20:17:45
问题 A - I have a list containing igraph graph objects: goodgg [[1]] IGRAPH UN-- 3 3 -- + attr: name (v/c), color (v/c), value (e/n), sourceID (e/n), targetID (e/n) + edges (vertex names): [1] 89315--89316 89315--89928 89316--89928 [[2]] IGRAPH UN-- 3 2 -- + attr: name (v/c), color (v/c), value (e/n), sourceID (e/n), targetID (e/n) + edges (vertex names): [1] 106277--106278 106278--106279 I can combine these into a single object using [union][1] : combine = graph.union(goodgg[[1]], goodgg[[2]],

Why igraph plot warns that “number of items to replace is not a multiple of replacement length”?

你离开我真会死。 提交于 2019-12-24 17:04:47
问题 I have a graph with many edges between two nodes. When I plot it, I get a warning I don't understand in this context. This works fine: library(igraph) gg <- graph.empty(n=0, directed=TRUE) gg <- gg + vertex("10501") gg <- gg + edge("10501", "10501") gg <- gg + edge("10501", "10501") plot(gg) But the same graph with one more edge gives a warning: gg <- graph.empty(n=0, directed=TRUE) gg <- gg + vertex("10501") gg <- gg + edge("10501", "10501") gg <- gg + edge("10501", "10501") gg <- gg + edge(

Why igraph plot warns that “number of items to replace is not a multiple of replacement length”?

╄→尐↘猪︶ㄣ 提交于 2019-12-24 17:04:19
问题 I have a graph with many edges between two nodes. When I plot it, I get a warning I don't understand in this context. This works fine: library(igraph) gg <- graph.empty(n=0, directed=TRUE) gg <- gg + vertex("10501") gg <- gg + edge("10501", "10501") gg <- gg + edge("10501", "10501") plot(gg) But the same graph with one more edge gives a warning: gg <- graph.empty(n=0, directed=TRUE) gg <- gg + vertex("10501") gg <- gg + edge("10501", "10501") gg <- gg + edge("10501", "10501") gg <- gg + edge(

igraph - multiple lines of text in one circle?

时光怂恿深爱的人放手 提交于 2019-12-24 13:50:35
问题 I am a complete beginner to igraph so please be easy on me. I am creating a network map and would like to add additional lines of text for each circle. How may I do that? Is it possible? Here is an illustration: 回答1: You can specify a line break in a character vector using \n , which allows you to force multiple lines of text in a single vertex. library(igraph) g <- graph.data.frame(data.frame(A=1,B=2)) V(g)$name <- c("Line 1\nLine 2","Point 2") plot(g,vertex.size=100) 来源: https:/

R igraph colour edge according to logical flag

て烟熏妆下的殇ゞ 提交于 2019-12-24 13:04:04
问题 i have a graph where one of the edge attribute is the correlation between 2 vertices. I would like to colour the edges on my plot differently according to whether the correlation is positive or negative. I tried using edge.color=c("red","blue")[E(mygraph)$correlation>=0] in the plot attributes but i end up with only the first 2 edges showing, one red, one blue, and no others... See this simplified example: myedges<-data.frame(From=c("item1","item1","item1","item2","item2","item3"), To=c(

R - Vertex attributes - 'Inappropriate value given in set.vertex.attribute.'

牧云@^-^@ 提交于 2019-12-24 10:54:15
问题 I have a data.frame containing values I want to use as attributes in a network file. When I try to assign the values as attributes manually half of them work but the other half show this error. I have looked closely at the data and I cannot see anything intrinsic that should be causing this. Format vector input (this one works) visitgo2n%v%"hhid" <- attr2$hhid Here is the error: "Error in set.vertex.attribute(x, attrname = attrname, value = value) : Inappropriate value given in set.vertex

No module named cairo - Mac

杀马特。学长 韩版系。学妹 提交于 2019-12-24 10:47:19
问题 Why is it so effin' hard? Seems to be an ever-present issue..solved unclearly. Searched on multiple github pages, advised to use import cairocffi as cairo instead, not working for me. Some more on Stackoverflow, to add sys.path.insert(0, "//anaconda/pkgs/cairo-1.14.10-0") or something. But in fact, sys.path returns the directory anyway. Quite sure installation done correctly as I can see under conda list . Bad feeling this is gonna take a whole lot longer due to my little understanding of the

Why curved edges are invisible in igraph plotting?

五迷三道 提交于 2019-12-24 10:46:42
问题 In python igraph plotting with cairo PDF, curved edges set either by edge_curved = X or autocurve = True , edges are invisible in the PDF output. Same stands for PNG. Arrowheads and all other graphic elements are visible. Setting the edges straight, they become visible. Here is a minimal example: import igraph g = igraph.Graph.Erdos_Renyi(n = 23, m = 123) igraph.plot(g, autocurve = True, edge_width = 0.02) 回答1: With edge width below 0.051 the curved edges are always invisible. Actually all

Reading edges from a file. I can't define a graph

依然范特西╮ 提交于 2019-12-24 08:58:35
问题 I am new in R. I am working with igraph library. I am new using such library. I have a problem: I have a list of edges in a text file. It has two columns. The first has initial node, the second has the ending node. I am reading the file with: g1 <-read.table ("g1.txt") The reading is successfull. with ls.str(g1) i get: V1 : int [1:995] 0 0 0 0 0 0 0 0 0 0 ... V2 : int [1:995] 2 3 4 5 6 7 8 9 10 11 ... when i try to define the graph with the just loaded edges I get: Error in graph(g1) : (list)

r create adjacency matrix or edge list from adjacency list

橙三吉。 提交于 2019-12-24 07:26:24
问题 I have an adjacency list and I am trying to make it into and adjacency matrix or edge list. This is in order to conduct network analysis on the network built from the adjacency matrix or edge list. I am using R. An example of adjacency list is as follows (each row has different amount of entries, and the empty entries are NA): [17,50,90,NA,NA; 80,67,NA,NA,NA; 33,31,32, NA,NA; 33,31,32,NA,NA; 354,56,87,97,32; ....] I tried using R: Adjacency list to Adjacency matrix but this only works if my