[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] igraph-help Digest, Vol 78, Issue 9
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] igraph-help Digest, Vol 78, Issue 9 |
Date: |
Fri, 18 Jan 2013 23:55:21 +0100 |
> I need to calculate the shortest paths for all
Okay, so you actually need the shortest paths and not only their lengths.
> in order to run the simulation code that follows, but I am only interested in
> shortest paths which are 6 degrees or less.
> Is there a way to specify sp<=6
No, there isn't -- you can filter the paths after you've got them. I would set
up a for loop that loops over all the vertices, calculate the shortest paths
from a single vertex to all the others using get.shortest.paths (note that this
gives you only _one_ shortest path between any vertex pair A-B, even if there
are multiple shortest paths between A and B -- if you need them all, use
get.all.shortest.paths), remove those for which the length is larger than 6,
and then concatenate all the paths you've seen into a huge list. Or store them
in a file. But still, depending on the structure of your graph, you might end
up with _many_ shortest paths, in which case storing all of them will not be an
option.
--
T.