In math. How to use images as vertices in GraphPlot, how to prevent images from matching?

I use GraphPlot to draw oriented graphs with approximately 100 vertices. I replace each vertex with a small rectangular or square image by defining a VertexRenderingFunction function. Images often overlap. Is there a way to get Mathematica to move vertices farther apart so that they don't overlap?

I tried various obvious options for the "Method" ("SpringElectricalEmbedding", "SpringEmbedding", "HighDimensionalEmbedding", "CircularEmbedding", "RandomEmbedding", "LinearEmbedding").

 trans = {1 -> 1, 2 -> 1, 3 -> 1, 4 -> 1, 5 -> 1, 6 -> 1, 7 -> 1, 8 -> 1, 9 -> 1, 10 -> 1, 11 -> 1, 12 -> 1, 13 -> 1, 14 -> 1, 15 -> 1, 16 -> 1, 17 -> 1, 18 -> 13, 19 -> 1, 20 -> 13, 21 -> 13, 22 -> 70, 23 -> 1, 24 -> 1, 25 -> 1, 26 -> 1, 27 -> 13, 28 -> 13, 29 -> 1, 30 -> 13, 31 -> 13, 32 -> 1, 33 -> 19, 34 -> 70, 35 -> 70, 36 -> 1, 37 -> 1, 38 -> 1, 39 -> 39, 40 -> 13, 41 -> 2, 42 -> 13, 43 -> 1, 44 -> 2, 45 -> 1, 46 -> 52, 47 -> 2, 48 -> 68, 49 -> 49, 50 -> 19, 51 -> 78, 52 -> 1, 53 -> 1, 54 -> 39, 55 -> 13, 56 -> 56, 57 -> 13, 58 -> 13, 59 -> 1, 60 -> 36, 61 -> 1, 62 -> 52, 63 -> 2, 6 4 -> 68, 65 -> 19, 66 -> 56, 67 -> 4, 68 -> 76, 69 -> 19, 70 -> 78, 71 -> 1, 72 -> 39, 73 -> 52, 74 -> 56, 75 -> 23, 76 -> 76, 77 -> 56, 78 -> 78}; image = {{1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}}; GraphPlot[trans, DirectedEdges -> True, VertexLabeling -> True, VertexRenderingFunction -> (Inset[ ArrayPlot[image, ImageSize -> 15, Mesh -> True], #1] &)] 

Output

+7
source share
1 answer

Edit [I started, based on your example]:

Using trans and image , you can try:

 p = ArrayPlot[image, ImageSize -> 35, Mesh -> True]; Graph[trans, DirectedEdges -> True, VertexLabels -> Placed[p, Tooltip], ImagePadding -> 10, ImageSize -> 500] 

Images will appear in tooltips when you hover over each vertex. If you want, you can use different images for different vertex labels; just use the rule list.

The figure below shows how it looks (without tooltips). Click the link to find out how this works with hints.

graph

+3
source

All Articles