Classes

Problem

Represents a single constraint satisfaction problem that can be solved by topo-strict. Tracks all ids, group keys, and constraint keys to ensure that invalid keys are never added, that collisions between keys are not possible, and that all constraint keys reference some existing id or group before solving.

new Problem()
Instance Members
keysByType
keys
add(ids?, options)
toObject()
toString()
toGraph()
solve()

Graph

Represents a directed graph which is used to solve a Problem.

new Graph()
Instance Members
nodes
addNode(id)
addEdge(from, to)
toObject()
toString()
solve()

Error Classes

TopoStrictError

Base class for all errors defined by topo-strict. This class, as well as all other error classes in this project, inherit from NaniError and may use any of the constructor arguments of that class.

new TopoStrictError()

Extends NaniError

ValidationError

Error class used to indicate when invalid arguments were passed to Problem#add, or when the problem is in an invalid state-- i.e. missing keys referenced by constraints-- when calling Problem#solve or Problem#toGraph.

The reasons for failure will be instances of KeyError in the ValidationError's cause chain.

new ValidationError()

Extends TopoStrictError

KeyError

Error class used to indicate when a Problem key is not valid. Instances will be contained in the cause chain of ValidationErrors produced when calling Problem#add, Problem#solve, or Problem#toGraph.

The offending key will appear in the instance's info property.

new KeyError()

Extends TopoStrictError

CycleError

Error class used to indicate when a cycle is detected while trying to solve a Problem or Graph.

new CycleError()

Extends TopoStrictError