haskell / haskell/containers

Data.Graph.bcc is not efficient

Open
#900 7 comments 0 reactions 0 assignees View on GitHub
Graph performance
Dominant language
Haskell
Stars
355
Forks
194
Avg merge
3d 4h
Merged PRs (30d)
4

Description

* The `collect` function recursively `concat`s on a tree, making the time complexity quadratic. This can be avoided using difference lists.
* The `do_label` step builds some unnecessary intermediate trees, similar to the `dfs` we had (#882).

I'm not aware of common use cases for `bcc`, so I'm not sure if this affects anyone.
But as long we have it, we should make it efficient.

I can send a PR.

Contributor guide

Open the contributing guide

Research direction

Start with Data.Graph.bcc, focusing on the collect and do_label steps, and compare them with the dfs work referenced in #882. Done means bcc avoids the reported quadratic concatenation and unnecessary intermediate trees while preserving its existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
data
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.