For anyone who has used LayeredGraphPlot
(Mma v9), you have probably seen that the vertex spacing is consistent throughout, that vertices have the same minimum unit of spacing in the vertical and horizontal directions.
I know that changing AspectRatio
will adjust one of the directions with respect to the other, but if I want to keep the existing aspect ratio, but want to space the vertices further apart (not resizing the overall graphic).
Without specifying the actual vertex potions using VertexCoordinateRules
for each vertex, is it possible to change the vertical/horizontal spacing unit? For instance, if I just want all of the vertices to be spaced twice as far apart from each other in each direction as the default, can this be set?
UPDATE: For a given set a vertices LayeredGraphPLot
chooses this minimum spacing unit, however, if you change the list of rules, or use a different set of rules (and hence how the vertices are connected), it will redraw it with different spacing, even though it could have been done using the spacing from the original set of rules, regardless of if you leave AspectRatio
and ImageSize
as free parameters or not. There may be an algorithm to avoid vertex crowding, but I don't see why the minimum unit spacing couldn't still be set anyway.
Here is an example, note that all of the red lines are the same size, depicting the constant unit dimension between vertices.
UPDATE 2: SquareOne's solution with two different data sets:
set1 = {"A" -> "B", "B" -> "C", "D" -> "F", "A" -> "F", "G" -> "B",
"H" -> "C", "C" -> "G"};
set2 = {"B" -> "A", "B" -> "G", "D" -> "H", "A" -> "F", "G" -> "A",
"H" -> "B", "F" -> "G"};
You can see, that with the same number of rules in the list (and hence the same number of edges), the same number of vertices, with the vertices being the same size (resizing the images), and the aspect ratios allowed to vary as needed to accommodate the plot, the edgelengths are very different.
UPDATE 3: SquareOne's solution has been modified to work for arbitrary datasets, I therefore accept his solution.
ImageSize->700
can't be a solution. Could you explain why in more details? $\endgroup$Graph
withGraphLayout -> {"LayeredEmbedding", LayerSizeFunction -> (1 &), "LeafDistance" -> 1}
. However the scaling of both parameters changes nothing. $\endgroup$GraphLayout
doesn't appear to be a valid command withinLayeredGraphPLot
(this is Mma 9.0.1). $\endgroup$Graph[Table[i <-> Mod[i + 1, 5], {i, 12}], GraphLayout -> {"LayeredEmbedding", LayerSizeFunction -> (1 &), "LeafDistance" -> 1}]
. It works in both V9 and V10. $\endgroup$