@cedoor/nfa
Version:
TypeScript implementation of some network flow algorithms.
45 lines (44 loc) • 1.3 kB
TypeScript
import Arc from "./arc";
/**
* The Node class contains the methods to add, remove and
* modify the arcs of the node in a constant time. Each node
* contains id, balance and a map of outgoing arcs.
*/
export default class Node {
id: number;
balance: number;
private arcs;
constructor(id: number, balance: number, arcs?: Arc[]);
/**
* Adds an arc in the node.
* @param {Arc} The arc to add.
*/
addArc(arc: Arc): void;
/**
* Removes an arc from the node.
* @param {number} The head of arc the to remove.
*/
removeArc(head: number): void;
/**
* Returns an arc from the node.
* @param {number} The head of the arc to return.
* @returns {Arc} The arc to return.
*/
getArc(head: number): Arc;
/**
* Checks if there is an arc in the node.
* @param {number} The head of the arc to check.
* @param {boolean} True if the arc exists, false otherwise.
*/
hasArc(head: number): boolean;
/**
* Returns all the arcs of the node.
* @returns {Arc[]} The node arcs.
*/
getArcs(): Arc[];
/**
* Returns the number of the arcs of the node.
* @returns {number} The number of the node arcs.
*/
size(): number;
}