graph.adjacency ignores diag = FALSE parameter
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.
description: | updated |
Changed in igraph: | |
status: | Fix Committed → Fix Released |
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)) igraph0: :graph. adjacency( A, diag=FALSE))
is.simple(