Options
All
  • Public
  • Public/Protected
  • All
Menu

Adapter for the npm graphlib module. You need to add graphlib as a dependency and pass a reference to the graphlib Graph constructor to the constructor of this class.

see

CommonAdapter

Type parameters

Hierarchy

  • GraphlibAdapter

Implements

Index

Accessors

graph

graph:

Allows access to the graphlib graph. May be used for some algorithms Do not use this to modify the graph, or the cycle detection may not work anymore.

Methods

addEdge

  • addEdge(from: TVertex, to: TVertex, data?: TEdgeData): boolean

addVertex

  • addVertex(vertex: TVertex): boolean

canAddEdge

  • canAddEdge(from: TVertex, to: TVertex): boolean

canContractEdge

  • canContractEdge(from: TVertex, to: TVertex): boolean

clone

  • clone(vertexDataCloner?: UnaryOperator<TVertex>, edgeDataCloner?: UnaryOperator<TEdgeData>): GraphlibAdapter<TVertex, TEdgeData>
  • Creates an independent copy of this graph data structure. Further changes to this graph are not reflected in the returned copy, and vice-versa.

    All vertices and edges are copied as-is and are not cloned, so that changing the state of a vertex or edge also changes the state of the vertex or edge in the copied graph.

    Optionally you can also pass a function for cloning the vertices and edges.

    Parameters

    • Optional vertexDataCloner: UnaryOperator<TVertex>

      Clone function that takes a vertex and returns a copy of it.

    • Optional edgeDataCloner: UnaryOperator<TEdgeData>

      Clone function that takes an edge datum and returns a copy of it.

    Returns GraphlibAdapter<TVertex, TEdgeData>

    A copy of this graph.

contractEdge

  • contractEdge(from: TVertex, to: TVertex, vertexMerger?: BinaryOperator<TVertex>, edgeMerger?: BinaryOperator<TEdgeData>): boolean
  • Parameters

    • from: TVertex
    • to: TVertex
    • Optional vertexMerger: BinaryOperator<TVertex>
    • Optional edgeMerger: BinaryOperator<TEdgeData>

    Returns boolean

createVertex

deleteEdge

  • deleteEdge(from: TVertex, to: TVertex): boolean

deleteVertex

  • deleteVertex(vertex: TVertex): boolean

getEdgeCount

  • getEdgeCount(): number

getEdgeData

  • getEdgeData(from: TVertex, to: TVertex): TEdgeData

getEdgeDataFrom

  • getEdgeDataFrom(vertex: TVertex): Iterator<TEdgeData>

getEdgeDataTo

  • getEdgeDataTo(vertex: TVertex): Iterator<TEdgeData>

getEdges

  • getEdges(): Iterator<Pair<TVertex>>

getEdgesWithData

  • getEdgesWithData(): Iterator<Triple<TVertex, TVertex, Maybe<TEdgeData>>>

getEdgesWithDataFrom

  • getEdgesWithDataFrom(vertex: TVertex): Iterator<Pair<TVertex, Maybe<TEdgeData>>>
  • Parameters

    • vertex: TVertex

    Returns Iterator<Pair<TVertex, Maybe<TEdgeData>>>

getEdgesWithDataTo

  • getEdgesWithDataTo(vertex: TVertex): Iterator<Pair<TVertex, Maybe<TEdgeData>>>
  • Parameters

    • vertex: TVertex

    Returns Iterator<Pair<TVertex, Maybe<TEdgeData>>>

getOrder

  • getOrder(vertex: TVertex): number

getPredecessorsOf

  • getPredecessorsOf(vertex: TVertex): Iterator<TVertex>

getSuccessorsOf

  • getSuccessorsOf(vertex: TVertex): Iterator<TVertex>

getVertexCount

  • getVertexCount(): number

getVertices

  • getVertices(): Iterator<TVertex>

hasEdge

  • hasEdge(from: TVertex, to: TVertex): boolean

hasVertex

  • hasVertex(vertex: TVertex): boolean

isReachable

  • isReachable(source: TVertex, target: TVertex): boolean

map

  • map<TClonedVertexData, TClonedEdgeData>(vertexDataMapper: TypedFunction<TVertex, PartialFor<TClonedVertexData, keyof GraphlibVertexData>>, edgeDataMapper: TypedFunction<TEdgeData, TClonedEdgeData>): GraphlibAdapter<TClonedVertexData, TClonedEdgeData>
  • Type parameters

    • TClonedVertexData: TVertex

    • TClonedEdgeData

    Parameters

    • vertexDataMapper: TypedFunction<TVertex, PartialFor<TClonedVertexData, keyof GraphlibVertexData>>
    • edgeDataMapper: TypedFunction<TEdgeData, TClonedEdgeData>

    Returns GraphlibAdapter<TClonedVertexData, TClonedEdgeData>

setEdgeData

  • setEdgeData(from: TVertex, to: TVertex, data: TEdgeData): boolean

supportsOrder

  • supportsOrder(): boolean

Static create

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc