nsajko
2
Creating a weighted digraph from the stochastic matrix is easy:
julia> using Graphs, SimpleWeightedGraphs
julia> m = [0.8 0.2; 0.1 0.9]
2×2 Matrix{Float64}:
0.8 0.2
0.1 0.9
julia> map(weight, edges(SimpleWeightedDiGraph(m)))
4-element Vector{Float64}:
0.8
0.2
0.1
0.9
For how to draw the graph, see here:
https://juliagraphs.org/Graphs.jl/dev/first_steps/plotting/
1 Like