igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Custom directed weighted bipartite graphs


From: Gábor Csárdi
Subject: Re: [igraph] Custom directed weighted bipartite graphs
Date: Wed, 16 May 2012 12:52:09 -0400

On Tue, May 15, 2012 at 3:11 PM, İbrahim Mutlay <address@hidden> wrote:
> Hi,
>
> 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?

Yes, depending on whether you calculate in-degrees, out-degrees or
total degrees.
If mode is "out", then edges are create from A,B,C,... to r1,r2,r3.
For mode "in" edge directions are the opposite. These edge directions
are used in all calculations.

> 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?

No, 'arrow.mode' is only for plotting.

Best,
Gabor

> 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
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>



-- 
Gabor Csardi <address@hidden>     MTA KFKI RMKI



reply via email to

[Prev in Thread] Current Thread [Next in Thread]