Skip to content
Jason Park edited this page Jun 9, 2016 · 18 revisions

Check out:

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
Integer.random((Number) min, (Number) max) Create a random integer inclusively 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.
DirectedGraph.random((Number) N, (Number) ratio) Create random graph data containing N nodes and having directed edges between nodes at the probability of ratio (between 0 and 1).
UndirectedGraph.random((Number) N, (Number) ratio) Basically same as DirectedGraph.random but edges do not have direction.
WeightedDirectedGraph.random((Number) N, (Number) ratio, (Number) min, (Number) max) Basically same as DirectedGraph.random but edges have a random weight between min and max.
WeightedUndirectedGraph.random((Number) N, (Number) ratio) Basically same as WeightedDirectedGraph.random but edges do not have direction.