是否有任何方法可以从GraphPlot生成的图形的(FullForm或InputForm)中抽象出GraphPlot应用于VertexCoordinate规则的顶点顺序?我不想使用GraphUtilities函数VertexList.我也知道GraphCoordinates,但这两个函数都适用于图形,而不是GraphPlot的图形输出.
例如,
gr1 = {1 -> 2, 2 -> 3, 3 -> 4, 4 -> 5, 5 -> 6, 6 -> 1};
gp1 = GraphPlot[gr1, Method -> "CircularEmbedding",
VertexLabeling -> True];
Last@(gp1 /. Graphics[Annotation[x___], ___] :> {x})
Run Code Online (Sandbox Code Playgroud)
给出以下六个坐标对的列表:
VertexCoordinateRules - > {{2.,0.866025},{1.5,1.723205},{0.5,1.723205},{0.,0.866025},{0.5,1.3349*10 ^ -10},{1.5,0.}}
我如何知道哪个规则适用于哪个顶点,我可以确定这与VertexList [gr1]给出的规则相同吗?
例如
Needs["GraphUtilities`"];
gr2 = SparseArray@
Map[# -> 1 &, EdgeList[{2 -> 3, 3 -> 4, 4 -> 5, 5 -> 6}]];
VertexList[gr2]
Run Code Online (Sandbox Code Playgroud)
给出{1,2,3,4,5}
但......
gp2 = GraphPlot[gr2, VertexLabeling -> True,
VertexCoordinateRules ->
Thread[VertexList[gr1] -> …Run Code Online (Sandbox Code Playgroud) 在下面的mathematica代码中
a1 = {{0, -I}, {I, 0}}
a2 = {{0, 1}, {1, 0}}
a3 = {{1, 0}, {0, -1}}
c = I*a1*a2 // MatrixForm
d = c*a3 // MatrixForm
Run Code Online (Sandbox Code Playgroud)
d的显示显示为2×2矩阵,其中1,1和2,2元素本身是2x2矩阵,而我希望它是一个普通的2x2标量矩阵?