Skip to content
Jason Park edited this page May 22, 2016 · 18 revisions

Algorithm Visualizer

Hierarchy of algorithm Directory

Path Description
/algorithm/category.json This file contains the list of categories and their algorithms.
/algorithm/[category]/[algorithm]/desc.json This file contains the description of the algorithm and the list of its examples.
/algorithm/[category]/[algorithm]/[example]/data.js This file predefines data variables that will be shown in a visualizing module.
/algorithm/[category]/[algorithm]/[example]/code.js This file actually implements and visualizes the algorithm.

Visualizing Modules

Creating Random Data

Function Description
Graph.random((Number) N, (Number) ratio) Create random graph data containing N nodes and having edges between nodes at the probability of ratio (between 0 and 1).
WeightedGraph.random((Number) N, (Number) ratio, (Number) min, (Number) max) Basically same as Graph.random but edges have a random weight between min and max.
Array2D.random((Number) N, (Number) M, (Number) min, (Number) max) Create random N * M array data that elements have a random value between min and max.
Array2D.randomSorted((Number) N, (Number) M, (Number) min, (Number) max) Basically same as Array2D.random but elements in each row are sorted in increasing order.
Array1D.random((Number) N, (Number) min, (Number) max) Create random one-dimensional array data of size N that elements have a random value between min and max.
Array1D.randomSorted((Number) N, (Number) min, (Number) max) Basically same as Array1D.random but elements are sorted in increasing order.

Clone this wiki locally