Re: [igraph] Calculating total number of paths between two specific nodes
Your graph is a DAG, so you can use the kth power of the adjacency matrix to count paths of length k between nodes. Furthermore, since the graph is a DAG, the adjacency matrix is nilpotent, i.e. some big enough power is zero. You basically need to compute A + A^2 + A^3 + ..., until the power becomes zero. This matrix gives you the number of paths between any two points. On Wed, 16 May 2018 at 23:03, Xu, Yanjie wrote: > Dear developers of igraph, > > > > I am currently using igraph in r to analyse directed acyclic graphs. One > of my task is calculating number of all possible paths between the “start” > and “end” nodes. With igraph, I can get a list of all possible paths (e.g., > from node 1 to node 81) with the code below: > > > > >>all_simple_paths(net, 1, 81) > > > > Then I summarize how many paths (n) we have: > > > > >>n<-length(all_simple_paths(net, 1, 81)) > > > > This works we my network has around 15 nodes, but we the number of nodes > increase, it takes days to calculate “n” for a single network. I have > hundreds of networks waiting for calculation. Do you have an idea whether > there is a quicker way to get the number of possible paths between two > specific nodes? Many many thanks! > > > > Best regards, > > Yanjie > > > ___ > igraph-help mailing list > igraph-help@nongnu.org > https://lists.nongnu.org/mailman/listinfo/igraph-help > ___ igraph-help mailing list igraph-help@nongnu.org https://lists.nongnu.org/mailman/listinfo/igraph-help
[igraph] Calculating total number of paths between two specific nodes
Dear developers of igraph, I am currently using igraph in r to analyse directed acyclic graphs. One of my task is calculating number of all possible paths between the "start" and "end" nodes. With igraph, I can get a list of all possible paths (e.g., from node 1 to node 81) with the code below: >>all_simple_paths(net, 1, 81) Then I summarize how many paths (n) we have: >>n<-length(all_simple_paths(net, 1, 81)) This works we my network has around 15 nodes, but we the number of nodes increase, it takes days to calculate "n" for a single network. I have hundreds of networks waiting for calculation. Do you have an idea whether there is a quicker way to get the number of possible paths between two specific nodes? Many many thanks! Best regards, Yanjie ___ igraph-help mailing list igraph-help@nongnu.org https://lists.nongnu.org/mailman/listinfo/igraph-help
Re: [igraph] help about extracting the largest connected component
Dear all, Sorry for taking your time again, but I solved the issue, I think it is a version issue, the working code is below: giant.component <- function(graph) { cl <- clusters(graph) induced.subgraph(graph, which(cl$membership == which.max(cl$csize)))} Thanks again, ali On Wed, May 16, 2018 at 2:33 PM, Ali Ilhan wrote: > Dear all, > > I am pretty new to igraph and R, and having some difficulties (long time > Stata and SAS user). I have a graph of roughly 32000 vertices, which has a > largest component of around 6200 connected nodes. All I want to do is to > extract this as a new igraph object, and calculate some basic network > metrics such as density, mean degree centrality etc. > > I have tried to various things which have been suggested before in this > list, such as: > > giant.component <- function(graph, ...) { > cl <- clusters(graph, ...) > subgraph(graph, which(cl$membership == which.max(cl$csize)-1)-1) > } > > tail.component <- function(graph, ...) { > cl <- clusters(graph, ...) > subgraph(graph, which(cl$membership != which.max(cl$csize)-1)-1) > } > But could not get the code to work. I have been mainly playing with > induce.subgraph and decompose. > > > Any help is greatly appreciated. > > > Warm wishes, > > ali > > ___ igraph-help mailing list igraph-help@nongnu.org https://lists.nongnu.org/mailman/listinfo/igraph-help
[igraph] igraph for python 3.6
When can we expect an upgrade to python 3.6? Thx. ___ igraph-help mailing list igraph-help@nongnu.org https://lists.nongnu.org/mailman/listinfo/igraph-help
[igraph] help about extracting the largest connected component
Dear all, I am pretty new to igraph and R, and having some difficulties (long time Stata and SAS user). I have a graph of roughly 32000 vertices, which has a largest component of around 6200 connected nodes. All I want to do is to extract this as a new igraph object, and calculate some basic network metrics such as density, mean degree centrality etc. I have tried to various things which have been suggested before in this list, such as: giant.component <- function(graph, ...) { cl <- clusters(graph, ...) subgraph(graph, which(cl$membership == which.max(cl$csize)-1)-1) } tail.component <- function(graph, ...) { cl <- clusters(graph, ...) subgraph(graph, which(cl$membership != which.max(cl$csize)-1)-1) } But could not get the code to work. I have been mainly playing with induce.subgraph and decompose. Any help is greatly appreciated. Warm wishes, ali ___ igraph-help mailing list igraph-help@nongnu.org https://lists.nongnu.org/mailman/listinfo/igraph-help