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
13
votes
1 answer

Rewiring weighted graph produces NAs

A previous answer to another question provided some code to rewire a weighted graph as: g <- graph.ring(10) E(g)$weight <- seq_len(ecount(g)) E(g)$weight # [1] 1 2 3 4 5 6 7 8 9 10 is.weighted(g) # [1] TRUE g2 <-…
user1320502
  • 2,360
  • 4
  • 25
  • 41
13
votes
1 answer

Pseudo-code for Network-only-bayes-classifier

I am trying to implement a classification toolkit for univariate network data using igraph and python. However, my question is actually more of an algorithms question in relational classification area instead of programming. I am following…
Sait
  • 16,365
  • 16
  • 65
  • 96
13
votes
1 answer

Kou's algorithm to find Steiner Tree using igraph

I am trying to implement the Kou's algorithm to identify Steiner Tree(s) in R using igraph. The Kou's algorithm can be described like this: Find the complete distance graph G' (G' has V' = S (steiner nodes) , and for each pair of nodes (u,v) in…
user2380782
  • 1,490
  • 4
  • 18
  • 54
13
votes
5 answers

Failing to install python-igraph

I'm trying to install python-igraph. After I run sudo pip install python-igraph I got the following log: Downloading/unpacking python-igraph Downloading python-igraph-0.7.1-1.tar.gz (375kB): 375kB downloaded Running setup.py egg_info for package…
Sergey Ivanov
  • 3,061
  • 5
  • 32
  • 54
13
votes
2 answers

How to list all graph vertex attributes in R?

I am using the igraph package in R. I would like to associate some data with each vertex, e.g. by adding id and description attributes to each. The attributes are determined at runtime. I have a couple of related questions about how to set and get…
Racing Tadpole
  • 3,581
  • 5
  • 30
  • 53
13
votes
4 answers

How to make grouped layout in igraph?

In igraph, after applying a modularization algorithm to find graph communites, i would like to draw a network layout which clearly makes visible the distinct communities and their connections. Something like "group attributes layout" in Cytoscape: i…
deeenes
  • 3,334
  • 4
  • 33
  • 50
12
votes
1 answer

All possible paths from one node to another in a directed tree (igraph)

I use python binding to igraph to represent a directed tree. I would like to find all possible paths from one node in that graph to another one. Unfortunately, I couldn't find a ready to use function in igraph that performs this task? EDIT The…
Boris Gorelik
  • 24,869
  • 33
  • 118
  • 167
12
votes
1 answer

changing the spacing between vertices in iGraph in R

Suppose I want to make a plot with the following data: pairs <- c(1, 2, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 2, 8, 2, 9, 2, 10, 2, 11, 4, 14, 4, 15, 6, 13, 6, 19, 6, 28, 6, 36, 7, 16, 7, 23, 7, 26, 7, 33, 7, 39, 7, 43, 8, 35, 8, 40,…
Alex
  • 3,692
  • 4
  • 33
  • 57
12
votes
4 answers

Colored graph isomorphisms: 1(red)->2(blue) vs 1(blue)->2(red)

Given two simple graphs: library(igraph) g <- graph.empty() g <- g + vertices(1,2,3) g <- g + path(1,2,3) g1 <- g V(g1)$color = c(1,2,2) g2 <- g V(g2)$color = c(2,1,1) which look…
alberto
  • 2,385
  • 2
  • 23
  • 43
12
votes
1 answer

Using iGraph in python for community detection and writing community number for each node to CSV

I have an network that I would like to analyze using the edge_betweenness community detection algorithm in iGraph. I'm familiar with NetworkX, but am trying to learning iGraph because of it's additional community detection methods over NetworkX. …
CurtLH
  • 1,960
  • 2
  • 26
  • 49
12
votes
3 answers

How to separate edge label from edge in igraph?

I would like to move the position of the edge label so that it is not on top of it. Here is a little example: g <- graph.empty(n=3) g <- graph(c(1,2,3,2,1,3), directed=T) E(g)$weight <- c(3,2,5) plot(g, edge.label = E(g)$weight) In my…
user31168
  • 145
  • 1
  • 5
12
votes
4 answers

How to create weighted adjacency list/matrix from edge list?

My problem is very simple: I need to create an adjacency list/matrix from a list of edges. I have an edge list stored in a csv document with column1 = node1 and column2 = node2 and I would like to convert this to a weighted adjacency list or a…
Milo
  • 155
  • 1
  • 1
  • 7
11
votes
1 answer

meaning of weights in community detection algorithms

There is an excellent comparison of community detection algorithms available in igraph here. However, there's some ambiguity about the use of weights in the algorithms that can be applied with weighted edges. Typically, edge weights will be oriented…
JenB
  • 16,759
  • 2
  • 13
  • 42
11
votes
3 answers

Getting vertex list from python-igraph

I have been scouring the docs trying to find a function that will return a list vertices from an iGraph graph but can't find one. Does anyone know how to do get a list of vertices from an iGraph graph?
user2327814
  • 423
  • 1
  • 7
  • 16
11
votes
2 answers

Import weighted edgelist using igraph

I have the following txt file representing a network in edgelist format. The first two columns represent the usual: which node is connected to which other nodes The third column represents weights, representing the number of times each node has…
user1723765
  • 5,639
  • 15
  • 51
  • 81