I have the following functions defined:
RandomTree[n_, opts:OptionsPattern[]] :=
TreeGraph[UndirectedEdge[RandomInteger[{1,#}], # + 1] & /@ Range[1, n - 1], opts]
RandomCycleTree[n_, opts:OptionsPattern[]] := Module[{tree, e},
tree = RandomTree[n];
e = RandomChoice[EdgeList[GraphComplement[tree]]];
GraphUnion[tree, Graph[{e}], opts]]
RandomCycleTreeWeighted[n_, opts:OptionsPattern[]] :=
RandomCycleTree[n, EdgeWeight -> RandomReal[{-1, 1}, n], opts]
If I execute:
FindShortestPath[RandomCycleTreeWeighted[10,
VertexLabels -> "Name", ImagePadding -> 10], 3, 7]
it returns unevaluated. Can anyone reproduce this and explain why it is happening?
Note: I am using Mathematica 9. I also tried executing this in Mathematica 8.0 and it also didn't work.
RandomTree
function is from the documentation (up to minor variations). See the Applications section here $\endgroup$