This is a demonstration of the activeFiltering option in the Surface widget.
When activeFiltering is set and a beforeConnect function is supplied to the Toolkit's constructor, that function is called before a new connection is dragged, for every possible target for the current source. Whenever it returns false, the corresponding target object (a Node or a Port) is disabled, and the user will not be able to drop the connection onto it.
Each Node contains a set of entries which each contain the name of two types of animal. Entries are deemed connectable if one or more animals from the source entry are matched in a given target.