Interactive Graph Layout Method - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Discrete Mathematics : Graph Theory : GraphTheory Package : DrawGraph Details : GraphTheory/Layouts/Interactive

Interactive Graph Layout Method

 

Options

Description

Examples

Options

• 

initial=string

  

the name of the initial layout

• 

neutral_color=color

  

a color specification (see ColorTools/Format) for the unselected vertices in the graph. LightGray by default.

• 

select_color=color

  

a color specification (see ColorTools/Format) for the selected vertex in the graph. Red by default.

• 

drag_color=color

  

a color specification (see ColorTools/Format) for the active vertex while dragging in the graph. Yellow by default.

• 

nodrag=truefalse

  

if the nodrag option is given, only click repositioning will be active in the interactive plot

• 

noselect=truefalse

  

if the noselect option is given, only drag repositioning will be active in the interactive plot

Description

• 

The interactive layout method creates an interactive plot component with a drawing of the Graph that can have the vertices repositioned by click, or clicking and dragging.

– 

The first method is to click on a vertex. The vertex will then change to the selection color (red by default). Then click in a new location to reposition the selected vertex, when it will return to the neutral color.

– 

The second method is to click and drag a vertex into a new position. When first clicked, the vertex will change to the dragging color (yellow by default). The vertex will return the neutral color when dragging ends.

• 

For the interactive layout, all of the graph stylesheet will be preserved except for vertex colors. All vertices will be shown in a neutral color (light gray by default).  This change is not permanent, and is only in effect for the interactive plot.

• 

The user layout of the input graph will be continuously updated to reflect changes in the interactive plot so that a bare call to DrawGraph will draw the graph using this layout.

• 

This layout method works in two dimensions only.

Examples

Note: To interact with the examples provided below, open this help page as a worksheet and then execute the worksheet.

withGraphTheory:

withRandomGraphs:

G1RandomGraph15,26

G1Graph 1: an undirected unweighted graph with 15 vertices and 26 edge(s)

(1)

DrawGraphG1,layout=interactive

DrawGraphG1

If you are unhappy with your changes and what to start a new interactive layout, with the point layout reset to the default point layout you can specify initial=default in the layout options:

DrawGraphG1,layout=interactive,layoutoptions=initial=default

G2RandomGraph14,29

G2Graph 2: an undirected unweighted graph with 14 vertices and 29 edge(s)

(2)

DrawGraphG2,layout=interactive,layoutoptions=neutral_color=White,initial=spring

DrawGraphG2

See Also

GraphTheory[DrawGraph]