GraphTheory[CopyGraph] - Maple Help

Home : Support : Online Help : Mathematics : Discrete Mathematics : Graph Theory : GraphTheory Package : GraphTheory/CopyGraph

GraphTheory[CopyGraph]

 Calling Sequence CopyGraph(G)

Parameters

 G - graph

Description

 • CopyGraph(G) creates a copy of the graph G.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $G:=\mathrm{CycleGraph}\left(5\right)$
 ${G}{:=}{\mathrm{Graph 1: an undirected unweighted graph with 5 vertices and 5 edge\left(s\right)}}$ (1)
 > $H:=\mathrm{CopyGraph}\left(G\right)$
 ${H}{:=}{\mathrm{Graph 2: an undirected unweighted graph with 5 vertices and 5 edge\left(s\right)}}$ (2)
 > $\mathrm{AddEdge}\left(H,\left\{\left\{1,3\right\},\left\{1,4\right\}\right\}\right)$
 ${\mathrm{Graph 2: an undirected unweighted graph with 5 vertices and 7 edge\left(s\right)}}$ (3)
 > $\mathrm{Edges}\left(G\right)$
 $\left\{\left\{{1}{,}{2}\right\}{,}\left\{{1}{,}{5}\right\}{,}\left\{{2}{,}{3}\right\}{,}\left\{{3}{,}{4}\right\}{,}\left\{{4}{,}{5}\right\}\right\}$ (4)
 > $\mathrm{Edges}\left(H\right)$
 $\left\{\left\{{1}{,}{2}\right\}{,}\left\{{1}{,}{3}\right\}{,}\left\{{1}{,}{4}\right\}{,}\left\{{1}{,}{5}\right\}{,}\left\{{2}{,}{3}\right\}{,}\left\{{3}{,}{4}\right\}{,}\left\{{4}{,}{5}\right\}\right\}$ (5)
 > $\left[\mathrm{SetVertexAttribute}\left(H,2,\mathrm{tag}="vertex"\right)\right]$
 $\left[{}\right]$ (6)
 > $\mathrm{GetVertexAttribute}\left(H,2,\mathrm{tag}\right)$
 ${"vertex"}$ (7)
 > $\mathrm{GetVertexAttribute}\left(G,2,\mathrm{tag}\right)$
 ${\mathrm{FAIL}}$ (8)