0
$\begingroup$

All: I'm running the following code. It's coming up with a persistent bug that seems to be related to the graph and processing the information; see image. Any advice? This code works fine with Ver 13.3.

T = {{3/4, 1/4}, {1/3, 2/3}}; T // MatrixForm n = 2; rootnode = 1; MatrixPower[T, n] // MatrixForm g = DiscreteMarkovProcess[{1, 0}, T]; Graph[g, VertexStyle -> {1 -> Yellow, 2 -> Yellow}, EdgeLabels -> {DirectedEdge[i_, j_] :> MarkovProcessProperties[g, "TransitionMatrix"][[i, j]]}] step[_, _, 0] := {} step[T_, p : (_ -> i_), n_] := Flatten@Table[ If[T[[i, j]] > 0, {Property[p -> (p -> j), EdgeLabels -> T[[i, j]]], step[T, p -> j, n - 1]}, Nothing], {j, Length@T}] Graph[step[MarkovProcessProperties[g, "TransitionMatrix"], Begin -> rootnode, n], VertexStyle -> Yellow, VertexSize -> 0.5, VertexLabels -> {(_ -> j_) :> Placed[j, {1/2, 1/2}]}] g2 = DiscreteMarkovProcess[{0, 1}, MatrixPower[MarkovProcessProperties[g, "TransitionMatrix"], n]]; Graph[g2, VertexStyle -> {1 -> Yellow, 2 -> Yellow}, EdgeLabels -> {DirectedEdge[i_, j_] :> MarkovProcessProperties[g2, "TransitionMatrix"][[i, j]]}] 

enter image description here

$\endgroup$
2
  • $\begingroup$ It works properly under version 14.0.0.0 with nice yellow circles. Have you tried restarting the Mathematica ? $\endgroup$ Commented Nov 16, 2024 at 13:11
  • $\begingroup$ OK in 14.1 on Windows. $\endgroup$ Commented Nov 16, 2024 at 14:03

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.