UNPKG

graph-builder

Version:

A graph builder library for modeling abstract graph structures.

47 lines (46 loc) 2.25 kB
import { AbstractValueGraph } from "./AbstractValueGraph"; import { GraphConnections } from "./GraphConnections"; import { ElementOrder } from "./ElementOrder"; import { AbstractGraphBuilder } from "./AbstractGraphBuilder"; import { EndpointPair } from "./EndpointPair"; /** * Configurable implementation of {@link ValueGraph} that supports the options supplied by {@link * AbstractGraphBuilder}. * * <p>This class maintains a map of nodes to {@link GraphConnections}. * * <p>Collection-returning accessors return unmodifiable views: the view returned will reflect * changes to the graph (if the graph is mutable) but may not be modified by the user. * * <p>The time complexity of all collection-returning accessors is O(1), since views are returned. */ export declare class ConfigurableValueGraph<N, V> extends AbstractValueGraph<N, V> { private isDirectedValue; private allowsSelfLoopsValue; private nodeOrderValue; protected nodeConnections: Map<N, GraphConnections<N, V>>; protected edgeCountValue: number; /** Constructs a graph with the properties specified in `builder`. */ static from<N, V>(builder: AbstractGraphBuilder<N>): ConfigurableValueGraph<N, V>; /** * Constructs a graph with the properties specified in `builder`, initialized with the given * node map. */ constructor(builder: AbstractGraphBuilder<N>, nodeConnections: Map<N, GraphConnections<N, V>>, edgeCount: number); nodes(): Set<N>; isDirected(): boolean; allowsSelfLoops(): boolean; nodeOrder(): ElementOrder<N>; adjacentNodes(node: N): Set<N>; predecessors(node: N): Set<N>; successors(node: N): Set<N>; hasEdge(nodeU: N, nodeV: N): boolean; hasEdgeConnectingEndpoints(endpoints: EndpointPair<N>): boolean; edgeValueOrDefault<R>(nodeU: N, nodeV: N, defaultValue: R): V | R; edgeValueConnectingEndpointsOrDefault<R>(endpoints: EndpointPair<N>, defaultValue: R): V | R; protected edgeCount(): number; protected checkedConnections(node: N): GraphConnections<N, V>; protected containsNode(node: N): boolean; protected hasEdge_internal(nodeU: N, nodeV: N): boolean; protected edgeValueOrDefault_internal<R>(nodeU: N, nodeV: N, defaultValue: R): V | R; }