I have tried some codes to solve my previous edge direction problem for incidence matrix. I worked on following incidence matrix: r1 r2 r3 A 1 -3 3 B 2 -2 0 C -2 0 3 D 0 2 -3 E 0 2 -3
Then I implemented following code:
rxnsto <- read.table("incidence_matrix.txt") rxnbigsto <- graph.incidence(as.matrix(rxnsto), directed=TRUE, mode="out", multiple=FALSE, weighted=TRUE)
#For each edge if weight negative then arrow direction will be "2", if weight positive then arrow direction will be "1", if weight zero then arrow direction will be "0". for (i in 0:(ecount(rxnbigsto)-1) ) {
if( E(rxnbigsto)[i]$weight < 0 ) { E(rxnbigsto)[i]$arrow.mode <- 2 } else if ( E(rxnbigsto)[i]$weight > 0 ) { E(rxnbigsto)[i]$arrow.mode <- 1 } else if ( E(rxnbigsto)[i]$weight == 0 ) { E(rxnbigsto)[i]$arrow.mode <- 0
} } plot(......)
With this code I can plot successfully the required edge directons. However I don't know how igraph evaluates the data actually. Particularly whether graph.incidence directed "in" or "out" mode will change the calculations like degree distribution? I also wonder by assigning "rxnbigsto$arrow.mode <- 0,1,..." this is just only a plotting characteristics or can it gives the graph a real attribute that can be used further in calculations?
Best wishes.
İbrahim Mutlay Chief Science Officer Grafen Chemical Industries A Subsidiary of Hayzen Engineering Co. 24. cad. KA-CL Is Merkezi No: 165/60 Ivedik OSB-Industrial Zone
06370 Ankara, TURKEY www.grafen.com.tr Phone/Fax: +90-312-3948109 Mobile: +90-535-3033507