Returns an instance of SimilarityGraph.
| Name | Type | Default | Description |
|---|---|---|---|
| nodeValues | Array<NodeValue> |
- | Required. The array of objects to generate the nodes of the graph. |
| keyExtractor | (nodeValue: NodeValue) => string |
- | Required. The function to generate a key for each node. |
Returns the size of the graph.
Returns an iterator that contains the keys of the graph.
Returns an iterator that contains the values of the graph.
Returns a node of the graph.
| Name | Type | Default | Description |
|---|---|---|---|
| nodeKey | string |
- | Required. The key of the node to return from the graph. |
Returns a copy of the original graph.
Returns a subgraph of the original graph.
| Name | Type | Default | Description |
|---|---|---|---|
| nodeKeys | Array<string> |
- | Required. The array of keys of the nodes to add to the object subgraph. |
Adds a node to the graph.
| Name | Type | Default | Description |
|---|---|---|---|
| nodeValue | NodeValue |
- | Required. The value of the node to add to the graph. |
Returns a copy of the original graph with a received node added.
| Name | Type | Default | Description |
|---|---|---|---|
| nodeValue | NodeValue |
- | Required. The value of the node to add to the graph. |
Updates a node in the graph.
| Name | Type | Default | Description |
|---|---|---|---|
| nodeValue | NodeValue |
- | Required. The value of the node to update in the graph. |
Returns a copy of the original graph with a received node updated.
| Name | Type | Default | Description |
|---|---|---|---|
| nodeValue | NodeValue |
- | Required. The value of the node to update in the graph. |
Removes a node from the graph.
| Name | Type | Default | Description |
|---|---|---|---|
| nodeKey | string |
- | Required. The key of the node to remove from the graph. |
Returns a copy of the original graph with a received node removed.
| Name | Type | Default | Description |
|---|---|---|---|
| nodeKey | string |
- | Required. The key of the node to remove from the graph. |
Returns a list of unique values for a specified property across selected nodes in the graph. If no selection is made, it operates on the entire graph.
| Name | Type | Default | Description |
|---|---|---|---|
| propertyKey | keyof NodeValue |
- | Required. The property key of the node values to return from the graph. |
| nodeKeys | Array<string> |
- | The array of nodes keys to define the selected nodes. |
Returns all values grouped by property.
Returns all nodes that match with the provided shape.
| Name | Type | Default | Description |
|---|---|---|---|
| shape | Partial<Record<keyof NodeValue, unknown>> |
- | Required. The shape of the nodes to return from the graph. |