GUIKIT PACKAGE TUTORIAL

GUIKit Example: GraphEditor

Code
In[11]:=
Click for copyable input
In[13]:=
Click for copyable input
In[14]:=
Click for copyable input
In[15]:=
Click for copyable input
In[16]:=
Click for copyable input
In[17]:=
Click for copyable input
In[18]:=
Click for copyable input
In[19]:=
Click for copyable input
In[20]:=
Click for copyable input

Examples

This example demonstrates the benefit of supplementing Mathematica functionality with GUIKit user interface elements leveraging existing third-party graph model and editing libraries. GraphEdit widgets take advantage of the Graph expression supported by and also SparseArray ArrayRules.

The user interface of the graph editing canvas allows you to do the following.

  • Create a new node (Ctrl+click or Right (alternate) click).
  • Create a new edge (Ctrl+click or Right (alternate) click inside a node).
  • Move selection (Drag selected nodes and edges).
  • Change selection (Drag, click, or Shift+click).
  • Delete currently selected nodes and edges (Del or Backspace key).
Matrix
In[21]:=
Click for copyable input
Out[21]=
In[22]:=
Click for copyable input
Out[22]//MatrixForm=
In[23]:=
Click for copyable input
Out[23]=
In[24]:=
Click for copyable input
Out[24]//MatrixForm=
SparseArray
In[29]:=
Click for copyable input
Out[29]=
In[30]:=
Click for copyable input
Out[30]//MatrixForm=
In[31]:=
Click for copyable input
Out[31]=
In[32]:=
Click for copyable input
Out[32]//MatrixForm=
Create
In[33]:=
Click for copyable input
Out[33]=
In[34]:=
Click for copyable input
Out[34]=

Here is another version run in a modeless session where you can interact with and change the displayed graph.

In[35]:=
Click for copyable input
Out[35]=
In[36]:=
Click for copyable input
In[37]:=
Click for copyable input
Out[37]=
New to Mathematica? Find your learning path »
Have a question? Ask support »