Argument "weighted" in graph.adjacency() not naming edge attribute
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
igraph |
Fix Released
|
Medium
|
Gábor Csárdi |
Bug Description
According to igraph manual on the function graph.adjacency(), 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
# In the output value, that edge attribute is actually named "weight".
# Just like if it was "weighted= TRUE".
graph.adjacency
Changed in igraph: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
assignee: | nobody → Gábor Csárdi (gabor.csardi) |
milestone: | none → 0.6.1 |
Fixed in revisions #3011 (0.7-main) and #2973 (0.6-main).