Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10239 > unrolled thread

GraphPath With Edge Weights

Started byBen <benp84@gmail.com>
First post2012-05-28 09:14 +0000
Last post2012-05-28 09:14 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  GraphPath With Edge Weights Ben <benp84@gmail.com> - 2012-05-28 09:14 +0000

#10239 — GraphPath With Edge Weights

FromBen <benp84@gmail.com>
Date2012-05-28 09:14 +0000
SubjectGraphPath With Edge Weights
Message-ID<jpvfkt$q75$1@smc.vnet.net>
I can't figure out how to compute a shortest path using GraphPath with
edge weights. I first define a graph as follows.

graph = Graph[{UndirectedEdge[1,2], UndirectedEdge[2,3],
UndirectedEdge[3,1]}, EdgeWeight->{1, 2, 9}]

After loading GraphUtilities I compute GraphDistance[graph, 1, 3] and
it correctly returns the shortest path distance of 3 corresponding to
the path {1, 2, 3}.  But if I compute GraphPath[graph, 1, 3] it
returns the unweighted shortest path {1, 3}. Even if I use
GraphPath[graph, 1, 3, Weighted->True] it still returns the same
answer of {1, 3}. (Weighted is supposed be True by default anyway.)
What am I doing wrong?

Thanks.

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web