diff --git a/src/v3/core/graph.js b/src/v3/core/graph.js index a5a4015..89c43c6 100644 --- a/src/v3/core/graph.js +++ b/src/v3/core/graph.js @@ -92,8 +92,20 @@ export function fromEdgeAddress(n: EdgeAddress): string[] { } export class Graph { + _nodes: Set; + // If `e` is an Edge in the graph, then: + // * _edges.get(e.address) `deepEquals` e + // * _inEdges.get(e.dst) `contains` e + // * _outEdges.get(e.src) `contains` e + _edges: Map; + _inEdges: Map; + _outEdges: Map; + constructor(): void { - throw new Error("constructor"); + this._nodes = new Set(); + this._edges = new Map(); + this._inEdges = new Map(); + this._outEdges = new Map(); } addNode(a: NodeAddress): this { diff --git a/src/v3/core/graph.test.js b/src/v3/core/graph.test.js index aba9d53..1c2d376 100644 --- a/src/v3/core/graph.test.js +++ b/src/v3/core/graph.test.js @@ -5,6 +5,7 @@ import { fromNodeAddress, toEdgeAddress, fromEdgeAddress, + Graph, } from "./graph"; describe("core/graph", () => { @@ -107,4 +108,13 @@ describe("core/graph", () => { expect(toEdgeAddress(["foo"])).not.toEqual(toNodeAddress(["foo"])); }); }); + + describe("Graph class", () => { + it("can be constructed", () => { + const x = new Graph(); + // Verify that `x` is not of type `any` + // $ExpectFlowError + expect(() => x.measureSpectacularity()).toThrow(); + }); + }); });