Git Product home page Git Product logo

datastructures's Introduction

datastructures

Project Status travis appveyor codecov CRAN Downloads

Implementation of core data structures for R.

Introduction

Implementation of advanced data structures such as hashmaps, heaps, or queues in R. Advanced data structures are essential in many computer science and statistics problems, for example graph algorithms or string analysis. The package uses Boost and STL data types and extends these to R with Rcpp modules.

So far datastructures has implementations for:

  • Fibonacci and binomial heaps,
  • queues and stacks,
  • hashmaps and bimaps.

As an introductory example, consider you want to compute shortest paths on a graph and decide to use a Fibonacci heap for keeping the distances. A Fibonacci heap is an efficient tree-like data structure that satisfies the min-heap property. We can use it to quickly get the node with the shortest distance in O(log n) time like this:

  fh <- fibonacci_heap("character", "numeric")
  node.labels    <- paste0("n", 10:1)
  node.distances <- seq(1, 0, length.out=length(node.labels))
  fh <- insert(fh, node.labels, node.distances)

  peek(fh)
  $n1
  [1] 0

Installation

Get the package from CRAN using:

  install.packages("datastructures")

You can also download the tarball of the latest release and install with:

  R CMD install <datastructures-x.y.z.tar.gz>

where <datastructures-x.y.z.tar.gz> is your downloaded tarball. If you want to you can also use devtools, but I don't recommend it since it might give unstable versions:

  devtools::install_github("dirmeier/datastructures")

Documentation

Load the library using library(datastructures). We provide a vignette for the package that can be called using: vignette("datastructures"). If there are any questions let met know.

Feature requests and contributing

If you want to have another datastructure added, say from boost or the STL, just open up a new issue. Alternatively it would be great if you provided a PR.

Author

datastructures's People

Contributors

dirmeier avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.