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); }
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) }
/// <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"); }
public ConceptInstance(ConceptNode node, double strength) { this.node = node; this.strength = strength; }