Is module DFS really needed?
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
Inizia ispezionando DFS e il suo utilizzo esterno da NFA.hs, quindi confronta il comportamento richiesto con Data.Graph della dipendenza containers. Verifica le versioni di GHC supportate prima di decidere se la sostituzione è praticabile. Il lavoro è completato quando è disponibile una decisione documentata, il codice inutilizzato è stato rimosso oppure la sostituzione è stata implementata, preservando il comportamento richiesto del grafo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The module DFS implements graph algorithms. From that module, only the functions out and t_close are used externally (in NFA.hs). The functions list_tree, mk_graph, edges, rev_edges, reverse_graph, scc, top_sort and dff, and the type Edge, are not used.
However, there's something else that strikes me from that module, and points to a potential cleaning opportunity:
-
The top comment reads "This module is a portable version of [...] [an] encoding of [...] linear graph algorithms. This module uses balanced binary trees instead of mutable arrays to implement the depth-first search so the complexity of the algorithms is n.log(n) instead of linear." However, isn't linear better than n times log(n)??? Why go for the latter if you can opt for the former?
-
There is an implementation of graphs in
Data.Graphin containers (and containers is already a dependency of alex), although I haven't checked if that was there already in the earliest version of GHC supported by alex, which I think is GHC 7 (?). The two functions used externally,outandt_close, could be defined, if I understand their purpose correctly, as:
out :: Graph -> Int -> [Int]
out = Data.Array.(!)
t_close :: Graph -> Graph
t_close g = buildG (bounds g) [ (v1, v2) | v1 <- vertices g, v2 <- reachable g v1 ]
List comprehensions are generally slower than map so there's probably a faster way of building t_close if performance is an issue here.
My questions are:
- Should this module be replaced by a use of
Data.Graph? - If not, should the unused functions mentioned above be removed?
- Lingua principale
- Haskell
- Stelle
- 323
- Fork
- 87
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
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 haskell/alex
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
-
UTF-8 and text 2.0Apertare: unicode
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
Agda-style LexingApertadiscussion
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
Tutte le issue di haskell/alex
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
haskell/bytestring#730 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
seal-harness/seal-harness#399 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
fmidue/codeworld-tasks#124 ·
-
allow haskell-src-exts-1.24Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
reflex-frp/reflex#563 ·