[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[igraph] graph.adjacency() doesn't name edge attribute as "weighted" arg
From: |
Raffaele Vacca |
Subject: |
[igraph] graph.adjacency() doesn't name edge attribute as "weighted" argument |
Date: |
Mon, 15 Oct 2012 11:53:27 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 |
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
address@hidden
- [igraph] graph.adjacency() doesn't name edge attribute as "weighted" argument,
Raffaele Vacca <=