Javascript 数据结构库 [英] Javascript data structures library

查看:30
本文介绍了Javascript 数据结构库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想请教一些 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.

我最感兴趣的是:

  • 涵盖的功能集,
  • 解决方案的灵活性 - 这主要适用于图表.例如,我是否必须使用提供的图形实现,
  • 使用语言的功能特性 - 有时它再次提供了更大的灵活性,
  • 实施的表现

我想指出的是,我知道可以使用 JavaScript 实现以下数据结构:

I'd like to point out that I'm aware that it's possible to implement using JavaScript 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.

推荐答案

我推荐使用闭包库(尤其是闭包编译器).

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.

如果您需要处理数组,还有一个数组库: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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆