My question is concerned with the Graph
functionality, which was newly implemented in Mathematica 8. I already used GraphPlot
and LayeredGraphPlot
in the previous versions and in principle appreciate the new capabilities. However, I still wonder if the current implementation is complete. E.g. in the code below, I try to use VertexCoordinates
for each vertex, which according to the documentation for Graph
, should work.
vertices1 = {
Property[1, {VertexCoordinates -> {0, 3}, VertexSize -> 0.3}],
Property[2, VertexCoordinates -> {1, 2}],
Property[3, VertexCoordinates -> {3, 3}]
};
Graph[vertices1, {1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3}, GraphLayout -> {"LayeredDrawing", "LayeredLeft"}]
Other Options within Property
, e.g. VertexSize
, work correctly. VertexCoordinates
has no effect whatsoever. VertexCoordinates
will work as an option for Graph
, but not as a Property
for a particular vertex.
My other concern relates to GraphLayout
and in particular to the Suboption "PackingLayout"
, which also seems to have no influence whatsoever. E.g. if I use "LayeredDrawing"
, the Suboptions "LayeredLeft"
or "LayeredTop"
create the same Graph
.
What is your experience?
Answer
The following works:
ClearAll[g];
vertices1 = {1, 2, 3};
g = Graph[vertices1, {1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3}];
PropertyValue[{g, 1}, VertexSize] = .3;
PropertyValue[{g, 1}, VertexCoordinates] = {0, 3};
PropertyValue[{g, 2}, VertexCoordinates] = {1, 2};
PropertyValue[{g, 3}, VertexCoordinates] = {3, 3};
g
Comments
Post a Comment