r - Fixing nodes in igraph -


i have directed graph there start , end node , defined such no node leaves end , no node enters start. in graph want fix node start @ top of graph , end @ bottom intermediate nodes staying in between. how can achieve this? enter image description here

> final_data_graph              (conversion) (start)      alpha       beta        delta     epsilon        eta       gamma       iota       kappa     lambda           mi      theta (conversion)   0.00000000       0 0.00000000 0.00000000 0.000000e+00 0.000000000 0.00000000 0.000000000 0.00000000 0.000000000 0.00000000 0.000000e+00 0.00000000 (start)        0.00000000       0 0.03771482 0.14413063 8.571551e-05 0.006128659 0.18025972 0.013071615 0.47426392 0.002914327 0.03891484 4.285776e-05 0.10118716 alpha          0.18078800       0 0.58092440 0.03215991 1.049263e-04 0.017732543 0.03667174 0.002675620 0.06395257 0.005666020 0.03242222 0.000000e+00 0.03840302 beta           0.09504413       0 0.08766124 0.35022064 8.486083e-05 0.009164969 0.24753904 0.004327902 0.12075696 0.004752206 0.02274270 0.000000e+00 0.04760692 delta          0.53333333       0 0.00000000 0.00000000 0.000000e+00 0.066666667 0.00000000 0.000000000 0.26666667 0.066666667 0.00000000 0.000000e+00 0.06666667 epsilon        0.38628763       0 0.13991081 0.04347826 0.000000e+00 0.105351171 0.08193980 0.005574136 0.10200669 0.007246377 0.05128205 0.000000e+00 0.05351171 eta            0.42928641       0 0.11002583 0.09969325 0.000000e+00 0.023167582 0.19058767 0.002421698 0.07402325 0.008072328 0.01840491 0.000000e+00 0.03535680 gamma          0.28192371       0 0.14427861 0.05804312 0.000000e+00 0.021558872 0.08291874 0.066334992 0.15754561 0.018242123 0.05306799 0.000000e+00 0.09950249 iota           0.23902022       0 0.06370199 0.04091585 1.102111e-04 0.009202623 0.03240205 0.001790930 0.53868408 0.004573759 0.02669863 5.510553e-05 0.03160302 kappa          0.43064985       0 0.06886518 0.03685742 9.699321e-04 0.018428710 0.06498545 0.002909796 0.09602328 0.128031038 0.05431620 0.000000e+00 0.08244423 lambda         0.34914361       0 0.08695652 0.02561850 5.855658e-04 0.020348412 0.02547211 0.002488655 0.07539160 0.034401991 0.31620553 0.000000e+00 0.04977309 mi             0.00000000       0 0.25000000 0.00000000 0.000000e+00 0.000000000 0.00000000 0.000000000 0.50000000 0.000000000 0.00000000 2.500000e-01 0.00000000 theta          0.13940821       0 0.17562196 0.07949360 1.472104e-04 0.025320183 0.07198587 0.004269101 0.13513911 0.019431768 0.20491683 0.000000e+00 0.12939791 zeta           0.09929633       0 0.15871775 0.07427678 0.000000e+00 0.039874902 0.07974980 0.001563722 0.23612197 0.007036747 0.08444097 0.000000e+00 0.07271306                     zeta (conversion) 0.000000000 (start)      0.001285733 alpha        0.008499029 beta         0.010098439 delta        0.000000000 epsilon      0.023411371 eta          0.008960284 gamma        0.016583748 iota         0.011241528 kappa        0.015518914 lambda       0.013614405 mi           0.000000000 theta        0.014868247 zeta         0.146207975  ig <- graph.adjacency(final_data_graph, mode="directed", weighted=true)  plot(ig,edge.label=round(e(ig)$weight,3),edge.width=.01,edge.arrow.size=.05,layout=layout.reingold.tilford(ig, root=which(v(ig)$name=='(start)')),vertex.color="white") 

i assume want plot graph start node @ top , end @ bottom. if so, can use layout.reingold.tilford e.g. :

library(igraph)  # example graph g <- graph.empty(directed = t) g <- g + vertices(c('d','a','e','f','c','b')) g <- g + edge('a','b') g <- g + edge('a','c') g <- g + edge('b','e') g <- g + edge('b','d') g <- g + edge('c','d') g <- g + edge('d','f') g <- g + edge('e','f')  # create layout specifying root node (i.e. start) ly <- layout.reingold.tilford(g, root=which(v(g)$name=='a'),flip.y=t) # let's plot plot.igraph(g,layout=ly) 

enter image description here


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -