# How to label edges of Continuous Markov Process

I can label a DiscreteMarkovProcess

P = {{0, 1/4, 1/2, 1/4, 0, 0}, {0, 1, 0, 0, 0, 0}, {0, 0, 1/3, 0, 2/3,
0}, {0, 0, 0, 0, 0, 1},
{0, 0, 1/4, 0, 3/4, 0}, {1/4, 0, 0, 0, 3/4, 0}};
proc = DiscreteMarkovProcess[1, P];
Graph[proc, EdgeLabels -> {DirectedEdge[i_, j_] :> P[[i, j]]}]


but how to label a ContinuousMarkovProcess (without using its discrete version) For example

P = {{-7, 2, 5, 0}, {0, -5, 0, 5}, {0, 0, -2, 2}, {0, 0, 0, 0}};
pr = ContinuousMarkovProcess[{1, 0, 0, 0}, P];
g = Graph[pr, EdgeLabels -> {DirectedEdge[i_, j_] :> P[[i, j]]}]


does not work. Inspired by the discrete answer How do I show the transition probabilities in a graph of a Markov process? I tried

PropertyList[{g, 1 \[DirectedEdge] 2}]
Scan[(PropertyValue[{g, #}, EdgeLabels] =
PropertyValue[{g, #}, "TransitionRate"]) &, EdgeList[g]]


but it does not work.

Looks like Automatic EdgeStyle settings over-ride the user-specified EdgeStyle settings when the first argument of Graph is a ContinuousMarkovProcess.

gcmp = Graph @ pr;

AnnotationValue[gcmp, EdgeLabels]

 {3 \[DirectedEdge] 4 -> Placed[2, Tooltip],
2 \[DirectedEdge] 4 -> Placed[5, Tooltip],
1 \[DirectedEdge] 3 -> Placed[5, Tooltip],
1 \[DirectedEdge] 2 -> Placed[2, Tooltip]}


1. A work-around: We can re-set AnnotationValue[gcmp, EdgeLabels] and replace Tooltip with Center:

AnnotationValue[gcmp, EdgeLabels] =
AnnotationValue[gcmp, EdgeLabels] /. Tooltip -> Center;

gcmp


2. Another simple work-around: add the option GraphStyle -> {}:

Graph[pr, GraphStyle -> {},
EdgeLabels -> {DirectedEdge[i_, j_] :> P[[i, j]]}]


Graph[pr, GraphStyle -> {},
EdgeLabels -> {DirectedEdge[i_, j_] :>
MarkovProcessProperties[pr, "TransitionMatrix"][[i, j]]}]
`