March 2019
Intermediate to advanced
336 pages
9h 9m
English
The AddLink method of the KnowledgeGraph class takes class1 and class2 as parameters, and a link is created between these classes:
// Add Linkfunc (knowledgeGraph *KnowledgeGraph) AddLink(class1 Class, class2 Class) { var exists bool if _, exists = knowledgeGraph.GraphNodes[class1]; !exists { knowledgeGraph.AddClass(class1) } if _, exists = knowledgeGraph.GraphNodes[class2]; !exists { knowledgeGraph.AddClass(class2) } if _, exists = knowledgeGraph.Links[class1]; !exists { knowledgeGraph.Links[class1] = make(map[Class]struct{}) } knowledgeGraph.Links[class1][class2] = struct{}{}}
Read now
Unlock full access