|From:||Morais, Ana Sofia|
|Subject:||[igraph] find all paths from multiple sources|
|Date:||Thu, 8 Dec 2011 18:41:05 +0100|
I have a question on how to find all paths from multiple source-vertices to a particular destination-vertex in a graph.
As an example, please consider the following graph.
> mat <- matrix(c(0,0,0,0,0,2,0,4,2,0,0,0,0,5,3,3,0,0,0,5,0,0,0,0,0), 5, byrow = T)
> g = graph.adjacency(mat, mode="directed", weighted=TRUE)
> plot(g, edge.label=E(g)$weight)
For each source-vertex 2:5 in graph g:
a. Find all paths to the destination-vertex 1 and
b. calculate the sum of the weights of all (non-redundant) arcs in those paths, divided by the total number of (non-redundant) arcs in the paths.
Results for the graph above:
no path to vertex 1
Is there a function in Igraph that I could use to achieve this? Thank you for your time.
|[Prev in Thread]||Current Thread||[Next in Thread]|