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
9
votes
2 answers

Community detection with InfoMap algorithm producing one massive module

I am using the InfoMap algorithm in the igraph package to perform community detection on a directed and non-weighted graph (34943 vertices, 206366 edges). In the graph, vertices represent websites and edges represent the existence of a hyperlink…
timothyjgraham
  • 1,142
  • 1
  • 15
  • 28
9
votes
1 answer

igraph package in r: edge labels are overlapping

I am working with the igraph package in R to visualise network flows. library(igraph) # Example Data: b <- c("countryA", "countryB", "countryC", "countryA", "countryC", "countryA") c <- c("countryB", "countryC", "countryA", "countryB",…
Daniel Ryback
  • 398
  • 6
  • 12
9
votes
1 answer

Adding vertex labels to plot in igraph

adj is a numpy array in python from igraph import * g = Graph.Adjacency(adj.tolist()) plot(g) The image has not labels of vertices, only nodes and edges. How can I enable plot to show label or vertex sequence? Thanks,
Sean
  • 4,267
  • 10
  • 36
  • 50
9
votes
1 answer

How to create a bipartite network in R with igraph or tnet

I have an edgelist for a two mode network, similar to this: person Event Amy football_game Sam picnic Bob art_show I want to perform an analysis on this in R, but seemingly everything I try fails. Converting it to a one mode network…
Olga Mu
  • 908
  • 2
  • 12
  • 23
9
votes
2 answers

selecting edges based on source/target in igraph

is there an easy way to select/delete edges based on their source and target in igraph? what I am using is essentially g.es["source"] = [e.source for e in g.es] g.es["target"] = [e.target for e in g.es] g.es["tuple"] = [e.tuple for e in g.es] …
bpeter
  • 245
  • 3
  • 8
9
votes
2 answers

Match vertex size to label size in igraph

I am trying to plot small networks using igraph in R. Each vertex in the network has a name, which is equivalent to its label. I would like to make each vertex have a rectangular symbol that is just large enough to fit its label. This is my main…
Alexander Bauer
  • 10,663
  • 8
  • 29
  • 40
9
votes
2 answers

using graph.adjacency() in R

I have a sample code in R as follows: library(igraph) rm(list=ls()) dat=read.csv(file.choose(),header=TRUE,row.names=1,check.names=T) # read .csv…
N D Thokare
  • 1,703
  • 6
  • 35
  • 57
9
votes
2 answers

igraph: how to use add_edges when there are attributes?

What if I need to create a graph in igraph and add a bunch of edges, but the edges have associated attributes? It looks like .add_edges can only take a list of edges without attributes, so I've been adding them one by one with .add_edge
user1919878
  • 145
  • 1
  • 4
9
votes
1 answer

tkplot in latex via knitr and igraph

This may be a wild strange dream. I dreampt that I could put a tkplot from igraph inside a latex document via knitr. I know Yihui is know for animation stuff so I thought maybe this is possible. A google search didn't show what I was after so…
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
9
votes
1 answer

generating a community graph in igraph

I have been searching for an answer to this question but could not find any mention, so I decided to post here. I am trying to see if igraph or any packages provide a simple way to create a "community graph" where each node represents a community in…
krishnab
  • 9,270
  • 12
  • 66
  • 123
8
votes
2 answers

Visualizing distance between nodes according to weights - with R

I'm trying to draw a graph where the distance between vertices correspond to the edge weights* and I've founde that in graphviz there is a way to draw such graph. Is there a way to do this in R with the igraph package (specfically with…
noamac
  • 123
  • 1
  • 5
8
votes
3 answers

Pass a string as literal to create a graph object

We can pass literals to make a graph as below: # R version 4.0.2 (2020-06-22) library(igraph) # igraph_1.2.6 graph_from_literal(A-B) # IGRAPH 7e5604a UN-- 2 1 -- # + attr: name (v/c) # + edge from 7e5604a (vertex names): # [1] A--B Thought…
zx8754
  • 52,746
  • 12
  • 114
  • 209
8
votes
1 answer

R: Display "popup" information when mouse hovers over (graph) visnetwork

I simulated some data and created a graph network in R using visnetwork: library(igraph) library(dplyr) library(visNetwork) #create file from which to sample from x5 <- sample(1:100, 1100, replace=T) #convert to data frame x5 =…
stats_noob
  • 5,401
  • 4
  • 27
  • 83
8
votes
1 answer

weighted graph from a data frame

I have an edgelist that I want to convert it to a weighted graph. I used the below code: edgelist <- read.table(text = " V1 v2 weights A B 1 B C 8 C D 6 D E 9 C F 12 F G 15",header=T) g<-graph_from_data_frame(edgelist) g It makes the weights as…
minoo
  • 555
  • 5
  • 20
8
votes
3 answers

How does the R igraph package compute Closeness Centrality?

I have the following network: g <- graph(c("Amy", "Ram", "Ram", "Li", "Li", "Amy", "Amy", "Li", "Kate", "Li"), directed=TRUE) and would like to understand how Closeness centrality in this network can be…
Ju Ko
  • 466
  • 7
  • 22