()
| 39 | type WeightedEdgeSchema = typeof weightedEdgeSchema; |
| 40 | |
| 41 | function createWeightedEdgeGraph() { |
| 42 | const graph = new Graph<WeightedEdgeSchema>({ |
| 43 | schema: weightedEdgeSchema, |
| 44 | storage: new InMemoryGraphStorage(), |
| 45 | validateProperties: false, |
| 46 | }); |
| 47 | |
| 48 | const ann = graph.addVertex("Person", { name: "Ann" }); |
| 49 | const ben = graph.addVertex("Person", { name: "Ben" }); |
| 50 | const cam = graph.addVertex("Person", { name: "Cam" }); |
| 51 | |
| 52 | graph.addEdge(ann, "knows", ben, { strength: 2, note: "peer" }); |
| 53 | graph.addEdge(ann, "knows", cam, { strength: 1, note: "mentor" }); |
| 54 | graph.addEdge(ben, "knows", cam, { strength: 3, note: "teammate" }); |
| 55 | |
| 56 | return new GraphTraversal(graph); |
| 57 | } |
| 58 | |
| 59 | const { graph, alice, bob } = createDemoGraph(); |
| 60 | const g = new GraphTraversal(graph); |
no test coverage detected