graph.adjacency ignores diag = FALSE parameter

Bug #1077425 reported by Clemens Messerschmidt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
igraph
Fix Released
Medium
Gábor Csárdi

Bug Description

Hi,

I am running R version 2.15.1 with igraph 0.6-3 and igraph0 0.5.5-3.
I discovered the problem, that graphs created with igraph had exact the amount of edges more than the same graph created with igraph0. Looking at the Adjacency Matrix, i saw that each entry MATRIX[i,i] was 1. Although th parameter diag = FALSE was set (and correcly used by igraph0), it was ignored by igraph. Setting the diagonal to 0 before calling graph.adjacency resulted in the right graph.

Example graph, without correction, diag set to FALSE.
[1] 101
[1] 101
[1] 247
[1] 348
[1] 0.04891089
[1] 0.06891089

Example graph with correction respectively with igraph0:
[1] 101
[1] 101
[1] 247
[1] 247
[1] 0.04891089
[1] 0.04891089

I am creating two comparable networks. The first two lines show the vcount, the next two the ecount and the last two the graph.density of the both corresponding networks.

The functions works fine with igraph0.

Related branches

description: updated
Revision history for this message
Gábor Csárdi (gabor.csardi) wrote :

Here is some code to reproduce this:

library(igraph)
library(igraph0)

set.seed(42)
A <- matrix(sample(0:1, 100, replace=TRUE), nrow=10)

is.simple(igraph::graph.adjacency(A, diag=FALSE))
is.simple(igraph0::graph.adjacency(A, diag=FALSE))

Revision history for this message
Gábor Csárdi (gabor.csardi) wrote :

Fixed in revision #3008 (0.6-main) and #3056 (0.7-main).

Changed in igraph:
status: New → Fix Committed
importance: Undecided → Medium
assignee: nobody → Gábor Csárdi (gabor.csardi)
milestone: none → 0.6.1
Changed in igraph:
status: Fix Committed → 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/245

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.