| 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; |