Hi, thanks for the detailed report, I have just fixed this in the development tree, it will be included in the next release. In the mean time, you can simply rename (=copy and delete the old) attribute as a workaround.
Best, Gabor On Mon, Oct 15, 2012 at 11:53 AM, Raffaele Vacca <[email protected]> wrote: > Hi, > > there seem to be a little problem with the argument "weighted" in > graph.adjacency(). > > According to igraph manual the "weighted" argument of that function does the > following: > "If it is a character constant then for every non-zero matrix entry an edge > is created and the value of the entry is added as an edge attribute named by > the weighted argument. If it is TRUE then a weighted graph is created and > the name of the edge attribute will be weight. See also details below." > > However, when set at a character constant, "weighted" fails to name the edge > attribute it creates. It does create an edge attribute with the matrix > entries, but that attribute is not named after the "weighted" argument. It's > named "weight" just like if the argument was set as "weighted= TRUE". > > -------------------------------------------------------------------------------------- > # Sample adjacency matrix of 5 rows and 5 columns. > # Its entries are probabilities of the edge and can be 0, 0.5 or 1. > set.seed(1234) > adjacency <- matrix(sample(c(0, 0.5, 1), size= 5*5, replace= TRUE), nrow= 5, > ncol= 5) > > # Import graph from "adjacency" and try to set the matrix entries as edge > attribute named "prob" > graph.adjacency(adjmatrix= adjacency, > mode= 'upper', > weighted= 'prob', > diag= FALSE) > > # In the output value, that edge attribute is actually named "weight". > # Just like if it was "weighted= TRUE". > graph.adjacency(adjmatrix= adjacency, > mode= 'upper', > weighted= TRUE, > diag= FALSE) > > -------------------------------------------------------------------------------------- > > > > -- > * Raffaele Vacca * > PhD candidate Urban and Local European Studies > Department of Sociology and Social Research > Università degli Studi di Milano-Bicocca > Room 208, II Floor > Via Bicocca degli Arcimboldi, 8 > 20126, Milano > [email protected] > > _______________________________________________ > igraph-help mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/igraph-help -- Gabor Csardi <[email protected]> MTA KFKI RMKI _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
