Differences between IlvLinkImage and IlvHyperEdge

The classes IlvLinkImage and IlvHyperEdge differ in the following areas:

Orientation

Normal links ( IlvLinkImage ) have a flag that indicates whether they are oriented. If the links are oriented, an arrowhead will be drawn. The orientation flag is necessary because, if an arrowhead were always drawn, then there would be no way of drawing a link between two nodes that did not represent a flow direction.
Hyperedges are always oriented. Therefore, an arrowhead is drawn at the target nodes and this arrowhead cannot be switched off.
This feature is not a restriction. If you want to draw a hyperedge between several nodes without an arrowhead, create a hyperedge that has all these nodes as sources, but has no target node.
You can also create a hyperedge that has only target nodes, but no source node. In this case, an arrowhead is drawn at all end nodes of the hyperedge.
You can see that hyperedges are much more flexible than normal links.
If a hyperedge has exactly one source node and one target node, then it will look like, and behave approximately as, a normal oriented link.
If a hyperedge has exactly two source nodes and zero target nodes, then it will look like a normal unoriented link.

Changing end nodes of a link

To change the end nodes of an IlvLinkImage object, you must remove the IlvLinkImage from the graph. Then you must change the end nodes and reinsert the link into the graph.
Changing the end nodes of an IlvHyperEdge object is more convenient. The end nodes can be changed while the hyperedge remains in the hypergraph. For example, you can add an empty hyperedge with zero end nodes to the hypergraph. Then you can add source and target nodes later. You must encapsulate all operations that change the end nodes of a hyperedge into applyToObject sessions. See Modifying geometric properties of objects in The Essential Features of JViews Framework user documentation for more details.
The operations that can be carried out on IlvHyperEdge are shown in the following table.
Operations on IlvHyperEdge
Operation
Description
setFrom(nodeVector)
Removes all old source nodes from the hyperedge and adds all nodes contained in the input vector as new source nodes of the hyperedge.
setTo(nodeVector)
Removes all old target nodes from the hyperedge and adds all nodes contained in the input vector as new targets of the hyperedge.
addFrom(node)
Adds the input node to the list of source nodes of the hyperedge.
addTo(node)
Adds the input node to the list of target nodes of the hyperedge.
removeFrom(node)
Removes the input node from the list of source nodes of the hyperedge.
removeTo(node)
Removes the input node from the list of target nodes of the hyperedge.
The following code example shows how to create an empty hyperedge, add it to the hypergraph, and then add some source nodes.
Creating an empty hyperedge and adding source nodes
IlvHyperGrapher grapher = new IlvHyperGrapher();
grapher.setMinHyperEdgeEndCount(0);
...
IlvHyperEdge edge = new IlvHyperEdge();
grapher.addHyperEdge(edge, false);
...
grapher.applyToObject(edge,
  new IlvApplyObject() {
    public void apply(IlvGraphic obj, Object arg) {
      ((IlvHyperEdge)obj).addFrom(node1);
      ((IlvHyperEdge)obj).addFrom(node2);
      ((IlvHyperEdge)obj).addFrom(node3);
    }
  }, arg, redraw);