I was trying to plot a 9x9 adjacency matrices which produce a useless directed graph.
Codes for that I used:
AbsoluteOptions[GridGraph[{3, 3}], VertexCoordinates]
VertexCoordinates -> Automatic
Manipulate[x = ConstantArray[0, 9 {1, 1}];
Row[{EventHandler[Dynamic[tds = Reverse[Transpose[x]];
MatrixPlot[tds, PlotRangePadding -> 0, Mesh -> All, ImageSize -> {200, 400}, ColorRules -> {1 -> Green, 0 -> None}]],
{"MouseClicked" :> (pos = Ceiling[MousePosition["Graphics"]];
x = ReplacePart[x, pos -> 1 - x[[Sequence @@ pos]]];)}],
Dynamic@AdjacencyGraph[tds, AbsoluteOptions[GridGraph[{3, 3}],
VertexCoordinates], ImageSize -> {300, 300},
PlotRange -> {{.5, 3.5}, {.5, 3.5}},
VertexStyle -> Directive[Red, Opacity[.3]], VertexSize -> .2,
VertexLabels -> "Name", EdgeStyle -> Thick, DirectedEdges -> True]}],
{pos, ControlType -> None}, {x, ControlType -> None}, {tds, ControlType -> None}, AppearanceElements -> None, FrameMargins -> 0]
Here are the coordinates as an example:
{1,3}, {3,3}, {3,4}, {4,3}
to use click on cells with given coordinates,
Arrow between nodes number 1 and 3 pass over the node number 2 and another strange half arrow on node 3. It´s might not be able with GridGraph
.
I don`t know really how can I visualise this graph better?
Thanks for your help.
GridGraph
Form. $\endgroup$ – usernew1 Sep 5 '15 at 15:02