4
$\begingroup$

I have a Markov chain with graphs as the states. Basically how one network structure would evolve to another in the next period. To avoid confusion, I'll use the term "network" instead of "graph".

I could plot out the state diagram (stored in proc) using with the code

edgefunction[pts_List, e_] := {Arrowheads[{{0.005, 0.5, Graphics@{Blue, Polygon[{{-1.5, -1}, {1.5, 0}, {-1.5, 1}}]}}}], Arrow[pts]};
g = Graph[proc];
Scan[(PropertyValue[{g, #}, EdgeStyle] = Directive[GrayLevel[0.7], Thickness[PropertyValue[{g, #}, "Probability"]/100]]) &, EdgeList[g]];
Scan[(PropertyValue[{g, #}, EdgeShapeFunction] = edgefunction) &, EdgeList[g]];
g

so it looks like this:

...

Now I'd like to replace the label in the nodes with pictures of the networks. I have strings (Graph6 format) that allows me to do this:

graphlist = ImportString[Import["../out.txt"], "Graph6"]

enter image description here

The entries correspond to nodes 1 through 8. I'd like to graph this in the CircularEmbedding layout as well (so that it fits into the shape of the nodes better).

I know it's something with the VertexShapeFunction but not sure how. Thanks a lot!

$\endgroup$
3
$\begingroup$
proc = DiscreteMarkovProcess[3, {{1/4, 3/4, 0, 0}, {1/3, 1/3, 1/3, 0}, 
       {1/4, 1/4, 1/4, 1/4}, {0, 0, 0, 1}}];

labels = Table[RandomGraph[{5, 6}, ImageSize -> 30, EdgeStyle -> Thick], {4}];

g = Graph[proc, EdgeShapeFunction -> edgefunction, VertexSize -> .25, 
   VertexLabels -> Thread[Range[4] -> (Placed[#, Center] & /@ labels)]];

SetProperty[g, EdgeStyle -> (# -> {GrayLevel[.7], 
        Thickness[PropertyValue[{g, #}, "Probability"]/100.]} & /@ EdgeList[g])]

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.