Bug in digraph:add_edge/5

Crystal Din crystaldin49@REDACTED
Sat Jun 13 15:18:38 CEST 2009


Hi,

Version: Erlang/OTP R13B. Bug in digraph:add_edge/5

>From the documentation of digraph module, it says add_edge/5 creates (or
modifies) the edge E of the digraph G. However, the
existing edges are not correctly modified.

--------------------Set up digraph-----------------

1>G=digraph:new().

2>digraph:add_vertex(G).
     ['$v'|0]

3>digraph:add_vertex(G).
     ['$v'|1]

4>digraph:add_vertex(G).
     ['$v'|2]

5>digraph:add_vertex(G).
     ['$v'|3]

6>digraph:add_edge(G,['$e'|0],['$v'|0],['$v'|1],{}).
     ['$e'|0]

7>digraph:add_edge(G,['$e'|0],['$v'|2],['$v'|3],{}).
     ['$e'|0]


According to the documentation, there should be only one edge, ['$e'|0], in
the digraph and it is from ['$v'|2] to ['$v'|3].
But that actually ['$v'|0] and ['$v'|1] still seem to be connected to the
edge,['$e'|0]. We can see the bugs from the following.


-----------------------Bug--------------------------

8>digraph:out_degree(G,['$v'|0]).
       1

9>digraph:out_edges(G,['$v'|0]).
       [[‘$e’|0]]

10>digraph:out_neighbours(G,[‘$v’|0]).
       [[‘$v’|3]]

11>digraph:in_degree(G,['$v'|1]).
       1

12>digraph:in_edges(G,['$v'|1]).
       [[‘$e’|0]]

13>digraph:in_neighbours(G,[‘$v’|1]).
       [[‘$v’|2]]


-----------------expected results--------------------

8>digraph:out_degree(G,['$v'|0]).
       0

9>digraph:out_edges(G,['$v'|0]).
       []

10>digraph:out_neighbours(G,[‘$v’|0]).
       []

11>digraph:in_degree(G,['$v'|1]).
       0

12>digraph:in_edges(G,['$v'|1]).
       []

13>digraph:in_neighbours(G,[‘$v’|1]).
       []


/Crystal Din


More information about the erlang-bugs mailing list