Perforce JViews Diagrammer Sample: Hypergraph
Description
This sample shows how to create and use a hypergrapher with hyperedges. Hyperedges can connect multiple nodes and occur in many applications, for example, in electric signal diagrams where each signal has one sender (source), but multiple receivers (sinks).
How to Use the Sample
- This sample illustrates how to use the hypergraph data structures. It displays a hypergrapher in a manager view. Various interactors are available from the tool bar that allow you to create nodes and hyperedges.
- Allows you to change the area that is visible in the view.
- Allows you to select objects. When a hyperedge is selected, you can move its ends, connect the ends to other nodes, or remove the end (by holding Shift+Control when you click the end.)
- Allows you to zoom to a rectangular area.
- Increases the zoom level.
- Decreases the zoom level.
- Changes the zoom level so that the entire hypergraph is visible.
- Allows you to create rectangular nodes by clicking in the view.
- Allows you to create circle nodes by clicking in the view.
- Allows you to create star nodes by clicking in the view.
- Allows you to create subgraphs by clicking in the view. When the subgraph is resized, the margins of the subgraph change, but the zoom level does not change.
- Allows you to create subgraphs by clicking in the view. When the subgraph is resized, the zoom level of the subgraph changes.
- Allows you to create simple hyperedges. Simple hyperedges can connect multiple nodes, but the inner shape of the hyperedge is fixed (a star like shape with segments joining at the center). You can also extend a simple hyperedge by clicking the hyperedge and then clicking a node, or by first clicking a node and then clicking a simple hyperedge. Right-clicking cancels the ongoing operation.
- Allows you to create segmented hyperedges. Segmented hyperedges have a segment tree as inner shape. You can also extend a simple hyperedge by clicking the hyperedge and then clicking a node, or by first clicking a node and then clicking a simple hyperedge. When you click in white space, a bend is created. This allows you to create multiple segments. Clicking with the middle mouse button during the creation of a new segmented hyperedge removes a bend. Right-clicking cancels the ongoing operation.
- Allows you to install the hyperedge pin connector and to create pins at the nodes. Move the mouse inside the node and then click near the border of the node to create a new pin. Previous hyperedge connectors of the node are deinstalled when creating pins at the node.
- Allows you to install the hyperedge clipping connector. This connector can be installed at nodes and at hyperedges. Clicking a node or a hyperedge installs the clipping connector. When a connector is installed at a hyperedge, it controls the ends of this hyperedge, no matter what connectors are installed at the nodes.
- Allows you to install the hyperedge center connector. This connector can be installed at nodes and at hyperedges. Clicking a node or a hyperedge installs the center connector. When a connector is installed at a hyperedge, it controls the ends of this hyperedge no matter what connectors are installed at the nodes.
- Allows you to remove the hyperedge connector. Clicking a node or a hyperedge deinstalls the center connector.
- When running the sample as an application, it allows you to load and save the hypergraph. These options are not available when running the sample as an application.
How to Run the Sample as an Application
This sample can
be run as an application.
The installation directory contains
an executable JAR file,
demohypergrapher.jar
,
that allows you to execute the sample with a double click from a
file browser. Note that if you are using Internet Explorer, you can
open the installation directory
and execute the JAR file from the browser. This
technique may not work in other Web browsers.
Alternatively, you
can run the sample application from the command line.
First check that the Ant utility is properly configured. If not, see the
instructions on how to configure Ant for Perforce JViews.
Then, go to the installation directory
of the sample and type:
ant run
Topics Covered
- Creating a hypergrapher.
- Creating a hyperedge.
- Using hyperedge connectors.
Detailed Description
This sample shows how to create and use a hypergrapher.
A hypergrapher (IlvHyperGrapher
) is a manager that can
display a hypergraph.
A hypergraph consists of nodes and hyperedges.
While a normal link (IlvLinkImage
) can only connect
two nodes, a hyperedge (IlvHyperEdge
) can connect
multiple nodes.
Hyperedges occur in many applications, for example, in electric signal
diagrams where each signal has one sender (source), but multiple
receivers (sinks).
Note:
JViews 8.5 offers graphic data structures for hypergraphs, but
hypergraphs are not yet supported by SDM.
Therefore, for now, this technology is only available in applications
based on the graphic framework that do not use styling.
Installation Directory
The Hypergraph sample is installed here.
Classes Involved
- ilog.views.hypergraph.IlvHyperGrapher
- ilog.views.hypergraph.IlvHyperEdge
- ilog.views.hypergraph.IlvSegmentedHyperEdge
- ilog.views.hypergraph.edgeconnector.IlvHyperEdgeConnector
- ilog.views.hypergraph.edgeconnector.IlvHyperEdgePinConnector
- ilog.views.hypergraph.edgeconnector.IlvHyperEdgeClippingConnector
- ilog.views.hypergraph.edgeconnector.IlvHyperEdgeCenterConnector
- ilog.views.hypergraph.interactor.IlvMakeHyperEdgePinConnectorInteractor
- ilog.views.hypergraph.interactor.IlvMakeHyperEdgeInteractor
- ilog.views.hypergraph.interactor.IlvMakeSegmentedHyperEdgeInteractor