Navigation

Operators and Keywords

Function List:

C++ API

: gplot (A, xy)
: gplot (A, xy, line_style)
: [x, y] = gplot (A, xy)

Plot a graph defined by A and xy in the graph theory sense.

A is the adjacency matrix of the array to be plotted and xy is an n-by-2 matrix containing the coordinates of the nodes of the graph.

The optional parameter line_style defines the output style for the plot. Called with no output arguments the graph is plotted directly. Otherwise, return the coordinates of the plot in x and y.

See also: treeplot, etreeplot, spy.

Demonstration 1

The following code

 ## Binary Tree Representation
 A = [0 1 0 0 0 0 0
      1 0 1 1 0 0 0
      0 1 0 0 0 0 0
      0 1 0 0 1 0 0
      0 0 0 1 0 1 1
      0 0 0 0 1 0 0
      0 0 0 0 1 0 0];

 xy = [1  , 0
       1.5, 1
       2  , 0
       2.5, 2
       3.5, 1
       3  , 0
       4  , 0];

 clf;
 gplot (A, xy, "o-");
 set (get (gca, ("children")), "markersize", 12);
 title ("gplot() of Binary Tree Adjacency matrix");

Produces the following figure

Figure 1

Package: octave