igraph

How to get the edge list of a strongly connected components in a graph?

可紊 提交于 2020-01-03 04:21:08
问题 I have a weighted directed multigraph with a few cycles. With clusters function in igraph package, I can get the nodes belongs to a strongly connected components. But I need the path/order of the nodes that form a cycle. EDIT after @josilber's response I have a very dense graph, with 30 nodes and around 2000 edges. So graph.get.subisomorphisms.vf2 takes too long to run in my case. I'm not familiar with graph algorithm, but I'm thinking maybe do a DFS to the original or reverse graph and use

UnicodeDecodeError when installing python-igraph

有些话、适合烂在心里 提交于 2020-01-03 02:36:33
问题 I'm using python 2.7 on 64-bit Linux Mint 16 and I'm trying to install python-igraph. But when I run sudo pip install python-igraph I get 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 python-igraph Installing collected packages: python-igraph Running setup.py install for python-igraph Build type: dynamic extension Include path: /usr/include/igraph Library path: Linked dynamic

converting data frame into affiliation network in R

一个人想着一个人 提交于 2020-01-02 08:06:42
问题 I have a data frame with the following format: name workplace a A b B c A d C e D .... I would like to convert this data frame into an affiliation network in R with the format A B C D ... a 1 0 0 0 b 0 1 0 0 c 1 0 0 0 d 0 0 1 0 e 0 0 0 1 ... and I used the following program: for (i in 1:nrow(A1)) { a1[rownames(a1) == A1$name[i], colnames(a1) == A1$workplace[i]] <- 1 } where A1 is the data frame, and a1 is the affiliation network. However, since I have a large data frame, the above program

converting data frame into affiliation network in R

こ雲淡風輕ζ 提交于 2020-01-02 08:06:10
问题 I have a data frame with the following format: name workplace a A b B c A d C e D .... I would like to convert this data frame into an affiliation network in R with the format A B C D ... a 1 0 0 0 b 0 1 0 0 c 1 0 0 0 d 0 0 1 0 e 0 0 0 1 ... and I used the following program: for (i in 1:nrow(A1)) { a1[rownames(a1) == A1$name[i], colnames(a1) == A1$workplace[i]] <- 1 } where A1 is the data frame, and a1 is the affiliation network. However, since I have a large data frame, the above program

How to plan the most efficient route for patio lights

…衆ロ難τιáo~ 提交于 2020-01-02 05:55:52
问题 I'm trying to string up some patio lights. Based on another question I asked, I realize I need an algorithm to solve a Route Inspection Problem to figure out the most efficient route the lights should take so there's minimal duplicate edges covered with lights. After some searching I realized that perhaps something like this would be my best bet: Solving Chinese Postman algorithm with eulerization. However, I'm having trouble creating the graph. Here's what it needs to look like: pink circles

Change edge thickness in igraph plot R according to Edge Attributes

元气小坏坏 提交于 2020-01-02 00:52:15
问题 I want to change the edge width of my graph to correspond to the edge.betweenness score. net <- read.csv("D:/SNA/R/Net.csv") att <- read.csv("D:/SNA/R/Att.csv") g <- graph.data.frame(net, vertices=att, directed=TRUE) pdf("Network.pdf", pointsize=8) plot(g, vertex.label=NA, vertex.size=3, edge.width=edge.betweenness(g)) dev.off() I have also tried creating the edge betweenness score as an edge weight and assigning it to edge.width argument in the plot function as follows; plot(g, vertex.label

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

浪子不回头ぞ 提交于 2019-12-31 10:45:32
问题 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 which: -Calculates all possible communities -Calculates the optimum number of communities -Returns the members/# of members of each (optimum) community So far I've managed to pull together the following code which plots a color coded graph

forceNetwork is not zero indexed

試著忘記壹切 提交于 2019-12-31 01:56:09
问题 I am trying to create a simple forceNetwork , but the plot won't render. I keep getting the following warning: Warning message: It looks like Source/Target is not zero-indexed. This is required in JavaScript and so your plot may not render. How do I fix this? Note that simpleNetwork works fine so the problem seems to be in how I am specifying my data. library(igraph) library(networkD3) set.seed(42) temp<-data.frame(source=c(1,2,3,4),target=c(2,3,4,4))#csv[1:500,] links<-data.frame(source=temp

Vertex frame width in R network plot

本小妞迷上赌 提交于 2019-12-30 18:51:08
问题 My question follows the one here, about how to change the vertex frame width in igraph. With updates in igraph, the proposed solution seems not to work anymore. Does anybody have a solution (or maybe knows another package that provides networks with changeable vertex frame width?) Thanks! 回答1: You can define a new vertex shape that has a frame width parameter. It is not very hard, see an example here: http://lists.gnu.org/archive/html/igraph-help/2013-03/msg00030.html 来源: https:/

Creating Subgraph using igraph in R

亡梦爱人 提交于 2019-12-30 07:26:24
问题 I need to obtain a subgraph of the seed nodes (the input list of nodes; file.txt) and their first interactors (neighbours) from a graph (g) using igraph. Unfortunately, I am ending up with only a single node in the subgraph, and not all the rest of the nodes and edges (vertices) which interlink them. g<-read.graph("DATABASE.ncol",format="ncol",directed=FALSE) #load the data g2<-simplify(g, remove.multiple=TRUE, remove.loops=TRUE) # Remove the self-loops in the data DAT1 <- readLines("file.txt