igraph

Optimize the runtime: change the weight of edges in an igraph takes long time. Is there a way to optimize it?

删除回忆录丶 提交于 2021-01-21 10:27:03
问题 I am searching for a set of edges in an igraph built from an osmar object and would like to change the weight of these. Since my graph is quite big, this task takes quite a long time. Since I run this function in a loop the runtime grows even bigger. Is there a way I could optimize this? Here is the code: library(osmar) library(igraph) library(tidyr) library(dplyr) ### Get data ---- src <- osmsource_api(url = "https://api.openstreetmap.org/api/0.6/") muc_bbox <- center_bbox(11.575278, 48

Optimize the runtime: change the weight of edges in an igraph takes long time. Is there a way to optimize it?

安稳与你 提交于 2021-01-21 10:25:11
问题 I am searching for a set of edges in an igraph built from an osmar object and would like to change the weight of these. Since my graph is quite big, this task takes quite a long time. Since I run this function in a loop the runtime grows even bigger. Is there a way I could optimize this? Here is the code: library(osmar) library(igraph) library(tidyr) library(dplyr) ### Get data ---- src <- osmsource_api(url = "https://api.openstreetmap.org/api/0.6/") muc_bbox <- center_bbox(11.575278, 48

How to set the resolution parameter for Louvain modularity in igraph?

风格不统一 提交于 2021-01-21 09:26:17
问题 is there a way to set the resolution parameter when using the function cluster_louvain to detect communities in igraph for R? It makes a lot of difference for the result, as this parameter is related to the hierarchical dissimilarity between nodes. Thank you. 回答1: The easiest way to do it is through the resolution package, available in this link https://github.com/analyxcompany/resolution It is based on this paper http://arxiv.org/pdf/0812.1770.pdf It pretty much has 2 functions cluster

How to plot only large communities/clusters in R

ぃ、小莉子 提交于 2021-01-02 07:16:38
问题 I have an igraph in g . Since the graph is huge I only want to plot communities with more than 10 members, but I want to plot them all in one plot. My idea to remove unwanted elements is: g <- delete_vertices(g, V(g)[igraph::clusters(g)$csize < 10]) but for some reason this plots a lot of single nodes, which is the opposite of what I try to achieve. Can you tell me where I am wrong? 回答1: Your idea is great, but the problem is that igraph::clusters(g)$csize < 10 only returns a logical vector

How to get vertex ids back from graph

空扰寡人 提交于 2020-12-28 07:01:43
问题 Please consider the following library(igraph) id <- c("1","2","A","B") name <- c("02 653245","03 4542342","Peter","Mary") category <- c("digit","digit","char","char") from <- c("1","1","2","A","A","B") to <- c("2","A","A","B","1","2") nodes <- cbind(id,name,category) edges <- cbind(from,to) g <- graph.data.frame(edges, directed=TRUE, vertices=nodes) Now I want to access a specific vertex of the graph using the ids I used to create the graph from the data frame id <- c("1","2","A","B") . Let's

How to deals with unknown label and edges in python graph

左心房为你撑大大i 提交于 2020-12-15 19:37:50
问题 I have two arrays, a and b. I would like to draw the networkx graph that group the values together which are close to each other and label them accordingly. Any idea how to do this? 回答1: Finding close pairs Your algorithm finds closest point of b to each point of a but you need to identify a list of them within some threshold for distance (which might be empty in most of cases). This can be achieved with an assist of scipy.spatial.KDTree : import numpy as np from scipy.spatial import KDTree

How to deals with unknown label and edges in python graph

不羁的心 提交于 2020-12-15 19:35:12
问题 I have two arrays, a and b. I would like to draw the networkx graph that group the values together which are close to each other and label them accordingly. Any idea how to do this? 回答1: Finding close pairs Your algorithm finds closest point of b to each point of a but you need to identify a list of them within some threshold for distance (which might be empty in most of cases). This can be achieved with an assist of scipy.spatial.KDTree : import numpy as np from scipy.spatial import KDTree

How to deals with unknown label and edges in python graph

倖福魔咒の 提交于 2020-12-15 19:34:37
问题 I have two arrays, a and b. I would like to draw the networkx graph that group the values together which are close to each other and label them accordingly. Any idea how to do this? 回答1: Finding close pairs Your algorithm finds closest point of b to each point of a but you need to identify a list of them within some threshold for distance (which might be empty in most of cases). This can be achieved with an assist of scipy.spatial.KDTree : import numpy as np from scipy.spatial import KDTree

R: How to Efficiently Visualize a Large Graph Network

陌路散爱 提交于 2020-12-05 08:30:11
问题 I simulated some graph network data (~10,000 observations) in R and tried to visualize it using the visNetwork library in R. However, the data is very cluttered and is very difficult to analyze visually (I understand that in real life, network data is meant to be analyzed using graph query language). For the time being, is there anything I can do to improve the visualization of the graph network I created (so I can explore some of the linkages and nodes that are all piled on top of each other

R: How to Efficiently Visualize a Large Graph Network

妖精的绣舞 提交于 2020-12-05 08:29:37
问题 I simulated some graph network data (~10,000 observations) in R and tried to visualize it using the visNetwork library in R. However, the data is very cluttered and is very difficult to analyze visually (I understand that in real life, network data is meant to be analyzed using graph query language). For the time being, is there anything I can do to improve the visualization of the graph network I created (so I can explore some of the linkages and nodes that are all piled on top of each other