Hyperedge ends

Normal links ( IlvLinkImage) can be incident to one node at most twice: if the link is a self-loop, that is, if the source and target of the link is the same node, then the link will occur in the list of incident links at the node twice. Both ends of the link are easily distinguishable, because one is the source end and the other is the target end.
Not only can a hyperedge ( IlvHyperEdge) have multiple end nodes, but it can also have multiple ends at the same node. Therefore this link is incident to the node multiple times. For example, if you call addFrom multiple times for the same node at the same hyperedge, this hyperedge will have multiple source ends at that node. See the following figure.
multifrom.gif
Multiple ends at the same node
How can you distinguish the different ends of the hyperedge at the node?
The interface IlvHyperEdgeEnd serves as the end indicator of a hyperedge. Instances of this interface are called the hyperedge ends. The default implementation is IlvDefaultHyperEdgeEnd.
The hyperedge ends technically belong to the hyperedge and not to the node. They point to the end node.
If a source or target node is added to the hyperedge, a new hyperedge end is created internally and connects the hyperedge to the node. If the hyperedge is removed from the hypergraph, all ends of the hyperedge will also be removed.
If a hyperedge connects to one node multiple times, there will be multiple different instances of IlvHyperEdgeEnd stored in the hyperedge. All these instances point to the node. The hyperedge ends can be distinguished from each other, even though the corresponding end node is the same.
The following table shows methods included in the API of IlvHyperEdgeEnd .
Methods of IlvHyperEdgeEnd
Method
Description
Returns the hyperedge that contains the specified end.
Returns the node that is connected to the hyperedge by the end.
Returns the position of the end. The input transformer indicates the coordinate system (untransformed manager coordinates or transformed view coordinates if t is the transformer for drawing the hyperedge). Usually, you should pass the value true for the flag.
Sets the position of the end.
The following table shows the API of IlvHyperEdge in more detail. It explains how the operations influence the hyperedge ends and which additional API exists for manipulating the hyperedge ends directly at the hyperedge.
Methods of IlvHyperEdge
API
Description
Creates a new hyperedge end that points to the input node. The hyperedge end is stored as source in the hyperedge. Finally, the hyperedge end is returned, so that you can use it to set the precise position of the hyperedge end. Note that this modifies the geometry of the hyperedge and therefore must be encapsulated in an applyToObject session.
Creates a new hyperedge end that points to the input node. The hyperedge end is stored as target in the hyperedge. Finally, the hyperedge end is returned, so that you can use it to set the precise position of the hyperedge end. Note that this modifies the geometry of the hyperedge and therefore must be encapsulated in an applyToObject session.
Collects all source hyperedge ends that point to the input node. These ends are removed from the sources of the hyperedge.
Collects all target hyperedge ends that point to the input node. These ends are removed from the targets of the hyperedge.
Removes one source hyperedge end. Other hyperedge ends are not affected, even if they point to the same node.
Removes one target hyperedge end. Other hyperedge ends are not affected, even if they point to the same node.
Returns the source nodes of the hyperedge. Each node occurs at the most once in the enumeration, even if multiple hyperedge ends point to this node.
Returns the target nodes of the hyperedge. Each node occurs at the most once in the enumeration, even if multiple hyperedge ends point to this node.
Returns the number of source nodes of the hyperedge.
Returns the number of target nodes of the hyperedge.
Returns the source hyperedge ends.
Returns the target hyperedge ends.
Returns the number of source hyperedge ends.
Returns the number of target hyperedge ends.
As a general rule, when the end nodes are retrieved or counted, a node occurs once only, even if there are multiple ends at a node. When the ends are retrieved or counted, multiple ends that point to the same node occur as distinguishable items. Therefore, the following equation is true:
edge.getFromCount() <= edge.getFromEndsCount()
edge.getToCount() <= edge.getToEndsCount()
Important
You should never remove source nodes or source ends while iterating over the objects returned by getFrom() or getFromEnds() .
You should never remove target nodes or target ends while iterating over the objects returned by getTo() or getToEnds() .
The class IlvHyperEdge has other useful API, such as API for retrieving the ends or end nodes in an array, which is convenient if you need to remove the ends, or for checking whether a given end is source or target. See the reference documentation of IlvHyperEdge for details.