OrderedLink and UnorderedLink

From OpenCog
(Redirected from OrderedLink)
Jump to: navigation, search

UnorderedLink and OrderedLink are two fairly basic Link types. In general, users are discouraged from using these two link types directly, and instead should use some other more refined type that fits their needs better. Most link types inherit from either one or the other. Examples of UnorderedLinks include the AndLink, OrLink and SetLink.

True to their name, these link types imply that their outgoing set is maintained in order, or treated as being unordered. This is respected by the various algorithms that handle these link types, and in particular the pattern matcher, as well as for the alpha-conversion of UnorderedLinks containing VariableNodes.

In some cases, the use of the UnorderedLink can have negative performance implications. This is particularly true when using a pattern search that has variables in an UnorderedLink. To perform the pattern match, this requires examining all possible permutations of the contents; this can take n-factorial steps, depending on the precise structure. On the other hand, if one intentionally wants to examine all possible permutations, the UnorderedLink provides an easy and convenient way of doing so.