Entering edit mode
Dirk Koschützki
▴
20
@dirk-koschutzki-2105
Last seen 10.3 years ago
Hello,
the graph package contains a bug in the function addEdge. If I add a
second edge between vertices s and t, then any existing edge gets
replaced.
The following code shows this effect:
library (graph)
rm (list=ls())
installed.packages ()["graph",]
G1 <- new ("graphNEL", nodes=c ("A", "B", "C", "D"),
edgemode="directed")
numNodes (G1)
nodes (G1)
G2 <- addEdge ("C", "D", G1, 1.1)
numEdges (G2)
edges (G2)
edgeWeights (G2)
G3 <- addEdge ("C", "D", G2, 2.2)
numEdges (G3)
edges (G3)
edgeWeights (G3)
G4 <- addEdge ("C", "D", G3, 3.3)
numEdges (G4)
edges (G4)
edgeWeights (G4)
With R 2.2.1 and graph package 1.8.0 G4 contains three edges with the
expected weights and in R 2.4.1 running the current version of the
package G4 only contains the edge with the weight 3.3.
With kind regards,
Dirk