Sampling

July 22, 2021 ยท View on GitHub

This script samples N nodes from the graph, and assigns nearest neighbors to the sampled nodes using color. Nodes are sampled based on either longest shortest distance between all previously sampled nodes or with probably proportional to the shortest distance. See more scripts here

usage

To initialize it, load a city in the city-roads, and enter the following command in the developer console.

let city = await requireModule('city-script');

The city object is your access point to all the scripts in the current repository.

city.splitToParts(partsCount, options?)

city.splitToParts(3);

This will split a city into 3 parts:

3 parts

like what you see?

Play with your city here: https://anvaka.github.io/city-roads