Entering edit mode
hi,
i've come across the following bug in the 'graph' package related to
the
method 'removeEdge()' for 'graphBAM' objects:
library(graph)
g <- graphBAM(data.frame(from="A", to="B", weight=1))
g
A graphBAM graph with undirected edges
Number of Nodes = 2
Number of Edges = 1
edges(g)
$A
[1] "B"
$B
[1] "A"
removeEdge(from="A", to="B", g=g)
A graphBAM graph with undirected edges
Number of Nodes = 2
Number of Edges = 0
up to here everything is fine, the problem shows up when i try to
remove
this undirected edge swapping the values of the 'from' and 'to'
argument
because then the edge is not removed, even though the graph is
undirected, and therefore, is that it should work in this case either
way:
removeEdge(from="B", to="A", g=g)
A graphBAM graph with undirected edges
Number of Nodes = 2
Number of Edges = 1
and in fact it does work if the input 'graphBAM' object is coerced to
a
'graphNEL' or a 'graphAM' object:
removeEdge(from="B", to="A", g=as(g, "graphNEL"))
A graphNEL graph with undirected edges
Number of Nodes = 2
Number of Edges = 0
removeEdge(from="B", to="A", g=as(g, "graphAM"))
A graphAM graph with undirected edges
Number of Nodes = 2
Number of Edges = 0
this can be reproduced both in release and devel; see my sessionInfo()
below for both cases.
best regards,
robert.
ps1: sessionInfo() ## release
R version 3.1.0 (2014-04-10)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF8 LC_NUMERIC=C
LC_TIME=en_US.UTF8
[4] LC_COLLATE=en_US.UTF8 LC_MONETARY=en_US.UTF8
LC_MESSAGES=en_US.UTF8
[7] LC_PAPER=en_US.UTF8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF8
LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] graph_1.42.0 vimcom_0.9-93 setwidth_1.0-3 colorout_1.0-2
loaded via a namespace (and not attached):
[1] BiocGenerics_0.10.0 parallel_3.1.0 stats4_3.1.0
tools_3.1.0
ps2: sessionInfo() ## devel
R version 3.1.0 (2014-04-10)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF8 LC_NUMERIC=C
LC_TIME=en_US.UTF8
[4] LC_COLLATE=en_US.UTF8 LC_MONETARY=en_US.UTF8
LC_MESSAGES=en_US.UTF8
[7] LC_PAPER=en_US.UTF8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF8
LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] graph_1.43.0 vimcom_0.9-93 setwidth_1.0-3 colorout_1.0-2
loaded via a namespace (and not attached):
[1] BiocGenerics_0.11.3 parallel_3.1.0 stats4_3.1.0
tools_3.1.0