igraph

Colouring scheme in networkD3 vs igraph

瘦欲@ 提交于 2019-12-01 12:08:44
I have a network where I have characterised each of the nodes with previous analysis- and have assigned the colours as follows: plot.igraph(g, layout=layout.fruchterman.reingold(g), vertex.color=node_colors, vertex.label = node_names) The variable 'node_colors' is a vector that was made from previous analysis so that the colours would coincide with the vertex placement/ clustering. However when I try to implement a personalised colouring scheme in networkD3, I get an 'unused argument' error: data<-igraph_to_networkD3(g, group = members) forceNetwork(Links = data$links, Nodes = data$nodes,

Building R igraph package in Win7

余生颓废 提交于 2019-12-01 12:02:00
问题 I made a small change to the source code of the igraph package because I want to implement the forest fire method based on the breadth first search method. I used Rtools to build the package and followed the steps as this link. But, I got a error message: foreign-graphml.c:38:29: fatal error: libxml/encoding.h: No such file or directory. I tested using the source code, but still had the same error. I also used the install.packages() method. It still showed the same error. Update: I downloaded

Find total of second variable related to the distance of route from get.shortest.paths()

元气小坏坏 提交于 2019-12-01 11:54:06
问题 I found the following question ( Find distance of route from get.shortest.paths() ) very helpful, but would like to take it one step further. I have added one column to the data frame and I would like to get the "total distance" related to the min newcost path. Below the igraph / R code that I used. df2 = rbind(c(234,235,21.6,75), c(234,326,11.0,35), c(235,241,14.5,78), c(326,241,8.2,98), c(241,245,15.3,75), c(234,245,38.46,65)) df2 = as.data.frame(df2) names(df2) = c("start_id","end_id",

Finding root vertices in largeish dataset in igraph on R

大兔子大兔子 提交于 2019-12-01 11:51:22
Suppose you have an graph that you've made from an edgelist, and there are a couple hundred vertices. What I'm looking to do is to identify the initial set of vertices from which all subsequent ones are related to (like a mother, or family tree). This is a data set that represents 'ice islands', large tabular sheets of ice that break off from glaciers and float around the sea. The initial fractures represent the root nodes. The subsequent vertices are re-observations of these pieces that are either smaller (melted islands), or pieces that have broken off (so the source vertex has a network of

How arrange diagram in R

自古美人都是妖i 提交于 2019-12-01 11:12:02
问题 I want to get diagram similar to picture below, but code I use creates different diagram. With rbind I added some hierarchy to a diagram. In data frame col0 there is a string with names of animals. In col1 string is split into individual animals & col2 is adding latin name for a animal. col1 data are always changing and in col2 data constant (there always be feline or canis names in that column). library(igraph) # I create my dataframe with animals df <- data.frame(col0 = c("Cat Dog Wolf",

Colouring scheme in networkD3 vs igraph

随声附和 提交于 2019-12-01 10:13:22
问题 I have a network where I have characterised each of the nodes with previous analysis- and have assigned the colours as follows: plot.igraph(g, layout=layout.fruchterman.reingold(g), vertex.color=node_colors, vertex.label = node_names) The variable 'node_colors' is a vector that was made from previous analysis so that the colours would coincide with the vertex placement/ clustering. However when I try to implement a personalised colouring scheme in networkD3, I get an 'unused argument' error:

Boggle cheat… erm… solutioning with graphs in R

风格不统一 提交于 2019-12-01 08:47:14
I have seen a few others posts relating to this game, but none of them was centered around the type of algorithm I've opted for, at least not in much details yet. This is also a pretense for me to learn more about graphs (such as with the igraph package). Needless to say, I don't encourage people to cheat in any situation. This is really a learning challenge I set for myself - it's often through those things I learn the most in the end. My plan involves some prep work besides the obvious collection of French dictionary . First big step was to construct an igraph that looks like this,

Boggle cheat… erm… solutioning with graphs in R

别来无恙 提交于 2019-12-01 07:16:38
问题 I have seen a few others posts relating to this game, but none of them was centered around the type of algorithm I've opted for, at least not in much details yet. This is also a pretense for me to learn more about graphs (such as with the igraph package). Needless to say, I don't encourage people to cheat in any situation. This is really a learning challenge I set for myself - it's often through those things I learn the most in the end. My plan involves some prep work besides the obvious

How to change the colour of nodes?

╄→尐↘猪︶ㄣ 提交于 2019-12-01 06:16:48
I'm trying to change the colour of the nodes dependent upon the month. At the moment, I've done it this way which isn't concise at all and wouldn't work for large datasets. Is there a better way of doing it? Data <- read.csv(.....) library(igraph) MartixData <- as.matrix(Data) NetworkData <- graph.adjacency(MatrixData, mode="directed", weighted=TRUE) V(NetworkData) V(NetworkData)$month <- c("June", "July", "July", "February", "September", "June", "September", "June", "December", "September", "March", "April", "September") plot(NetworkData, layout=layout.circle, vertex.color=c("yellow", "red",

r igraph find all cycles

十年热恋 提交于 2019-12-01 04:56:35
问题 I have directed igraph and want to fetch all the cycles. girth function works but only returns the smallest cycle. Is there a way in R to fetch all the cycles in a graph of length greater then 3 (no vertex pointing to itself and loops) 回答1: It is not directly a function in igraph, but of course you can code it up. To find a cycle, you start at some node, go to some neighboring node and then find a simple path back to the original node. Since you did not provide any sample data, I will