Fixed node locations using graphplot() with Markov chains
Show older comments
Hi,
I have developed a few lines of code to generate markov chains from a transition vector ('stagesVec'). The code works well and I now wish to compare multiple transition vectors. If I run the code a second time with a second transition vector I get a new Markov chain with the new infromation.
My problem is this, the two Markov chains have the same nodes, however the nodes move (plotting location) between graphs, this makes a visual inspection very difficult. I would like for the nodes to remain in the same place, but edges (the connecting lines between the nodes) to be removed as required by the probability matrix. I will include a couple of images below to hopefully make this easier to understand! I have had a look at both doc graphplot and figure -> edit but cannot see anything obvious.
Thanks for the help,
Christopher
tm = full(sparse(stagesVec(1:end-1),stagesVec(2:end),1));
stateNames = ["N1" "N2" "N3" "R" "U" "W" ];
mc = dtmc(tm,"StateNames",stateNames);
figure()
graphplot(mc);

Accepted Answer
More Answers (0)
Categories
Find more on Markov Chain Models in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!










