@hlang-org/runtime
Version:
A FBP-Inspired language for universal applications.
34 lines (33 loc) • 969 B
TypeScript
export default class Graph<T, K> {
directed: boolean;
vertices: Map<string, Vertex<K>>;
adjList: Matrix<T>;
connectedMatrix: Matrix<boolean>;
constructor(directed: boolean);
addVertex(v: Vertex<K>): void;
addEdge(e: Edge<T, K>): void;
hasDest(from: string, to: string, visited?: Set<string>): boolean;
isCircled(prev: T, next: T): boolean;
}
export declare class Vertex<T> {
data: T;
visited: boolean;
constructor(data: T);
}
export declare class Edge<T, K> {
data: T;
v1: Vertex<K>;
v2: Vertex<K>;
constructor(v1: K, v2: K, data: T);
}
declare class Matrix<T> {
matrix: Map<string, Map<string, T>>;
constructor();
setRow(row: string): Map<string, T> | undefined;
getRow(row: string): Map<string, T> | null | undefined;
set(row: string, col: string, v: T): void;
get(row: string, col: string): T | null | undefined;
cols(row: any): string[];
rows(): string[];
}
export {};