/** * colors for the CLRS color algorithm. * * these colors are useful because gray is "in between" white and black, but * (outside of the general move away from using white/black as identifiers) it * might be easier to conceptualize with descriptive labels like "untested" * (white), "being tested", (gray) and "testing complete" (black). */ export declare enum Color { white = 0, gray = 1, black = 2 } export declare class Vertex { /** * vertex and its subclasses have a type parameter for type * guards/reflection; each instance has a type that is set * to the static class type. */ static type: string; type: string; color: Color; /** dependencies */ edges_in: Set; /** dependents */ edges_out: Set; get has_inbound_edges(): boolean; get has_outbound_edges(): boolean; /** reset this node */ Reset(): void; /** search for this vertex among outbound edges */ SearchOutEdges(test: Vertex, recurse?: boolean): boolean; /** removes all inbound edges (dependencies) */ ClearDependencies(): void; /** add a dependent. doesn't add if already in the list */ AddDependent(edge: Vertex): void; /** remove a dependent */ RemoveDependent(edge: Vertex): void; /** add a dependency. doesn't add if already in the list */ AddDependency(edge: Vertex): void; /** remove a dependency */ RemoveDependency(edge: Vertex): void; /** * this is a composite operation, because the operations are always called * in pairs. this means create a pair of links such that _edge_ depends on * _this_. */ LinkTo(edge: Vertex): void; /** * this is an alteranate formulation that may make more intuitive sense. * it creates a pair of forward/backward links, such that _this_ depends * on _edge_. */ DependsOn(edge: Vertex): void; /** * this is called during calculation (if necessary). on a hit (loop), we * reset the color of this, the test node, to white. there are two reasons * for this: * * one, we want subsequent tests to also find the hit. in some cases we may * not be marking the node as a loop (if it precedes the backref in the graph), * so we want subsequent nodes to also hit the loop. [Q: this makes no sense, * because this would still hit if the node were marked grey, assuming you * test for that]. * * two, if you fix the loop, on a subsequent call we want to force a re-check, * which we can do if the vertex is marked white. [Q: could also be done on * gray?] * * [A: logically you are correct, but this works, and matching grey does not]. */ LoopCheck(): boolean; }