igraph

invalid color name background in qgraph

拥有回忆 提交于 2019-12-13 05:28:14
问题 I have been trying to use qgraph to generate the network graph. The code is as following Gw <- qgraph(edgeList, diag = TRUE, labels = TRUE,legend.cex = 0.3, vsize = 1,edge.color=colorLabels,legend=TRUE,asize=1) The figure can be generated, but the R command line gives the following error message. I do not know what does the invalid color name 'background' mean. The dput result is shown as follows, dput(edgeList) structure(c("1", "2", "2", "3", "4", "5", "6", "7", "8", "1", "9", "10", "11",

igraph radius and diameter

怎甘沉沦 提交于 2019-12-13 04:48:21
问题 I'm having a strange problem with igraph functions I have an undirected graph(N=423) with very high density (0.4). In order to test the values I'm getting from igraph I'm using Gephi. I've checked with Gephi, and they both report degree and diameter the same but igraph reports radius and eccentricity completely wrong, much higher values that they should be. Also, radius is always smaller than diameter right? And here it is larger :) > sg <- simplify(graph.edgelist(edges, directed=F)) > radius

Installation of igraph on python distributed by anaconda ? (and graphviz)

匆匆过客 提交于 2019-12-13 04:42:52
问题 I tried to install the package igraph on Anaconda but so far it did not work. If anyone find a way to get it, I would be very happy to try it !! Below are some details of what I tried to do (if you have the solution of installing igraph on Anaconda, you don't have to read it!). I'm on MAC OS X Yosemite (MAC book Pro 2,3 GHz Intel Core i7). Here are some configuration parameters: MBP-de-Lecue:site-packages lecueguillaume$ which python /Users/lecueguillaume/anaconda/bin/python MBP-de-Lecue:site

How do I select certain labels to display in igraph plot?

北慕城南 提交于 2019-12-13 04:41:27
问题 I'm plotting a network with igraph, and I only want to display some of the vertex labels. My edgelist has 2 columns- "org" and "cand" -- in my plot how can I only display the labels for nodes in "cand" ? I've tried to use V(g)$label <- ifelse() I have seen ifelse used when there's a numeric attribute associated with a vector (for example, only displaying labels > 10). I'm not sure how to use this notation for my purposes. The code below shows how I created the graph and plot-- it runs fine.

Why the graph is not proper in R?

强颜欢笑 提交于 2019-12-13 03:39:35
问题 I wanted to plot the graph from the adjacency matrix. As a first step, I have tried the following code. set.seed(1) library('igraph'); adjm1<-matrix(sample(0:1,100,replace=TRUE,prob=c(0.9,01)),nc=10); g1<-graph.adjacency(adjm1); plot(g1) But it gave me, the following graph. What is the mistake here? PS: I am using Rstudio Version 1.1.442 R version 3.4.4 (2018-03-15) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200) 回答1: It seems for whatever reason the

How to simulate a graph with Assortativity or Homophily in R?

百般思念 提交于 2019-12-13 02:31:20
问题 In R , I am currently working with the package igraph . I am wondering if there are any ways to simulate graphs with a homophilic or assortativity structure to it -- or if other R packages allow for this. Thanks! 回答1: Have you looked at the ergm package? Using an exponential random graph model you can simulate an assortative network with a nodematch term. See ?"ergm-terms" for a description of the term. library(ergm) test.net = as.network(matrix(0,10,10), directed = F) #10-node network test

r igraph most connected nodes

大兔子大兔子 提交于 2019-12-13 02:26:35
问题 I have a graph: paths = data.frame(from=c(10,20,30,10,30), to=c(20,30,50,30,60)) g <- graph_from_data_frame(paths, directed=FALSE) plot(g) Is there a command to find out the number of connections of each node, and find the most connected node. In this example 30 is the most connected node, with 4 connections. Then come 20 and 10 with 2 connections each. 回答1: In this case you can just calculate it from the data.frame, by counting number of connections (treating from & to as the same, since the

Place nodes explicitly with visNetwork (or an Alternative)

為{幸葍}努か 提交于 2019-12-12 23:10:48
问题 How can I explicitly place nodes on a visNetwork graph? Or: How can I recreate that graphic in R using visNetwork or an alternative? Background: The ultimate goal is to represent Causal Loop Diagrams coming from Vensim files. Placing the nodes explicitly is just the first (crucial) step, because in Causal Loop Diagrams the visual mapping of nodes is part of the information (unlike in general graph theory). So if anybody has advice on the bigger picture aka. 'Bringing Causal Loop Diagram

Labels on only root and terminal vertices in igraph (R)?

北战南征 提交于 2019-12-12 20:09:05
问题 inst2 = c(2, 3, 4, 5, 6) motherinst2 = c(7, 8, 2, 10, 11) km = c(20, 30, 40, 25, 60) df2 = data.frame(inst2, motherinst2) df2 = cbind(df2, km) g2 = graph_from_data_frame(df2) tkplot(g2) how would I approach adding labels to exclusively my root and terminal vertices in a graph? I know it would involve this function, but how would you set it up? Assuming the graph object is just called 'g', or something obvious. vertex.label = 回答1: The solution from @eipi1o is good, but the OP says "I'm finding

Counting how many vertices in a neighbourhood have a given attribute with edge weights in igraph for R

你说的曾经没有我的故事 提交于 2019-12-12 19:17:24
问题 This is related to this question. I have a very large graph, on the order of 100,000 vertices in igraph. Each vertex has an attribute att which is a logical value. Edges are weighted with positive integer weights. For each vertex v, I would like to sum the edge weights of edges that connect v to a vertex where att=T . We can use the following as an example set.seed(42) g <- erdos.renyi.game(169081, 178058, type="gnm") V(g)$att <- as.logical(rbinom(vcount(g), 1, 0.5)) 回答1: Here's one way to