> Hello, I have a directed graph(G), > I have E(G)$Rates, > and V(G)$Capacity, > How can I create an edge attribute as E(from p1)$Weights = Origin > V(p1)$Rate * E(from p1)$Capacity?
Please clarify if I didn't understand this correctly; you would like to make the weight of each edge be equal to its capacity multiplied by the rate of the source of the edge. This should work: sources <- get.edgelist(G)[,1] + 1 E(G)$Weight <- V(G)$Rate[sources] * E(G)$Capacity The "+ 1" at the end of the first line accounts for the fact that igraph vertex IDs start at zero but R's vectors are indexes from 1. -- T. _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
