MCPcopy Create free account
hub / github.com/codemix/graph / GraphSource

Interface GraphSource

packages/graph/src/Graph.ts:110–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108const customInspectSymbol = Symbol.for("nodejs.util.inspect.custom");
109
110export interface GraphSource<TSchema extends GraphSchema> {
111 /**
112 * The schema of the graph.
113 */
114 readonly schema: TSchema;
115
116 /**
117 * The index manager for query optimization.
118 * Optional - sources that don't support indexing can return undefined.
119 */
120 readonly indexManager?: IndexManager<TSchema>;
121
122 /**
123 * Get all incoming edges of a vertex.
124 * @param vertexId The id of the vertex.
125 */
126 getIncomingEdges(vertexId: ElementId): Iterable<Edge<TSchema, any>>;
127
128 /**
129 * Get all outgoing edges of a vertex.
130 * @param vertexId The id of the vertex.
131 */
132 getOutgoingEdges(vertexId: ElementId): Iterable<Edge<TSchema, any>>;
133
134 /**
135 * Get a specific vertex by its unique identifier.
136 * @param id The id of the vertex.
137 * @param options.throwIfNotFound If true, throws VertexNotFoundError instead of returning undefined.
138 */
139 getVertexById<TVertexLabel extends VertexLabel<TSchema>>(
140 id: ElementId,
141 options: { throwIfNotFound: true },
142 ): Vertex<TSchema, TVertexLabel>;
143 getVertexById<TVertexLabel extends VertexLabel<TSchema>>(
144 id: ElementId,
145 options?: { throwIfNotFound?: false },
146 ): Vertex<TSchema, TVertexLabel> | undefined;
147
148 /**
149 * Get all vertices, optionally filtered by labels.
150 * @param labels The labels to filter by.
151 */
152 getVertices<TVertexLabel extends VertexLabel<TSchema>>(
153 ...labels: TVertexLabel[]
154 ): Iterable<Vertex<TSchema, TVertexLabel>>;
155
156 /**
157 * Get a specific edge by its unique identifier.
158 * @param id The id of the edge.
159 * @param options.throwIfNotFound If true, throws EdgeNotFoundError instead of returning undefined.
160 */
161 getEdgeById<TEdgeLabel extends EdgeLabel<TSchema>>(
162 id: ElementId,
163 options: { throwIfNotFound: true },
164 ): Edge<TSchema, TEdgeLabel>;
165 getEdgeById<TEdgeLabel extends EdgeLabel<TSchema>>(
166 id: ElementId,
167 options?: { throwIfNotFound?: false },

Callers 47

traverseMethod · 0.65
traverseMethod · 0.65
getNeighborsMethod · 0.65
traverseMethod · 0.65
getIncomingEdgesMethod · 0.65
Graph.test.tsFile · 0.65
traverseMethod · 0.65
traverseMethod · 0.65
getNeighborsMethod · 0.65
traverseMethod · 0.65
traverseMethod · 0.65

Implementers 4

EmptyGraphSourcepackages/graph/src/Graph.ts
Graphpackages/graph/src/Graph.ts
InMemoryGraphStoragepackages/graph/src/GraphStorage.ts
YGraphStoragepackages/y-graph-storage/src/YGraphSto

Calls

no outgoing calls

Tested by

no test coverage detected