networks(deprecated)/draw3d - Help

networks

 draw3d
 draw an undirected connected graph in 3-D

 Calling Sequence draw3d(G, opts )

Parameters

 G - undirected graph opts - (optional) plot options; see plot3d[option]

Description

 • Important: The networks package has been deprecated.  Use the superseding package GraphTheory instead.
 • The draw3d(G, opts) routine draws an undirected connected graph $G=\left(V,E\right)$ in three dimensions in such a way that structure and symmetry in the graph is revealed.  The graph G is input as a GRAPH data type as created in the networks package. The output is a three dimensional plot of labeled points with lines connecting them.  The points correspond to the vertices in the graph and the lines correspond to the edges in the graph.
 • The location of the vertices of the graph is determined as follows. Let $A$ be the adjacency matrix of G and let $u$, $v$ and $w$ be three eigenvectors of $A$ with corresponding second, third, and fourth largest eigenvalue in absolute value.  Then the (x,y,z) coordinates of the ith vertex of G is (${u}_{i},{v}_{i},{w}_{i}$).
 • Sometimes other symmetries in the graph can be seen by using other eigenvectors. If the optional argument $\mathrm{eigenvectors}=\left[\mathrm{e1},\mathrm{e2},\mathrm{e3}\right]$ is specified, where e1, e2, and e3 are vertex numbers (integers from 1 through the number of vertices), the eigenvectors corresponding to the eigenvalues of these relative magnitudes are used.
 • If the graph is not connected, you can draw the connected components separately.  The last example below shows how to do this.
 • Remaining arguments are interpreted as options which are specified as equations of the form option = value. The remaining options are the same as those available for the plot3d command. For more information, see plot3d[option].
 • The algorithm used is the same as that described for plots[graphplot3d(deprecated)]. The networks[draw3d] and plots[graphplot3d] commands are identical except they accept different forms of graph input.
 • Note: The plots[graphplot3d(deprecated)] command has been superseded by GraphTheory[DrawGraph].

Examples

Important: The networks package has been deprecated.  Use the superseding package GraphTheory instead.

 > $\mathrm{with}\left(\mathrm{networks}\right):$
 > $G≔\mathrm{cube}\left(\right):$
 > $\mathrm{draw3d}\left(G\right)$
 > $A≔\mathrm{adjacency}\left(G\right)$
 > $\mathrm{cp}≔\mathrm{factor}\left(\mathrm{linalg}[\mathrm{charpoly}]\left(A,x\right)\right)$
 > $\mathrm{draw3d}\left(G,\mathrm{eigenvectors}=\left[1,3,8\right]\right)$
 > $G≔\mathrm{dodecahedron}\left(\right):$
 > $\mathrm{draw3d}\left(G,\mathrm{title}="A dodecahedron"\right)$

An example of a graph that is not connected.

 > $V≔\left\{\mathrm{seq}\left(i,i=0..8\right)\right\}:$
 > $E≔\left\{\left\{7,8\right\},\left\{2,7\right\},\left\{0,6\right\},\left\{5,7\right\},\left\{1,2\right\},\left\{1,5\right\},\left\{2,4\right\},\left\{0,3\right\},\left\{1,8\right\},\left\{3,6\right\},\left\{4,8\right\},\left\{4,5\right\}\right\}:$
 > $G≔\mathrm{graph}\left(V,E\right):$
 > $\mathrm{draw3d}\left(G\right)$
 > $C≔\mathrm{components}\left(G\right)$

The number of connected components:

 > $\mathrm{nops}\left(C\right)$
 > $\mathrm{C1}≔\mathrm{induce}\left({C}_{1},G\right):$
 > $\mathrm{C2}≔\mathrm{induce}\left({C}_{2},G\right):$
 > $\mathrm{draw3d}\left(\mathrm{C1}\right)$
 > $\mathrm{draw3d}\left(\mathrm{C2}\right)$