Skip to main content

Graph.ICollectionAdaptor

An adaptor for an observable collection to automatically generate and update a graph. Used in IDirectedGraph.watch.

Observables

collection

collection: IObservableMap<T>

A observable collection from the sdk, e.g. mpSdk.Sweep.data.

Methods

isNeighborOf

isNeighborOf(src: Graph.Vertex<T>, dst: Graph.Vertex<T>): boolean

Determines whether or not an item from the collection should be considered a neighbor of another item.

ParameterType
srcGraph.Vertex<T>
A vertex containing the source item
dstGraph.Vertex<T>
A vertex containing the destination item

Returns: boolean

neighborsOf

neighborsOf(item: Graph.Vertex<T>): IterableIterator<string>

Get a list of ids for other vertices that should be considered neighbors to an item in the collection.

ParameterType
itemGraph.Vertex<T>
a vertex to find neighbors for

Returns: IterableIterator<string>

shouldAdd

shouldAdd(item: T): boolean

Determines whether or not an item from the collection will be added as a graph vertex.

ParameterType
itemT
the collection item to evaluate

Returns: boolean

weightBetween

weightBetween(src: Graph.Vertex<T>, dst: Graph.Vertex<T>): number

Get the weight between two items in the collection to use as the connecting edges weight.

ParameterType
srcGraph.Vertex<T>
the source vertex
dstGraph.Vertex<T>
the destination vertex

Returns: number