Git Product home page Git Product logo

display-trie's Introduction

Display-Trie

A program I am working on while interning as a backend developer at a vietnamese company called Mobile World JSC. A while back I was tasked with writing a program to visualize data structures in a way that was easy to understand. Before, I was tasked with visualizing a perfect generic (k-ary) tree based on this problem1. But due to the change in data structure, I am now working with tries (prefix trees).

Originally I wanted to make a really general program that can take in any pair of preorder and postorder list and build a tree out of it, no matter the type. That proved quite challenging and I currently can't think of a solution to this. Also due to work, I had to change the program and implement something more specific, that being tries or prefix trees.

Now, rather than taking in two arrays,

  1. the program reads from a text file which contains a set of paths
  2. converts it into a list of strings, with each character representing a node
  3. builds the graph node by node, edge by edge.

input: list of paths

[0.0_0, 150000.0_1, 350000.0_2, 500000.0_3]___500000.0
[0.0_0, 150000.0_1, 350000.0_3]___470000.0
[0.0_0, 150000.0_2, 300000.0_1, 500000.0_3]___500000.0
[0.0_0, 150000.0_2, 300000.0_3, 300000.0_1]___500000.0
[0.0_0, 150000.0_3, 270000.0_1]___470000.0
[0.0_0, 150000.0_3, 270000.0_1]___470000.0
[0.0_1, 200000.0_0, 350000.0_2, 500000.0_3]___500000.0
[0.0_1, 200000.0_0, 350000.0_3]___470000.0
[0.0_1, 200000.0_2, 350000.0_0, 500000.0_3]___500000.0
[0.0_1, 200000.0_2, 350000.0_3]___550000.0
[0.0_1, 200000.0_3]___520000.0
[0.0_1, 200000.0_3]___520000.0
[0.0_2, 150000.0_0, 300000.0_1, 500000.0_3]___500000.0
[0.0_2, 150000.0_0, 300000.0_3, 300000.0_1]___500000.0
[0.0_2, 150000.0_1, 350000.0_0, 500000.0_3]___500000.0
[0.0_2, 150000.0_1, 350000.0_3]___550000.0
[0.0_2, 150000.0_3, 350000.0_1]___550000.0
[0.0_2, 150000.0_3, 350000.0_1]___550000.0
[0.0_3, 320000.0_1]___520000.0
[0.0_3, 320000.0_1]___520000.0
[0.0_3, 320000.0_1]___520000.0
[0.0_3, 320000.0_1]___520000.0
[0.0_3, 320000.0_1]___520000.0
[0.0_3, 320000.0_1]___520000.0

output:

Plotly trie graph

Footnotes

  1. https://medium.com/trendyol-tech/how-do-we-calculate-promotions-in-the-cart-85e7b50af2b6 โ†ฉ

display-trie's People

Contributors

ternt avatar

Stargazers

 avatar

Watchers

 avatar

display-trie's Issues

No way to take in data

Currently the lists need to be hardcoded into the program. There is no way for a user to input data, which it then uses to display the combination tree.

image

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.