Class: GraphologyDataAdapter
Defined in: lang-cypher/src/language/graphology-adapter.ts:63
A data adapter for the Graphology graph library. The node labels/edge types are expected to be stored
in the attributes using the gaLabelsOrType symbol key. Convenience functions are provided to serialize
and deserialize the graph to/from a format that can be stored (since symbols are not generally serializable).
Implements
Constructors
Constructor
new GraphologyDataAdapter():
GraphologyDataAdapter
Returns
GraphologyDataAdapter
Methods
convertEdge()
protectedconvertEdge(edge,attrs):GraphologyEdge
Defined in: lang-cypher/src/language/graphology-adapter.ts:74
Stamps the Graphology string key onto attrs as gaNodeOrEdgeId and returns the cast result.
Parameters
| Parameter | Type |
|---|---|
edge | string |
attrs | Attributes & Record<string | symbol, unknown> |
Returns
convertNode()
protectedconvertNode(node,attrs):GraphologyNode
Defined in: lang-cypher/src/language/graphology-adapter.ts:65
Stamps the Graphology string key onto attrs as gaNodeOrEdgeId and returns the cast result.
Parameters
| Parameter | Type |
|---|---|
node | string |
attrs | Attributes & Record<string | symbol, unknown> |
Returns
filterEdges()
filterEdges(
graph,predicate?):Iterable<GraphologyEdge>
Defined in: lang-cypher/src/language/graphology-adapter.ts:118
Filter edges in the graph.
Parameters
| Parameter | Type | Description |
|---|---|---|
graph | GraphologyGraph | The graph to query. |
predicate? | (src, tgt, edge) => boolean | A function to test each edge. |
Returns
Iterable<GraphologyEdge>
Implementation of
filterNodeEdges()
filterNodeEdges(
graph,node,direction,predicate?):Iterable<GraphologyEdge>
Defined in: lang-cypher/src/language/graphology-adapter.ts:159
Filter edges connected to a specific node.
Parameters
| Parameter | Type | Description |
|---|---|---|
graph | GraphologyGraph | The graph to query. |
node | GraphologyNode | The node to get edges for. |
direction | EdgeDirection | The direction to filter by. |
predicate? | (src, tgt, edge) => boolean | A function to test each edge. |
Returns
Iterable<GraphologyEdge>
Implementation of
CypherDataAdapter.filterNodeEdges
filterNodes()
filterNodes(
graph,predicate?):Iterable<GraphologyNode>
Defined in: lang-cypher/src/language/graphology-adapter.ts:93
Filter nodes in the graph.
Parameters
| Parameter | Type | Description |
|---|---|---|
graph | GraphologyGraph | The graph to query. |
predicate? | (node) => boolean | A function to test each node. |
Returns
Iterable<GraphologyNode>
Implementation of
getEdgeNode()
getEdgeNode(
graph,edge,type):GraphologyNode
Defined in: lang-cypher/src/language/graphology-adapter.ts:226
Get the node connected to a specific edge.
Parameters
| Parameter | Type | Description |
|---|---|---|
graph | GraphologyGraph | The graph to query. |
edge | GraphologyEdge | The edge to get the node for. |
type | "source" | "target" | The type of the node to get (source or target). |
Returns
Implementation of
getEdgesByType()
getEdgesByType(
graph,type):Iterable<GraphologyEdge>
Defined in: lang-cypher/src/language/graphology-adapter.ts:108
Get edges by their type.
Parameters
| Parameter | Type | Description |
|---|---|---|
graph | GraphologyGraph | The graph to query. |
type | string | The type to filter by. |
Returns
Iterable<GraphologyEdge>
Implementation of
CypherDataAdapter.getEdgesByType
getLabels()
getLabels(
graph,node):string[]
Defined in: lang-cypher/src/language/graphology-adapter.ts:211
Return the labels of a node.
Parameters
| Parameter | Type | Description |
|---|---|---|
graph | GraphologyGraph | The graph to query. |
node | GraphologyNode | The node to check. |
Returns
string[]
Implementation of
getNodeEdgesByType()
getNodeEdgesByType(
graph,node,type,direction):Iterable<GraphologyEdge>
Defined in: lang-cypher/src/language/graphology-adapter.ts:141
Get edges connected to a specific node by their type and direction.
Parameters
| Parameter | Type | Description |
|---|---|---|
graph | GraphologyGraph | The graph to query. |
node | GraphologyNode | The node to get edges for. |
type | string | The type to filter by. |
direction | EdgeDirection | The direction to filter by. |
Returns
Iterable<GraphologyEdge>
Implementation of
CypherDataAdapter.getNodeEdgesByType
getNodesByLabels()
getNodesByLabels(
graph, ...labels):Iterable<GraphologyNode>
Defined in: lang-cypher/src/language/graphology-adapter.ts:82
Get nodes by their labels.
Parameters
| Parameter | Type | Description |
|---|---|---|
graph | GraphologyGraph | The graph to query. |
...labels | string[] | The labels to filter by. |
Returns
Iterable<GraphologyNode>
Implementation of
CypherDataAdapter.getNodesByLabels
getType()
getType(
graph,edge):string
Defined in: lang-cypher/src/language/graphology-adapter.ts:222
Return the type of an edge.
Parameters
| Parameter | Type | Description |
|---|---|---|
graph | GraphologyGraph | The graph to query. |
edge | GraphologyEdge | The edge to check. |
Returns
string
Implementation of
hasAnyType()
hasAnyType(
graph,edge,types):boolean
Defined in: lang-cypher/src/language/graphology-adapter.ts:215
Check if an edge has any of the specified types.
Parameters
| Parameter | Type | Description |
|---|---|---|
graph | GraphologyGraph | The graph to query. |
edge | GraphologyEdge | The edge to check. |
types | string[] | The types to check for. |
Returns
boolean
Implementation of
hasLabels()
hasLabels(
graph,node,labels):boolean
Defined in: lang-cypher/src/language/graphology-adapter.ts:204
Check if a node has all of the specified labels.
Parameters
| Parameter | Type | Description |
|---|---|---|
graph | GraphologyGraph | The graph to query. |
node | GraphologyNode | The node to check. |
labels | string[] | The labels to check for. |
Returns
boolean
Implementation of
isConnected()
isConnected(
graph,node,edge,direction):boolean
Defined in: lang-cypher/src/language/graphology-adapter.ts:189
Check if a node is connected to a specific edge.
Parameters
| Parameter | Type | Description |
|---|---|---|
graph | GraphologyGraph | The graph to query. |
node | GraphologyNode | The node to check. |
edge | GraphologyEdge | The edge to check. |
direction | EdgeDirection | The direction to check. |
Returns
boolean
Implementation of
export()
staticexport(graph):unknown
Defined in: lang-cypher/src/language/graphology-adapter.ts:256
Exports the Graphology graph to a serialized format.
Parameters
| Parameter | Type |
|---|---|
graph | GraphologyGraph |
Returns
unknown
import()
staticimport(serialized):GraphologyGraph
Defined in: lang-cypher/src/language/graphology-adapter.ts:238
Imports a serialized Graphology graph.
Parameters
| Parameter | Type |
|---|---|
serialized | unknown |