C# 区间树类

发布于 2024-12-25 14:55:18 字数 388 浏览 3 评论 0原文

我正在寻找一个区间树 C# 集合类。

我需要能够添加间隔,最好是二维间隔,否则也许我可以组合两个标准的一维间隔树。

我还需要能够找出哪些间隔与给定间隔重叠。

我找到了这个 intervaltree.codeplex.com 但是

没有与此版本相关的下载。

编辑:

继续此处:C# 使用其他代码

I'm looking for an interval tree C# collection class.

I need to be able to add intervals, idealy 2D, otherwise perhaps I could combine two standard 1D interval trees.

I also need to be able to find out what intervals overlap a given interval.

I found this intervaltree.codeplex.com but

There are no downloads associated with this release.

edit:

Continue here: C# using others code

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

他不在意 2025-01-01 14:55:19

您可以找到间隔树的另一个 C# 实现(基于自平衡 avl 树)@ http:// code.google.com/p/intervaltree/

you can find another c# implementation for an interval tree (based on a self balancing avl tree) @ http://code.google.com/p/intervaltree/

醉南桥 2025-01-01 14:55:19

对于未来的访问者,我也编写了一个实现 https://github.com/vvondra/Interval-Tree

For future visitors, I've written an implementation as well https://github.com/vvondra/Interval-Tree

水波映月 2025-01-01 14:55:19

另一种实现可以在 https://github.com/erdomke/RangeTree 找到。与其他实现不同,它的目标是尽可能拥有类似于 IDictionary的接口。它可以按如下方式使用:

var tree = new RangeTree<int, string>()
{
    { 0, 10, "1" },
    { 20, 30, "2" },
    { 15, 17, "3" },
    { 25, 35, "4" },
};

// Alternatively, use the Add method, for example:
// tree.Add(0, 10, "1");

var results1 = tree[5]; // 1 item: [0 - 10] "1"

Yet another implementation can be found at https://github.com/erdomke/RangeTree. Unlike other implementations, it aims to have an interface that is similar to IDictionary<TKey, TValue> where possible. It can be used as follows:

var tree = new RangeTree<int, string>()
{
    { 0, 10, "1" },
    { 20, 30, "2" },
    { 15, 17, "3" },
    { 25, 35, "4" },
};

// Alternatively, use the Add method, for example:
// tree.Add(0, 10, "1");

var results1 = tree[5]; // 1 item: [0 - 10] "1"
不知在何时 2025-01-01 14:55:18

我刚刚编写了另一个实现,可以在这里找到:
https://github.com/mbuchetics/RangeTree

它还带有一个异步版本,可以使用以下命令重建树任务并行库(TPL)。

I just wrote another implementation which can be found here:
https://github.com/mbuchetics/RangeTree

It also comes with an asynchronous version which rebuilds the tree using the Task Parallel Library (TPL).

未蓝澄海的烟 2025-01-01 14:55:18

codeplex 页面上有一个下载: http://intervaltree.codeplex.com/SourceControl/list/变更集 ->右手边->下载

There is a download on the codeplex page: http://intervaltree.codeplex.com/SourceControl/list/changesets -> Right hand side -> Download

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文