networks
addvertex
add a vertex or set of vertices to a graph
Calling Sequence
Parameters
Description
Examples
addvertex(v1, G)
addvertex(v1, v2, G)
addvertex(v1, weights=w, G)
addvertex([v1, v2], weights=[w1, w2], G)
G
-
graph or network
v1, v2, ..., vn
new vertices for the graph G
w
user supplied weight for a vertex (default 0)
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](...).
See Also
GraphTheory
GraphTheory[AddVertex]
networks(deprecated)[addedge]
networks(deprecated)[vertices]
with
Download Help Document