Mathematica Asked by ablmf on December 17, 2020
I have a directed graph for which I want to reverse the direction of the arrows (not the direction of edges). I don’t want to use ReverseGraph
because it changes the layout of the graph. Can I achieve this changing EdgeStyle
?
g1 = Graph[{1 -> 3, 2 -> 1, 3 -> 6, 4 -> 6, 1 -> 5, 5 -> 4, 6 -> 1}]
EdgeStyle
Graph[g1, EdgeStyle-> Arrowheads[{-.05,0}]]
EdgeShapeFunction
Graph[g1, EdgeShapeFunction -> (Arrow @ Reverse @ # &)]
ReverseGraph
+ VertexCoordinates
:You can also use ReverseGraph
and keep the vertex layout of g1
:
ReverseGraph[g1, VertexCoordinates -> GraphEmbedding[g1]]
Correct answer by kglr on December 17, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP