Duplicated edges from Graph.edges(g, v) when v has a self-reference?
まだ誰も着手していません。
評価
調査の方向性
lib/graph.ex の 451 行目付近から始め、自己参照するエッジを持つ Graph.edges(graph, metric_key) を再現します。返されたエッジを Graph.edges(graph) と比較し、v_in と v_out のパスがどのように結合され、重複排除されるかを調べます。自己参照に対する意図された動作が確立され、回帰テストでカバーされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hi and first of all, thanks for maintaining this library. It has turned out to be essential to me since I started using it.
I'm a big fan of pattern matching over edges in the graph and it's a very intuitive way to write complicated case handling. However I just discovered that I'm getting duplicated edges when I am matching on, eg.
case graph |> Graph.edges(metric_key) do
%{v1: ^metric_key, v2: ^metric_key} -> ...
... other cases
end
From a glance at the code, a possible cause could be if a self-referencing edge could be described by both v_in and v_out:
https://github.com/bitwalker/libgraph/blob/15ff0b9ba8c22a9dfec5bc04096fb7025e58f34b/lib/graph.ex#L451
But the description would have to differ, otherwise the MapSet would make it unique.. Do you think this is a correct cause and if so, is it an intended one?
I don't suppose there is any inherent disadvantage in just matching instead on all edges as such:
case graph |> Graph.edges() do
%{v1: ^metric_key, v2: ^metric_key} -> ...
... other cases
_ -> [] # not the stuff we're interested in
end |> List.flatten()
Looking at the code, it seems to be pretty much the same amount of work being done -- and in my situation, I always need to flat_map anyway in what I am doing.
However, someone else may be tripped up on it and have a situation where getting duplicates could cause confusion down the line.
Best regards,
Dennis
- 主要言語
- Elixir
- スター
- 571
- フォーク
- 76
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bitwalker/libgraph のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
Failing tests オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
bitwalker/libgraph の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
carverauto/serviceradar#4596 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
agentjido/jido_harness#80 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
sevenseacat/cinder#235 ·