Argument "weighted" in graph.adjacency() not naming edge attribute

Bug #1066952 reported by Raffaele Vacca
6
This bug affects 1 person
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(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)

Related branches

Changed in igraph:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Gábor Csárdi (gabor.csardi)
milestone: none → 0.6.1
Revision history for this message
Gábor Csárdi (gabor.csardi) wrote :

Fixed in revisions #3011 (0.7-main) and #2973 (0.6-main).

Changed in igraph:
status: Confirmed → Fix Released
Revision history for this message
Gábor Csárdi (gabor.csardi) wrote : Continue on github

The development of igraph has moved to github, so please do not comment on this bug here. You are of course welcome to comment on github, here:
https://github.com/igraph/igraph/issues/243

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.