\HeaderA{graph.structure}{Method for structural manipulation of graphs}{graph.structure}
\aliasA{add.edges}{graph.structure}{add.edges}
\aliasA{add.vertices}{graph.structure}{add.vertices}
\aliasA{delete.edges}{graph.structure}{delete.edges}
\aliasA{delete.vertices}{graph.structure}{delete.vertices}
\keyword{graphs}{graph.structure}
\begin{Description}\relax
These are the methods for simple manipulation of graphs:
adding and deleting edges and vertices.
\end{Description}
\begin{Usage}
\begin{verbatim}
add.edges(graph, edges, ..., attr=list())
add.vertices(graph, nv, ..., attr=list())
delete.edges(graph, edges)
delete.vertices(graph, v)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{graph}] The graph to work on.
\item[\code{edges}] Edge sequence, the edges to remove.
\item[\code{...}] Additional parameters will be added as edge/vertex
attributes. Note that these arguments have to be named.
\item[\code{attr}] Additional edge/vertex attributes to add. This will be
concatenated to the other supplied attributes.
\item[\code{nv}] Numeric constant, the number of vertices to add.
\item[\code{v}] Vector sequence, the vertices to remove.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{add.edges} adds the specified edges to the graph. The ids of the
vertices are preserved. The additionally supplied named arguments will
be added as edge attributes for the new edges. If an attribute was not
present in the original graph, its value for the original edges will
be \code{NA}.

\code{add.vertices} adds the specified number of isolate vertices to
the graph. The ids of the old vertices are preserved. The additionally
supplied named arguments will be added as vertex attributes for the
new vertices. If an attribute was not present in the original graph,
its value is set to \code{NA} for the original vertices.

\code{delete.edges} removes the specified edges from the graph. If a
specified edge is not present, the function gives an error message,
and the original graph remains unchanged.
The ids of the vertices are preserved.

\code{delete.vertices} removes the specified vertices from the graph
together with their adjacent edges. The ids of the vertices are
\emph{not} preserved.
\end{Details}
\begin{Value}
The new graph.
\end{Value}
\begin{Author}\relax
Gabor Csardi \email{csardi@rmki.kfki.hu}
\end{Author}
\begin{Examples}
\begin{ExampleCode}
g <- graph.ring(10)
add.edges(g, c(1,5,2,6) )
delete.edges(g, E(g, P=c(0,9, 1,2)) )
delete.vertices(g, c(1,6,7) )
\end{ExampleCode}
\end{Examples}

