Questions tagged [igraph]

igraph is a free software package for creating and manipulating large undirected and directed graphs. It is written in C, but has interfaces to higher-level languages like R, Python or Mathematica.

igraph includes implementations for classic graph theory problems like minimum spanning trees and network flow, and also implements algorithms for some recent network analysis methods (e.g., community structure search).

igraph is a collection of network analysis tools with the emphasis on efficiency, portability and ease of use. igraph is open source and free. igraph can be programmed in R, Python, Mathematica and C/C++.

Repositories

Related links

3392 questions
16
votes
5 answers

Interface between networkx and igraph

I've been working with networkx for quite some time now and it's been serving my purposes quite well with minimal tweaks until recently when I started looking into community detection. In comparison, the igraph Python package seems to have a much…
Moses Xu
  • 1,890
  • 2
  • 22
  • 34
16
votes
1 answer

Change edge thickness in igraph plot R according to Edge Attributes

I want to change the edge width of my graph to correspond to the edge.betweenness score. net <- read.csv("D:/SNA/R/Net.csv") att <- read.csv("D:/SNA/R/Att.csv") g <- graph.data.frame(net, vertices=att, directed=TRUE) pdf("Network.pdf",…
P Mcquiy
  • 185
  • 1
  • 3
  • 10
16
votes
1 answer

A hack to allow arrows size in R igraph to match edge width

Though the manual states that this will be a future feature: arrow.size The size of the arrows. Currently this is a constant, so it is the same for every edge. If a vector is submitted then only the first element is used, ie. if this is taken…
Etienne Low-Décarie
  • 11,833
  • 15
  • 60
  • 86
16
votes
2 answers

Subset igraph graph by label

I am trying to subset a igraph graph by an edge characteristics (like its label). In the reproducible example I have shamelessly stolen from another post with a little modification, I would like to be able to separate the Best Friend ties (BF) from…
Michael Davidson
  • 1,259
  • 1
  • 13
  • 26
16
votes
2 answers

R package that links to external C library

I have some c code that utilizes the igraph library. I would like to put an R wrapper around it and send it off to CRAN as an R package. igraph already has an R port on CRAN, so it would make sense for my R package 'foo' to depend on R's igraph. …
JCWong
  • 1,063
  • 1
  • 7
  • 25
15
votes
1 answer

Convert igraph object to a data frame in R

I'm working with the iGraph library and I need to run some statistical analysis on the network. I'm computing several variables using iGraph and then want to use those indicators as the dependent variable in a few regressions and the vertex…
biased_estimator
  • 603
  • 2
  • 7
  • 12
15
votes
1 answer

igraph: Resolving tight overlapping nodes

I have a graph with few hundred nodes and edges. The disconnected subgraphs separate out and resolve well but the nodes within subgraphs overlap and do not resolve well. I have tried several layout algorithms and have also tried changing the…
rmf
  • 8,389
  • 10
  • 46
  • 89
15
votes
2 answers

Correctly color vertices in R igraph

I am using igraph to color vertices I have two CSV files answers and topology of the graph. Answers: (this tells that players K and N answered correctly) Player Q1_I1 1 k 1 2 l 0 3 n 1 4 m 0 Topology:…
Salvador Dali
  • 182,715
  • 129
  • 638
  • 708
14
votes
1 answer

How to solve AttributeError when importing igraph?

When I import the igraph package in my project, I get an AttributeError. This only happens in the project directory: [12:34][~]$ python2 Python 2.7.1 (r271:86832, Apr 15 2011, 12:09:10) [GCC 4.5.2 20110127 (prerelease)] on linux2 Type "help",…
any1
  • 292
  • 3
  • 8
14
votes
4 answers

Find immediate neighbors by group using data table or igraph

I have a data.table: groups <- data.table(group = c("A", "B", "C", "D", "E", "F", "G"), code_1 = c(2,2,2,7,8,NA,5), code_2 = c(NA,3,NA,3,NA,NA,2), code_3 = c(4,1,1,4,4,1,8)) group…
User2321
  • 2,156
  • 15
  • 31
14
votes
2 answers

Get subgraph of shortest path between n nodes

I have an unweighted graph and I want to get a subgraph that has just the nodes and edges that contain the shortest paths between n known nodes. In this case 3 nodes (11, 29, & 13 are the names). Question How can I get a subgraph of shortest path…
Tyler Rinker
  • 99,090
  • 56
  • 292
  • 477
14
votes
2 answers

increasing the distance between igraph nodes

I have a graph that I have produced using igraph. I'd like to spread out the nodes. The only way I have found so far to do this is to scale the layout and force the plot command to not rescale. png("kmeansColouredNetwork.png", width=1200,height =…
Ben
  • 281
  • 1
  • 4
  • 13
14
votes
2 answers

Community detection in Networkx

I'm studying about detection communities in networks. I'm use igraph and Python For the optimal number of communities in terms of the modularity measure: from igraph import * karate = Nexus.get("karate") cl =…
Alan Valejo
  • 1,165
  • 3
  • 18
  • 42
14
votes
3 answers

R igraph convert parallel edges to weight attribute

I'm working with igraph for R. My graph is based on an edgelist which includes parallel edges (more than one edge with the same source and target). I would like to convert these parallel edges to an edge attribute weight. Is there an eay way to do…
supersambo
  • 791
  • 1
  • 8
  • 23
13
votes
3 answers

Lots of edges on a graph plot in python

I have following script: import pandas as pd from igraph import * df_p_c = pd.read_csv('data/edges.csv') ... edges = list_edges vertices = list(dict_case_to_number.keys()) g = Graph(edges=edges, directed=True) plot(g, bbox=(6000, 6000)) I have…
CezarySzulc
  • 1,486
  • 1
  • 10
  • 22