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

Function createGraph

packages/y-graph-storage/src/YGraphStorage.test.ts:32–48  ·  view source on GitHub ↗
(doc = new Y.Doc())

Source from the content-addressed store, hash-verified

30interface DemoSchema extends _DemoSchema {}
31
32function createGraph(doc = new Y.Doc()) {
33 const graph = new YGraph<DemoSchema>({
34 schema,
35 doc,
36 });
37
38 const alice = graph.addVertex("Person", { name: new Y.Text("Alice") });
39
40 const raspberries = graph.addVertex("Thing", {
41 name: new Y.Text("Raspberries"),
42 isActive: true,
43 features: Y.Array.from<Y.Text>([new Y.Text("sweet"), new Y.Text("juicy")]),
44 });
45
46 graph.addEdge(alice, "likes", raspberries, {});
47 return graph;
48}
49
50test("YGraphStorage", () => {
51 const graph = createGraph();

Callers 1

Calls 2

addVertexMethod · 0.65
addEdgeMethod · 0.65

Tested by

no test coverage detected