Options
All
  • Public
  • Public/Protected
  • All
Menu

Common methods implemented by the provided GraphAdapters.

Type parameters

  • TVertex

  • TEdgeData

Hierarchy

  • CommonAdapter

Implemented by

Index

Methods

addEdge

  • addEdge(from: TVertex, to: TVertex, data?: TEdgeData): boolean
  • Adds the given edge, if it does not exist, and it is allowed. May not be allowed eg if adding the edge creates a cycle.

    Parameters

    • from: TVertex

      Source vertex of the edge.

    • to: TVertex

      Target vertex of the edge.

    • Optional data: TEdgeData

    Returns boolean

    true iff the edge was added.

addVertex

  • addVertex(vertex: TVertex): boolean
  • Adds the given vertex, if it does not exist, and it is allowed.

    Parameters

    • vertex: TVertex

      Vertex to be added.

    Returns boolean

    true iff the vertex was added.

canAddEdge

  • canAddEdge(from: TVertex, to: TVertex): boolean
  • Checks whether adding the edge would add a cycle.

    Parameters

    • from: TVertex

      Source vertex of the edge.

    • to: TVertex

      Target vertex of the edge.

    Returns boolean

    true iff the edge can be added without introducing a cycle.

canContractEdge

  • canContractEdge(from: TVertex, to: TVertex): boolean
  • Checks whether the edge can be contracted without creating a cycle.

    Parameters

    • from: TVertex

      Source vertex of the edge.

    • to: TVertex

      Target vertex of the edge.

    Returns boolean

    true iff the edge can be contracted without introducing a cycle.

contractEdge

  • contractEdge(from: TVertex, to: TVertex, vertexMerger?: BinaryOperator<TVertex>, dataMerger?: BinaryOperator<TEdgeData>): boolean
  • Contracts the given edge, ie. delete the vertex to and all edges between from and to, and moves all remaining edges of to to from.

    throws

    If vertex merger returns a vertex that is already contained in the graph.

    Parameters

    • from: TVertex

      Source vertex of the edge.

    • to: TVertex

      Target vertex of the edge.

    • Optional vertexMerger: BinaryOperator<TVertex>

      The vertex that replaces the two old vertices. If not given, defaults to from.

    • Optional dataMerger: BinaryOperator<TEdgeData>

      Another vertex may be connected two both of the vertices that are to be contracted. In this case, their edge data needs to be merged. If not given, defaults to taking the edge data from one edge.

    Returns boolean

    true iff the edge was contracted.

deleteEdge

  • deleteEdge(from: TVertex, to: TVertex): boolean
  • Delete the given edge, if it exists and it is allowed.

    Parameters

    • from: TVertex

      Source vertex of the edge.

    • to: TVertex

      Target vertex of the edge.

    Returns boolean

    true iff the edge was deleted.

deleteVertex

  • deleteVertex(vertex: TVertex): boolean
  • Deletes the given vertex, if it does exist, and it is allowed.

    Parameters

    • vertex: TVertex

      Vertex to be deleted.

    Returns boolean

    true iff the vertex was deleted.

getEdgeCount

  • getEdgeCount(): number
  • Returns number

    The number of vertices in this graph.

getEdgeData

  • getEdgeData(from: TVertex, to: TVertex): Maybe<TEdgeData>
  • Parameters

    • from: TVertex

      Source vertex of the edge.

    • to: TVertex

      Target vertex of the edge.

    Returns Maybe<TEdgeData>

    The data associated with the given edge.

getEdgeDataFrom

  • getEdgeDataFrom(vertex: TVertex): Iterator<TEdgeData>
  • Returns the edge data of all edges that point from (start at) the given vertex.

    Parameters

    • vertex: TVertex

      Vertex where the edge starts.

    Returns Iterator<TEdgeData>

    Edge data for the edges (vertex, *)

getEdgeDataTo

  • getEdgeDataTo(vertex: TVertex): Iterator<TEdgeData>
  • Returns the edge data of all edges that point to (end at) the given vertex.

    Parameters

    • vertex: TVertex

      Vertex where the edge ends.

    Returns Iterator<TEdgeData>

    Edge data for the edges (*, vertex)

getEdges

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

    All edges in this graph.

getEdgesWithData

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

    All edges with their data in this graph.

getEdgesWithDataFrom

  • getEdgesWithDataFrom(vertex: TVertex): Iterator<Pair<TVertex, Maybe<TEdgeData>>>
  • Returns the predecessor with the edge data of all edges that point from (start at) the given vertex.

    Parameters

    • vertex: TVertex

      Vertex where the edge starts.

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

    Predecessors and edge data for the edges (vertex, *)

getEdgesWithDataTo

  • getEdgesWithDataTo(vertex: TVertex): Iterator<Pair<TVertex, Maybe<TEdgeData>>>
  • Returns the successors with the edge data of all edges that point to (end at) the given vertex.

    Parameters

    • vertex: TVertex

      Vertex where the edge ends.

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

    Successors and edge data for the edges (*, vertex)

getOrder

  • getOrder(vertex: TVertex): number
  • Returns the topological order of the vertex, if supported.

    Parameters

    • vertex: TVertex

      Vertex for which to determine its order.

    Returns number

    The topological order of the given vertex.

getPredecessorsOf

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

    • vertex: TVertex

      The vertex whose predecessors are to be found.

    Returns Iterator<TVertex>

    All immediate predecessors of the given vertex. None if the vertex does not exist.

getSuccessorsOf

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

    • vertex: TVertex

      The vertex whose successors are to be found.

    Returns Iterator<TVertex>

    All immediate successors of the given vertex. None if the vertex does not exist.

getVertexCount

  • getVertexCount(): number
  • Returns number

    The number of vertices in this graph.

getVertices

  • getVertices(): Iterator<TVertex>
  • Returns Iterator<TVertex>

    All vertices in this graph.

hasEdge

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

    • from: TVertex

      Source vertex of the edge.

    • to: TVertex

      Target vertex of the edge.

    Returns boolean

    true iff this graph contains the given edge.

hasVertex

  • hasVertex(vertex: TVertex): boolean
  • Parameters

    • vertex: TVertex

    Returns boolean

    true iff this graph contains the given vertex.

isReachable

  • isReachable(source: TVertex, target: TVertex): boolean
  • Checks whether the target vertex can be reached from the source vertex.

    Parameters

    • source: TVertex

      Source vertex for the search.

    • target: TVertex

      Target vertex for the search.

    Returns boolean

    true iff the target vertex can be reached from the source vertex, ie. iff there is a path from source to target.

setEdgeData

  • setEdgeData(from: TVertex, to: TVertex, data: Maybe<TEdgeData>): boolean
  • Parameters

    • from: TVertex

      Source vertex of the edge.

    • to: TVertex

      Target vertex of the edge.

    • data: Maybe<TEdgeData>

      The data to be associated with the given edge.

    Returns boolean

    true iff the data was set, false iff the edge does not exist.

supportsOrder

  • supportsOrder(): boolean
  • Returns boolean

    true iff the algorithm in use supports querying a vertex's topological order.

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