igraph

Matching vertex attributes across a list of edgelists R

帅比萌擦擦* 提交于 2019-12-24 07:20:50
问题 I have a list of directed networks list(structure(list(nominator1 = structure(c(3L, 4L, 1L, 2L), .Label = c("Angela", "Jeff", "Jim", "Pam"), class = "factor"), nominee1 = structure(c(1L, 2L, 3L, 2L), .Label = c("Andy", "Angela", "Jeff"), class = "factor")), class = "data.frame", row.names = c(NA, -4L)), structure(list(nominator2 = structure(c(4L, 1L, 2L, 3L ), .Label = c("Eric", "Jamie", "Oscar", "Tim"), class = "factor"), nominee2 = structure(c(1L, 3L, 2L, 3L), .Label = c("Eric", "Oscar",

igraph - plotting directed network creates triangular edges

大憨熊 提交于 2019-12-24 04:17:08
问题 I'm trying to plot a directed network that will simply have a thin edge and an arrow. I keep getting an edge that looks triangular. How can I get a simple line and an arrow? vertice1 <- c("a", "b", "c") vertice2 <- c("d", "e", "f") edge.list <- data.frame(vertice1, vertice2) g <- graph_from_data_frame(d = edge.list, directed=TRUE) plot(g) Directed Network with Triangular Edges 回答1: I am not getting the triangle that you got, but I feel certain that is just a large arrow head on the links. Try

igraph plot function does not show images in an IPython notebook

若如初见. 提交于 2019-12-24 02:44:17
问题 I try to do a basic igraph plotting in an IPython notebook: fn = 'misrables.gml' gr = igraph.Graph.Read_GML(fn) igraph.plot(gr) instead of seeing a graph I see this: Out[7]: <igraph.drawing.Plot at 0x1120d6978> How do I persuade IPython to actually show the graphics? Some clarifications Inline matplotlib works fine, so this is not the issue. I have cairo installed: import cairo cairo.version output: 1.10.0 Calling _repr_svg() on the plot object results in an error: TypeError Traceback (most

Making the edges curved in visNetwork in R by giving roundness factor

狂风中的少年 提交于 2019-12-24 02:21:37
问题 The following R script creates a visNetwork diagram as shown. How to manually change the straight edges to curved edges by giving a curved factor? One approach that I tried here using the roundness attribute with "smooth" label. However, not able to achieve it. library(visNetwork) nodes <- data.frame(id = 1:3,color = c(rep("blue",1), rep("red",1), rep("green",1))) edges <- data.frame(from = c(1,2,3), to = c(2,3,1)) nodes = data.frame(nodes, level = edges$from) visNetwork(nodes, edges, height

Is it possible to map a matrix to a igraph object?

こ雲淡風輕ζ 提交于 2019-12-24 01:10:00
问题 I have a matrix A that define ordered segments of a self-intersecting polygon: A <- t(matrix(c( 0, 0 , 1, 0 , 1, -2 , -2, -2 , -2, -1 , 0, -1 , 0, -4 , -1, -4 , -1, -2 , 2, -2 , 2, -3 , 0, -3 , 0, 0), nrow = 2)); par(mfrow=c(1,3)) plot(A, col='red', type= 'l', xlim=c(min(A[,1]),max(A[,1])), ylim=c(min(A[,2]),max(A[,2])), xlab='x', ylab='y'); points(A, col='black', pch = 22); grid() I heed to map the matrix A to an undirected graph where a point (x,y) corresponds to a vertex and a segment

Create a chart from different data

早过忘川 提交于 2019-12-23 23:23:37
问题 I need help to create a chart. I explain better. I created 10 random graphs, each with N nodes. I have done that for N = 10^3, 10^4, 10^5. So in total 30 graphs. To each of them I found the percentage of multilinks and selfloops they have. Now I would like to create a single graph that shows the percentage in function of the number of nodes. So something like: So I have a 3 lists: - listNets containing 30 graphs - listSelf containing the percentage of selfloops - listMul containing the

Install python igraph on mac

ぃ、小莉子 提交于 2019-12-23 23:01:25
问题 I executed the brew install homebrew/science/igraph When I execute sudo pip3 install python-igraph , I got the following error Cannot find the C core of igraph on this system using pkg-config. We will now try to download and compile the C core from scratch. Version number of the C core: 0.7.1.post6 We will also try: 0.7.1 Using temporary directory: /private/tmp/pip-build-35vcjf7l/python-igraph/tmp/igraph.4cz7yjcl Downloading igraph-0.7.1.tar.gz... 0.28%error: <urlopen error retrieval

ImportError igraph: undefined symbol

假装没事ソ 提交于 2019-12-23 12:38:57
问题 After installing python-igraph with pip, I still can't import it. I've encountered such error around the internet but most solutions I've found were about reinstalling the module, which I already did. Any suggestions on how to fix this would be greatly appreciated. Thanks >>> import igraph Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.5/site-packages/igraph/__init__.py", line 34, in <module> from igraph._igraph import * ImportError: /usr/lib

Show only specific labels on network graph using igraph in R

风格不统一 提交于 2019-12-23 09:57:59
问题 I'm trying to plot a graph that only displays the labels for certain vertices. In this case, I want to only display labels for vertices with a certain number of edges. I'm reading vertices and edges into the graph object like so: nodes <- read.csv("path_to_file.csv") edges <- read.csv("path_to_file.csv") g <- graph_from_data_frame(edges,directed=TRUE,vertices=nodes) I use the following command to plot the graph and vary the width of the edge based on number of connections (the $rels attribute

Precalculate and set initial positions of nodes in D3.js

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 09:25:47
问题 I'm trying to pre-calculate the positions of the stable force directed graph using igraph and pass them into my d3.js graph. This is due to the size of the dataset I will be using which means I cannot rely on the client not to freeze if the full force calculation is done on client-side. I have the positions in JSON format and have used linear scales in order to make them useful in d3.js. var positions = {"positions": [{"x":"-68.824367374", "y": "-6.10824525755"}, {"x":"-80.8080803911", "y": "