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.
3,830
questions
0
votes
0
answers
15
views
Is there an R function for isolating infection cascades in a network graph
I am trying to isolate contagion/diffusion cascades of infections in a network graph. For example if we create the following graph:
library(igraph)
set.seed(10)
g <- sample_gnp(20, 1/5)
g <- ...
2
votes
1
answer
44
views
Unreasonable output generated by python-igraph closeness centrality
I am currently working on several graphs for generating their edge betweenness and node closeness, using python-igraph, setting as not directed, weighted, and having cut-off.
Edge betweenness could be ...
0
votes
1
answer
30
views
igraph in R: Missing edges when merging 2 graphs
I have made 2 distinct network in igraph and want to merge them into one graph. Each edge of each individual graph needs to be present in the combined graph, but there are multiple edges that are ...
0
votes
1
answer
24
views
small KS p-value in fitting power law using degree data from graph with expected power-law degree distributions
I am using the fit_power_law function from the igraph R package. The function returns "KS.p" (the p-value of the Kolmogorov-Smirnov test) as a significance test of the fitness. As I ...
0
votes
0
answers
36
views
How can I modify the size of on igraph in Rmarkdown when knitting to pdf?
I have an rmarkdown document, and am wanting to use igraph network graphs. I can create and plot the graphs with no issue, and they look fine in the viewer pane in rstudio, but the knitted .pdf has ...
0
votes
1
answer
41
views
igraph node annotation with external annotation information
This was the question which was solved where I had colors coming from modules which I wanted to label. Now I would like to know how can I put the annotation if I have another node file I would like my ...
-1
votes
0
answers
19
views
On what depends calculation of vertex positions in a network by default?
I have a directed network consisting of 80 vertices and 500 edges. How are vertex positions calculated by default?
I know that it depends on degree and to which vertices a vertex is connected. But ...
1
vote
0
answers
48
views
How to solve " Some vertex names in edge list are not listed in vertex data frame" in plotting Social Network Analysis
I have made my edge file and nodes :
edges<-structure(list(source = c("a", "a", "a", "a", "a", "a", "a",
"a", "...
1
vote
1
answer
33
views
Coloring nodes and edges based on module colors attributes
I have simple dataframe which I have obtained after running WGCNA where the correaltion was turned into and edge list from that object Im giving a small subset
dput(dd)
structure(list(gene1 = c("...
1
vote
1
answer
40
views
Create a edgelist from a table with edge attributes in R
For a networkanalysis with igraph i want to create an edgelist from a table with an edge attribute which is contained within the Origin variable.
I imported an excel file that looks like this
After ...
0
votes
1
answer
51
views
Remove duplicate rows in a Matrix in R
So I'm trying to do a networkanalysis with igraph in R, but I'm a R newbie.
My Excel database looks like this.. just bigger.
test<-separate(ID_test, 'Contacts 1', paste("Contacts", 1:20, ...
0
votes
1
answer
20
views
How to color specific nodes in the bipartite graph?
I have plotted a bipartite graph using igraph. I want to color specific nodes of my interest with different colors.
The code which i have used is
bmat=as.matrix(read.csv(file = "/home/tejaswini/...
0
votes
0
answers
25
views
igraph in R: saving as .eps places black boxes around the spherical vertices
I have made a network in igraph and need to save it as a .eps file. However, when it is saved, there are black boxes in the background for each vertex. How can I remove the black boxes?
A reproducible ...
0
votes
0
answers
46
views
Unexpected behaviour of an igraph object with append function
I use igraph library in R to create graphs, then put them into a list. To this I am trying to append a new graph. Though the new element appends, it gets "unlisted".
Please advise how to ...
0
votes
1
answer
23
views
If I calculate hub scores for nodes in a network and set "scale = TRUE", are the highest and lowest hub scores always 1 and 0?
I want to calculate hub scores for nodes in a network. I'm using igraph in R and the function "hub_score". Within this function is the argument "scale" which can be set to TRUE or ...
0
votes
1
answer
29
views
node size in igraph with R
I have such matrix to build a directed graph (sociogram):
sc=as.matrix(sociogram)
head(sc)
enter image description here
then I build my graph according with the following code:
ig <- graph....
0
votes
1
answer
46
views
Network vertices number of items to replace is not a multiple of replacement length
I am building a network in R. My .csv input file is a list with several columns and many rows. The first column contains vertices from which edges are going to other vertices. The second column ...
2
votes
1
answer
78
views
igraph in R: Directed graphs (with arrows) causes vertex color transparency
I am using the package igraph in R to be able to plot a network. However, when passing the directed = TRUE flag within the graph_from_data_frame command, it appears exactly how it should in R Studio's ...
0
votes
2
answers
36
views
Change edge size in igraph
I want to plot a simple star graph in which the size of the edges depends on a score representing a difference of perception between the central node (e.g.,a leader) and the other nodes (e.g., its ...
0
votes
1
answer
29
views
Set the size of font text for weights and nodes labels in igraph package
I would like to draw a small graph increasing the size of its fonts. For example, the following code:
library(igraph)
actors <- data.frame(name=c("a","b","c","d&...
0
votes
0
answers
50
views
pairwise_cor in R with Grouped data
I'm trying to get the correlations with word1 and word2 but with a extra column called university name.
`
palabras_correlacion <- Abstract_universities %>%
group_by(palabra) %>%...
0
votes
1
answer
38
views
How do I see the two nodes of most weighted egdes in R igraph?
I have an igraph network object constructed in R and generated weight information for each edge. I want to see the nodes of the most weighted edges (descending). What codes should I use to do that? ...
1
vote
1
answer
69
views
igraph error in R with vertex.size : longer object length is not a multiple of shorter object length
I am using the package igraph in Rto be able to plot a network. However, once I pass the command vertex.size in the graph function, it does 2 things. 1) it removes a few of the edges and directed ...
3
votes
0
answers
180
views
R: Optimally Sharing Cookies Within Groups of Friends
I am working with the R programming language.
Suppose there are 100 people - each person is denoted with an ID from 1:100. Each person can be friends with other people. The dataset can be represented ...
0
votes
1
answer
43
views
specify edge label background color or area in igraph?
I'm working on plotting a network graph, and am having trouble reading the edge labels. Is there a way to define a background color or opaque area behind the edge labels to make them more readable? ...
0
votes
2
answers
92
views
igraph: How to assign a gradient of colors to edges and vertices?
I am trying to assign the same color gradient to both, edges and vertices on igraph using R. The gradient should color from low to high counts in the V(data_graph)$Counts portion.
Some reproducible ...
0
votes
1
answer
31
views
Degrees in I graph
I am a Newbie in I-graph. I wish to know.
How to isolate nodes with a specific degree value?
How to know their node IDs
Can we draw a new graph with degrees above the given thresholds. Say nodes ...
2
votes
2
answers
98
views
efficient way to disconnect graphs while maximising edges weight
Given a connected graph and a list of N-assigned vertexes, I want to find an efficient way to create N subgraphs, each containing one of the assigned vertexes.
To achieve that, we can prune the edges. ...
0
votes
0
answers
29
views
How to calculate centrality with weight using igraph in Python
I'm using igraph to calcualate centrality measures for a large undirected network. I have a set of vertices with weights added as an attribute.
G.vs["weight"] = weight_list
I'd like to ...
0
votes
1
answer
47
views
Graph analysis and optimisation. Transform a UCG in a UAG while maximising total edge weights
I want to transform a UCG (undirected cyclic graph) into a UAG (Undirected acyclic graph)
To do so I'm looking for an algorithm that can help me prune the edges.
Let's take as example the following ...
0
votes
2
answers
65
views
How to quote() non-standard expressions, e.g. 2A-2B?
Or any other non-parseble expression as in igraph::graph_from_literal(1A +--+ 1B).
Function call quote(1A-2B) gives Error: unexpected symbol in quote(1A".
How to get a result similar to
quote(A-...
2
votes
1
answer
48
views
igraph: Add new nodes in the middle of each edge
I have a graph that each nodes and edges have their own attribute (for example, nodes have different elevation, and edges have different diameters and lengths).
Now, I want to add new nodes in the ...
2
votes
2
answers
39
views
Draw a graph indicating the weight of each arc
I would like to draw a small graph indicating its weights in the arcs. For example, the following code:
library(igraph)
actors <- data.frame(name=c("0","1","2", "...
1
vote
0
answers
53
views
How to fix the relative positions of a subset of vertices in a network/graph in ggraph R package?
I'm graphing several directed networks in R using the packages igraph and ggraph and need to be able to fix the relative positions of 4-6 vertices, depending on the network being graphed. The rest of ...
0
votes
1
answer
53
views
Collaboration Network on igraph in R from 2 Columns
I would like some help getting started in creating a network in igraph in R.
My data looks like this:
data <- data.frame(Country = c("Argentina", "Bolivia", "Chile", &...
1
vote
1
answer
27
views
Modularity in igraph: before and after October 2021
In igraph when I cluster the karate network (kar) with, say, cluster_fast_greedy, to give karfg, using modularity(karfg) gives 0.4345215. The deprecated option of including membership
modularity(kar, ...
-2
votes
1
answer
58
views
Is it possible to do a hierarchical diagram with a large dataset over 100?
I am trying to create a hierarchical graph (like a tree structure but ideally in a circle) that reflects a 3 way connection that goes from the individual sample to species to what label it falls under....
0
votes
1
answer
67
views
making sense of bfs and dfs
I'm trying to make sense of the outputs of bfs and dfs. I have a mst of some 3d point clouds which i am performing registration on, from which I want to derive a sequence of pairwise registrations ...
0
votes
0
answers
88
views
R Igraph: Finding all shortest paths for a million pair of nodes in a large network
I have a large network with 17,765 nodes and 7,4876 edges. I'm using igraph to run most of my analysis. I got stuck on finding the number of shortest paths for different pairs of nodes (around 1 ...
2
votes
1
answer
70
views
How to remove duplicate node's children (by tagging the node) in R?
Here is an reproducible data example
library(data.table)
testDT = fread(
"from to
Root A
A x1
x1 y1
y1 z1
y1 B
Root B
B x3
x3 y2
Root C")
An example visualization of the ...
0
votes
1
answer
54
views
how to make two networks connected with selected members
I have a data like this
df<- structure(list(Core = c("Bestman", "Tetra"), member1 = c("Tera1",
"Brownie1"), member2 = c("Tera2", "Brownie2&...
1
vote
3
answers
184
views
How can I implement Metropolis Hastings algorithm in an undirected connected graph in R?
I have posted a problem in Stack Mathematics regarding a Metropolis Hastings algorithm in graph which someone can read it here
(A code solution is written in the stack mathematics link but it is in ...
0
votes
0
answers
19
views
(vosonSML) Error in data.frame: arguments imply differing number of rows (removing self-loops)
I'm using R to create a descriptive actor graph based on Twitter data acquired with vosonSML. I'm trying to use the "edge_cleanup" command (using code that's been provided to me) to clean up ...
0
votes
1
answer
44
views
Subset igraph plot in using activate function in R
I am trying to subset an igraph plot to display certain nodes based on a given vertex attribute. I have to subset them in the plot output to preserve the layout for the vertices. My code is the ...
1
vote
1
answer
30
views
Odd edge behavior in `qgraph` after scaling node size with an attribute
[[Reproducible data for this question is found at bottom of question.]]
When plotting a network with qgraph, the edges usually link to nodes in a relatively straightforward way.
library(qgraph)
qgraph(...
1
vote
2
answers
60
views
Hide vertices from plot.igraph conditional on vertex attribute without deleting them
I have an igraph plot that is geographically laid out based on its latitude and longitude coordinates. I now want to hide certain points from one time period, while preserving the layout of the graph. ...
2
votes
3
answers
85
views
How can I plot a Hamiltonian graph in R?
I have the following undirected graph (picture) that contains a cycle or a Hamiltonian path of length |V|= 8. The cycle (path) with no repeated edges and vertices is the red line. The adjacency matrix ...
2
votes
3
answers
88
views
How can i plot an undirected connected graph in R?
I want to plot graph (which is an undirected connected graph) like the uploaded picture.
I want to use the adjacency matrix in order to plot it.
So my question is how can I plot a graph from its ...
0
votes
0
answers
63
views
group variables and color by type R igraph
I have a graph where I need the vertices to be in name, with a different color due to the type of data (stock, forex and commodities)... I don't understand how to do it...
in this post igraph group ...
2
votes
1
answer
98
views
visualize overlapping communities in graph by any of the python or R modules
How can I visualize communities if there are overlapping communities in the graph?
I can use any module in python (networkx, igraph, matplotlib, etc.) or R.
For example, information on nodes, edges, ...