We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug
(discovered while solving AoC 2024 Day 5)
Adding edges to a graph that was created with digraph_utils:subgraph can fail with bad_edge unexpectedly.
digraph_utils:subgraph
bad_edge
The cause: when digraph_utils:subgraph copies edges into the result, it does not copy $eid in ntab so edge names are reused.
$eid
ntab
To Reproduce
%% simple reproduction for subgraph bug main([]) -> G = digraph:new(), digraph:add_vertex(G, 1), digraph:add_vertex(G, 2), digraph:add_edge(G, 1, 2), SG = digraph_utils:subgraph(G, [1,2]), Result1 = digraph:add_edge(SG, 2, 1), io:format("~p~n", [Result1]), Result2 = digraph:add_edge(SG, 2, 1), io:format("~p~n", [Result2]).
prints (on OTP 27.1.2):
mattjones@Matts-Mac-Studio day5 % escript bug.erl {error,{bad_edge,[2,1]}} ['$e'|1]
Expected behavior
The first call to digraph:add_edge should succeed.
digraph:add_edge
Affected versions Tested on 27.1.2, but digraph_utils.erl has not changed much over the years so likely many previous versions.
digraph_utils.erl
The text was updated successfully, but these errors were encountered:
lucioleKi
No branches or pull requests
Describe the bug
(discovered while solving AoC 2024 Day 5)
Adding edges to a graph that was created with
digraph_utils:subgraph
can fail withbad_edge
unexpectedly.The cause: when
digraph_utils:subgraph
copies edges into the result, it does not copy$eid
inntab
so edge names are reused.To Reproduce
prints (on OTP 27.1.2):
Expected behavior
The first call to
digraph:add_edge
should succeed.Affected versions
Tested on 27.1.2, but
digraph_utils.erl
has not changed much over the years so likely many previous versions.The text was updated successfully, but these errors were encountered: