networks

 add a vertex or set of vertices to a graph

Parameters

 G - graph or network v1, v2, ..., vn - new vertices for the graph G w - user supplied weight for a vertex (default 0)

Description

 • Important: The networks package has been deprecated.  Use the superseding command GraphTheory[AddVertex] instead.
 • This routine adds one or more vertices to a graph. The vertex names used are returned as an expression sequence.
 • To force addvertex() to use a specific weight for a single vertex use the optional argument (eg. weights=3).
 • If more than one vertex is to be added, they can be presented as a list or set of vertices.  In this case, non-default weights must also be specified as a list of weights as in: addvertex([1, 3], weights=[0, 0], G)
 • A vertex cannot be a symbol or string beginning with the letter e; these are reserved, by the package, for edge names.
 • This routine is normally loaded via the command with(networks) but can also be referenced using the full name networks[addvertex](...).

Examples

Important: The networks package has been deprecated.  Use the superseding command GraphTheory[AddVertex] instead.

 > $\mathrm{with}\left(\mathrm{networks}\right):$
 > $\mathrm{new}\left(G\right):$
 > $\mathrm{addvertex}\left(\left\{1,2,3,4\right\},G\right):$
 > $\mathrm{addvertex}\left(\mathrm{vname},\mathrm{xx},G\right):$
 > $\mathrm{vertices}\left(G\right)$
 $\left\{{1}{,}{2}{,}{3}{,}{4}{,}{\mathrm{vname}}{,}{\mathrm{xx}}\right\}$ (1)
 > $\mathrm{vweight}\left(1,G\right)$
 ${0}$ (2)
 > $\mathrm{addvertex}\left(\left[\mathrm{n1},\mathrm{n2}\right],\mathrm{weights}=\left[5,\mathrm{symwt}\right],G\right)$
 ${\mathrm{n1}}{,}{\mathrm{n2}}$ (3)
 > $\mathrm{vweight}\left(\mathrm{n2},G\right)$
 ${\mathrm{symwt}}$ (4)