r - "Inverse" of the transitive closure of a weighted graph -
r - "Inverse" of the transitive closure of a weighted graph -
for network, given (non-negative) travel costs between each pair of nodes. travel costs additive. how can prune graph unnecessary edges removed (i.e. have path approximately equivalent length)? in other words, i'm looking smaller (a smallest?) graph shortest-path distance between each pair of nodes preserved.
in next example, i'm given sp
(or spg
, matter), , infer g
it:
set.seed(144) library(igraph) nv <- 100 ne <- 300 g <- erdos.renyi.game(nv, ne, "gnm", directed = false) edge.attributes(g) <- list(weight = rexp(ne, 1)) sp <- shortest.paths(g) spg <- graph.adjacency(sp, weighted = "weight")
i have few one thousand nodes, enumerating connected pairs of edges not alternative (due memory limitations), , iterating on pairs of nodes slow when implemented in r.
r algorithm igraph
Comments
Post a Comment