I created a discrete Markov process using p = DiscreteMarkovProcess[{1, 0, 0}, {{0, 1/2, 1/2}, {1/2, 0, 1/2}, {1/2, 1/2, 0}}];
and simulated it 5 times to create a list of lists:
data = Table[RandomFunction[p, {0, 10}][[2]][[1]][[1]], {i, 1, 5, 1}]
(*{{1, 3, 2, 1, 3, 1, 3, 1, 2, 1, 2}, {1, 2, 1, 2, 1, 2, 3, 2, 3, 2,
3}, {1, 3, 2, 1, 2, 3, 1, 2, 1, 3, 2}, {1, 3, 2, 1, 2, 1, 2, 1, 3,
1, 3}, {1, 2, 3, 1, 3, 1, 3, 2, 1, 2, 1}}*)
I would like to convert each of these lists into a list of vertices that are directed from the first member of the list to the next and then the next:
1 \[DirectedEdge] 3, 3 \[DirectedEdge] 2, 2 \[DirectedEdge] 1,
1 \[DirectedEdge] 3, 3 \[DirectedEdge] 1, 1 \[DirectedEdge] 3,
3 \[DirectedEdge] 1, 1 \[DirectedEdge] 2, 2 \[DirectedEdge] 1,
1 \[DirectedEdge] 2}
How do I do that? I explored EdgeAdd but that doesn't give me the desired result:
Table[EdgeAdd[
Graph[{data[[1]][[1]] \[DirectedEdge] data[[1]][[2]]},
VertexLabels -> "Name"],
data[[1]][[i]] \[DirectedEdge] data[[1]][[i + 1]]],
{i, 2, 5, 1}]
What function may I use to convert a list to a set of directed vertices for a Graph?