Vertex | Matterport SDK
Usage of the SDK constitutes your agreement with the Matterport SDK Agreement. Email developers@matterport.com with any questions.

A node in the graph.

Type parameters

  • T

Hierarchy

  • Vertex

Index

Properties

Readonly data

data: T

User data associated with the vertex.

Readonly edgesIn

edgesIn: IterableIterator<Graph.Edge<T>>

An iterable of all edges that have this vertex as its destination endpoint.

const vertex = graph.vertex('a');
for (const edgeIn of vertex.edgesIn) {
  console.log(`vertex "${edgeIn.dst.id}" has an edge coming in from a vertex "${edgeIn.src.id}"`);
}

Readonly edgesInCount

edgesInCount: number

The nubmer of edges that have this vertex as its destination endpoint.

const vertex = graph.vertex('a');
console.log(`vertex "${vertex.id}" has ${vertex.edgesInCount} edges out");

Readonly edgesOut

edgesOut: IterableIterator<Graph.Edge<T>>

An iterable of all edges that have this vertex as its source endpoint.

const vertex = graph.vertex('a');
for (const edgeOut of vertex.edgesOut) {
  console.log(`vertex "${edgeOut.src.id}" has an edge going to a vertex "${edgeOut.dst.id}"`);
}

Readonly edgesOutCount

edgesOutCount: number

The nubmer of edges that have this vertex as its source endpoint.

const vertex = graph.vertex('a');
console.log(`vertex "${vertex.id}" has ${vertex.edgeOutCount} edges out");

Readonly id

id: string

The vertex's id.

Readonly neighbors

neighbors: IterableIterator<Graph.Vertex<T>>

An iterable of all vertices that can be traversed to from this vertex.

const vertex = graph.vertex('a');
for (const neighbor of vertex.neighbors) {
  console.log(`vertex "${vertex.id}" shares an edge with "${neighbor.id}");
}

Methods

findEdgeIn

  • findEdgeIn(predicate: function, thisArg?: any): Graph.Edge<T> | undefined
  • Find an edge into this vertex.

    const vertex = graph.vertex('a');
    // find an edge into 'a' and out from 'b'
    vertex.findEdgeIn(edge => edge.src.id === 'b');
    

    Parameters

    • predicate: function

      The callback to run against each inward edge until one is found (by returning true.)

    • Optional thisArg: any

      The "this" argument to use in predicate

    Returns Graph.Edge<T> | undefined

findEdgeOut

  • findEdgeOut(predicate: function, thisArg?: any): Graph.Edge<T> | undefined
  • Find an edge out of this vertex.

    const vertex = graph.vertex('a');
    // find an edge out from 'a' and into 'b'
    vertex.findEdgeIn(edge => edge.src.id === 'b');
    

    Parameters

    • predicate: function

      The callback to run against each outward edge until one is found (by returning true.)

    • Optional thisArg: any

      The "this" argument to use in predicate

    Returns Graph.Edge<T> | undefined