UNPKG

gramoloss

Version:

Graph theory package for edition and computation

45 lines (44 loc) 1.51 kB
import { Coord } from "./coord"; import { Graph } from "./graph"; import { Vertex, VertexIndex } from "./vertex"; export declare enum ORIENTATION { UNDIRECTED = "UNDIRECTED", DIRECTED = "DIRECTED" } export declare class Link { index: number; graph: Graph; startVertex: Vertex; endVertex: Vertex; orientation: ORIENTATION; color: string; cp: undefined | Coord; weight: string; constructor(index: number, graph: Graph, startVertex: Vertex, endVertex: Vertex, orientation: ORIENTATION); delete(): void; /** * Create k-1 vertices * Create k links with the same color * Delete this link * @param k */ subdivide(k: number): void; /** * Return true iff at least one extremity of the link is in the set `s`. * @return `s.has(startIndex) || s.has(endIndex)` */ hasAnExtrimityIn(s: Set<VertexIndex>): boolean; signatureEquals(startIndex: VertexIndex, endIndex: VertexIndex, orientation: ORIENTATION): boolean; /** * Test if this link intersect another link // TODO: faster algorithm for intersection between segment and bezier * TODO use in the planar test of a graph */ intersectsLink(link: Link): boolean; getWeight(): string; /** * @param fixedEnd is the coord of the extremity which has not moved * @param newPos and @param previousPos are the positions of the extremity which has moved */ transformCP(newPos: Coord, previousPos: Coord, fixedEnd: Coord): void; }