Duplicated edges from Graph.edges(g, v) when v has a self-reference?
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia in lib/graph.ex intorno alla riga 451 e riproduci Graph.edges(graph, metric_key) con un arco che fa riferimento a sé stesso. Confronta gli archi restituiti con Graph.edges(graph) e verifica come vengono combinati e deduplicati i percorsi v_in e v_out. Il lavoro è completato quando il comportamento previsto per i riferimenti a sé stessi è stabilito e coperto da un test di regressione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Elixir
- Stelle
- 571
- Fork
- 76
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bitwalker/libgraph
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 35/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Failing tests Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
Tutte le issue di bitwalker/libgraph
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
carverauto/serviceradar#4596 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
agentjido/jido_harness#80 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
sevenseacat/cinder#235 ·