We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 526355c commit 7d3ae60Copy full SHA for 7d3ae60
docs/graph.js
@@ -16,7 +16,13 @@ export class Graph {
16
return this.nodes.length-1;
17
}
18
19
+ addUniqNode(type, props={}) {
20
+ const nid = this.nodes.findIndex(node => node.type == type && node.props?.name == props?.name)
21
+ return nid >= 0 ? nid : this.addNode(type, props)
22
+ }
23
+
24
addRel(type, from, to, props={}) {
25
+ if (from == null || to == null) return null
26
const obj = {type, from, to, props};
27
this.rels.push(obj);
28
const rid = this.rels.length-1;
0 commit comments