Giter Site home page Giter Site logo

biserkov / twotree-longest-path Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 2.0 73 KB

The code from my master thesis. 100.0% Clojure.

Clojure 100.00%
clojure longest-path linear algorithm property-based-testing graph complexity memoization transients recursive

twotree-longest-path's Introduction

O(n) algorithm for computing longest paths in 2-trees

Clojars Project

cljdoc badge

Overview

In 2013 Markov, Vassilev and Manev published a novel linear time algorithm for computing longest paths in 2-trees.

This repository contains 3 implementations of said algorithm in Clojure:

The first one is a direct implementation of the mathematical operations described in the paper. Due to the need to construct subgraphs to implement splitting, the time complexity is O(nโˆšn).

The second one was suggested by Minko Markov and preprocesses the 2-tree, thus avoiding the need to construct subgraphs. The time complexity is O(n). Due to its recursive nature, this implementation will fail with a Stack Overflow Error if used on deep 2-trees with millions of vertices.

The third implementation is an iterative one. It uses the EdgeLabels map as a sort of explicit call stack. The time complexity is O(n).

Only the third one should be used for any practical purposes.

Data representation

The vertices of the graph are represented as positive integers.

On an abstract lever, the graph is represented as an adjacency list.

On a concrete level, it's a int-map in which a vertex acts as key and the corresponding values is an int-set of the its neighbours.

twotree-longest-path's People

Contributors

based2 avatar biserkov avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

based2 gomson

twotree-longest-path's Issues

Example Code or Test Input?

Hi! This looks cool. Can you push an example file, or show a simple example in code? Haven't tried to run yet, just getting an idea of how to use it.

Specifically, I want to calculate the critical path (longest weighted) path between two nodes in a graph (which might be cyclic so cycles are equivalent to an inferred node, but let's say it acyclic)

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.