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

3934 questions
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
  • 6,179
  • 18
  • 57
  • 85
10
votes
2 answers

R: igraph, community detection, edge.betweenness method, count/list members of each community?

I've a relatively large graph with Vertices: 524 Edges: 1125, of real world transactions. The edges are directed and have a weight (inclusion is optional). I'm trying investigate the various communities within the graph and essentially need a method…
Sean Mc
  • 458
  • 6
  • 14
10
votes
2 answers

How do I calculate weighted degree distributions with igraph in R?

Consider a dataframe df where the first two columns are node pairs and successive columns V1, V2, ..., Vn represent flows between the nodes (potentially 0, implying no edge for that column's network). I would like to conduct analysis on degree,…
mindless.panda
  • 4,014
  • 4
  • 35
  • 57
10
votes
5 answers

Efficiently enumerate all possible matrices with given constraints

Background Assuming we have a family of matrices Ms of size n-by-n, which should meet the following requirements: Entries of the matrix are either 0 or 1, i.e., boolean, but diagonal entries are always 0s The matrix is symmetric, i.e., M ==…
ThomasIsCoding
  • 96,636
  • 9
  • 24
  • 81
10
votes
1 answer

How to use igraph vertex.shape functionality

Has anyone used igraph's vertex.shape functionality? This http://cneurocvs.rmki.kfki.hu/igraph/doc/R/igraph.vertex.shapes.html was promising but I could not understand. Does anyone have an example of working code?
Dennis
  • 332
  • 1
  • 4
  • 12
10
votes
1 answer

igraph/visNetwork with R: How to disable forward linking?

The following code produces a nice network diagram: library(igraph);library(visNetwork);library(dplyr) set.seed(123) nnodes <- 10 nnedges <- 20 nodes <- data.frame(id = 1:nnodes) edges <- data.frame(from = sample(1:nnodes, nnedges, replace = T), …
moabit21
  • 639
  • 8
  • 20
10
votes
2 answers

Minimum Cost Flow - network optimization in R

I am trying to implement a "Minimum Cost Network Flow" transportation problem solution in R. I understand that this could be implemented from scratch using something like lpSolve. However, I see that there is a convenient igraph implementation for…
JanLauGe
  • 2,297
  • 2
  • 16
  • 40
10
votes
3 answers

Properly plotting large adjacency matrix in R

I've got a rather large (but quite sparse) adjacency matrix (500x500) that I am trying to visually represent. It seems to me that something akin to a force directed graph is my best bet and while trying to figure out the best way to implement this,…
Drofdarb
  • 159
  • 1
  • 9
10
votes
5 answers

sampling subgraphs from different sizes using igraph

I have an igraph object mygraph with ~10,000 nodes and ~145,000 edges, and I need to create a number of subgraphs from this graph but with different sizes. What I need is to create subgraphs from a determined size (from 5 nodes to 500 nodes) where…
user2380782
  • 1,542
  • 4
  • 22
  • 60
10
votes
2 answers

How to get the vertices from an edge using igraph in python?

I am looping through the edges of a graph with: for es in graph.es: .... # v = [] # v = es.vertices()? ... What method can I use to get the source and the target vertices for each edge?
giorgioca
  • 713
  • 1
  • 8
  • 21
10
votes
1 answer

get connected components using igraph in R

I would like to find all the connected components of a graph where the components have more than one element. using the clusters gives the membership to different clusters and using cliques does not give connected components. This is a follow up…
Dinesh
  • 2,194
  • 3
  • 30
  • 52
10
votes
1 answer

Python igraph: delete vertices from a graph

I am working with enron email dataset and I am trying to remove email addresses that don't have "@enron.com" (i.e. I would like to have enron emails only). When I tried to delete those addresses without @enron.com, some emails just got skipped for…
user1894963
  • 635
  • 3
  • 11
  • 18
10
votes
1 answer

How to spread out community graph made by using igraph package in R

Trying to find communities in tweet data. The cosine similarity between different words forms the adjacency matrix. Then, I created graph out of that adjacency matrix. Visualization of the graph is the task here: # Document Term Matrix dtm =…
magarwal
  • 564
  • 4
  • 17
10
votes
1 answer

How to scale edge colors in igraph?

I'm plotting a graph with igraph and I would like the edges to have different colors depending on the strength of the connections they represent. I could set the colors but I cannot relate them to the values of the connections' strength. My current…
user3584444
  • 457
  • 1
  • 7
  • 12
10
votes
2 answers

How to generate a random graph given the number of nodes and edges?

I am using python with igraph library: from igraph import * g = Graph() g.add_vertices(4) g.add_edges([(0,2),(1,2),(3,2)]) print g.betweenness() I would like to generate a random graph with 10000 nodes and 100000 edges. The edges can be random.…
Kush Jain
  • 651
  • 2
  • 8
  • 11