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

Method constructor

packages/graph/src/GraphStorage.ts:137–153  ·  view source on GitHub ↗
(data?: { vertices: StoredVertex[]; edges: StoredEdge[] })

Source from the content-addressed store, hash-verified

135 #outgoingEdges: Map<ElementId, StoredEdge[]>;
136
137 public constructor(data?: { vertices: StoredVertex[]; edges: StoredEdge[] }) {
138 const vertices: Map<ElementId, StoredVertex> = new Map();
139 const edges: Map<ElementId, StoredEdge> = new Map();
140
141 this.#vertices = vertices;
142 this.#edges = edges;
143 this.#incomingEdges = new Map();
144 this.#outgoingEdges = new Map();
145 if (data != null) {
146 for (const vertex of data.vertices) {
147 this.addVertex(vertex);
148 }
149 for (const edge of data.edges) {
150 this.addEdge(edge);
151 }
152 }
153 }
154
155 protected get vertices(): Map<ElementId, StoredVertex> {
156 return this.#vertices;

Callers

nothing calls this directly

Calls 2

addVertexMethod · 0.95
addEdgeMethod · 0.95

Tested by

no test coverage detected