traffic-traversal
Version:
Calculate the weights between each vertex node and help you find the fastest route.
28 lines (27 loc) • 1.21 kB
TypeScript
import type { ITrafficGraphState } from '../TrafficGraph';
export declare class VertexEncoder {
private readonly _trafficGraph;
private readonly _cNumbers;
private readonly _cRecordNumber;
private readonly _cRecordNumbers;
static Create(...args: ConstructorParameters<typeof VertexEncoder>): VertexEncoder;
/**
* Create an instance to get the encoder utility functions from the graph. It takes a `graph.state` instance as a parameter.
* @param trafficGraphState
*/
constructor(trafficGraphState: ITrafficGraphState);
/**
* Exports a zero vector with all elements zero. The length of the vector is equal to the number of vertices in use in the graph.
* This is good for use with the `oneHot` method.
*/
zeroHot(): number[];
/**
* Convert each vertex to a one-hot vector and export it. The length of each vector is equal to the number of all vertices used in the graph.
*/
oneHot(): Record<string, number[]>;
/**
* Convert each vertex to a label integer and export it.
* @param startFrom The starting value of the label integer. The default is `0`.
*/
label(startFrom?: number): Record<string, number>;
}