javascript数据结构库 [英] javascript data structures library
问题描述
我想要求推荐一些JavaScript库/库,它们提供一些基本数据结构的实现,例如优先级队列,使用任意键,尝试,图形等进行映射,以及对它们进行操作的一些算法
I'd like to ask for recommendation of JavaScript library/libraries that supply an implementation of some basic data structures such as a priority queue, map with arbitrary keys, tries, graphs, etc. along with some algorithms that operate on them.
我最感兴趣的是:
- 覆盖的功能集,
- 解决方案的灵活性 - 这主要适用于图形。例如,我必须使用提供的图表实现,
- 使用语言的功能特征 - 再次有时会提供更大的灵活性,
- 性能的执行
- The set of features covered,
- Flexibility of the solution - this mostly applies to graphs. For example do I have to use a supplied graph implementation,
- Use of functional features of the language - again it sometimes gives greater flexibility,
- Performance of the implementation
编辑
Ok ,我想指出,我知道可以使用js实现以下数据结构:
Ok, I'd like to point out that I'm aware that it's possible to implement using js the following data structures:
- 一个地图,如果键值是字符串或数字,
- 一组(使用地图实现),
- 尽管如下所述,在某些浏览器上效率低下,
目前我对优先级队列感兴趣(不要混淆常规队列)图形实现对于输入图形的格式不是非常侵入。例如,他们可以使用回调来遍历图形的结构,而不是使用固定名称访问一些具体的属性。
At the moment I'm mostly interested in priority queues (not to confuse with regular queues), graph implementations that aren't very intrusive as to the format of the input graph. For example they could use callbacks to traverse the structure of the graph rather than access some concrete properties with fixed names.
推荐答案
我推荐使用Closure Library(尤其是关闭编译器)。
I recommend to use Closure Library (especially with closure compiler).
这里有一个数据结构库 goog.structs 。
图书馆包含:
Here you have a library with data structures goog.structs. The library contains:
goog.structs.AvlTree
goog.structs.CircularBuffer
goog.structs.Heap
goog.structs.InversionMap
goog.structs.LinkedMap
goog.structs.Map
goog.structs.PriorityQueue
goog.structs.Set
例如,您可以使用单元测试: goog.structs.PriorityQueueTest 。
As example you can use unit test: goog.structs.PriorityQueueTest.
如果您需要处理数组,还可以使用数组lib: goog.array 。
If you need to work on arrays, there's also an array lib: goog.array.
如评论中所述,源已转移到 github.com/google/closure ,文档的新位置是: google.github.io/closure-library 。
As noted in comments, the source has moved to github.com/google/closure and the documentation's new location is: google.github.io/closure-library.
这篇关于javascript数据结构库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!