Example #1
0
 public ConceptLink(ConceptNode node1, ConceptNode node2, ConceptLinkType linkType, int strength, int elasticity)
 {
     this.nodeA      = node1;
     this.nodeB      = node2;
     this.strength   = strength;
     this.elasticity = elasticity;
     opposite        = (linkType == ConceptLinkType.Opposite);
 }
Example #2
0
        public void SpreadActivation(ConceptNode src, float amount)
        {
            ConceptNode dest = GetDestinationNode(src);

            int opp = (opposite) ? -1 : 1;                                     // multiple activation by -1 if it's an opposite link

            dest.IncreaseIncomingActivation(opp * amount * strength / 100.0f); // Strength = 100-distance (in Melanie's terms)
        }
Example #3
0
 /// <summary>
 /// Finds the other end of the link, given one end node.
 /// </summary>
 /// <param name="src"></param>
 /// <returns></returns>
 public ConceptNode GetDestinationNode(ConceptNode src)
 {
     if (nodeA == src)
     {
         return(nodeB);
     }
     if (nodeB == src)
     {
         return(nodeA);
     }
     throw new ArgumentException("Src node not part of the link");
 }
Example #4
0
 public ConceptInstance(ConceptNode node, double strength)
 {
     this.node     = node;
     this.strength = strength;
 }