Making sure that hyperedges have a minimum number of ends
In contrast to normal links, hyperedges
can have zero source nodes and zero target nodes. Such an empty
hyperedge can be added to a hypergraph. This feature is generally
useful, since you can decide to add sources and targets later.
An empty hyperedge is invisible and cannot be moved. Its position
is fixed at
(0,0)
.
For many applications a hyperedge with 0
or 1 end only makes no sense, because these hyperedges are
usually invisible.
If hyperedges with fewer than
k
ends are not allowed in your application, you can call the
method:
hypergrapher.setMinHyperEdgeEndCount(k);
As a result, all hyperedges with fewer than the minimum number of
hyperedge ends are removed from the hypergraph. When a new
hyperedge is added to the hypergraph, it must already have the
minimum number of ends. If not, the method
addHyperEdge
will fail with an exception.
When an end is removed from a hyperedge,
the hyperedge is automatically removed from the hypergraph if the
number of remaining ends is smaller than the minimum. By default,
the minimum is 2.
Note
There is the following difference between
IlvHyperEdge
and
IlvLinkImage
:
When a node is removed from a graph or hypergraph, all its
incident links (
IlvLinkImage
) are also always removed from the graph.
All the hyperedges (
IlvHyperEdge
) incident to a node removed from a hypergraph lose only the
ends that point to that node. Hyperedges remain in the
hypergraph unless the number of their remaining ends is smaller
than the minimum.