Is module DFS really needed?
还没有人认领这个 Issue。
评估
调研方向
首先检查 DFS 及其从 NFA.hs 进行的外部使用,然后将所需行为与依赖 containers 中的 Data.Graph 进行比较。在决定替换是否可行之前,检查受支持的 GHC 版本。完成的标准是形成有文档记录的决定,并删除未使用的代码或实现替换,同时保留所需的图行为。
由索引模型根据 Issue 内容生成。
描述
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?
- 主要语言
- Haskell
- 星标
- 323
- 派生
- 87
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
haskell/alex 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 5/5 一周以上 新手友好度 30/100
-
re: unicode
难度 5/5 一周以上 新手友好度 25/100
-
discussion
难度 5/5 一周以上 新手友好度 20/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
haskell/bytestring#730 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
seal-harness/seal-harness#399 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
fmidue/codeworld-tasks#124 ·
-
难度 2/5 1-3 小时 新手友好度 62/100
reflex-frp/reflex#563 ·