I have a directed acyclic graph in rgraphviz, it's going to be rendered as a DOT graph. I want to control the appearance of nodes based on its rank. How do I find the rank of nodes?
Asked
Active
Viewed 172 times
1 Answers
0
Here's my answer. Suggestions welcome.
gR is an object of formal class GRAPHNEL
gx <- layoutGraph(gR) #can also add node attributes, sublists here
x <- gx@renderInfo@nodes$nodeX
y <- gx@renderInfo@nodes$nodeY
#x and y are named vectors with node names and x / y coordinates
#to get the names of the nodes on the top rank:
topNodes1 <- names(y[y==max(y)])

md1630
- 841
- 1
- 10
- 28