\HeaderA{line.graph}{Line graph of a graph}{line.graph}
\keyword{graphs}{line.graph}
\begin{Description}\relax
This function calculates the line graph of another graph.
\end{Description}
\begin{Usage}
\begin{verbatim}
line.graph(graph)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{graph}] The input graph, it can be directed or undirected.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The line graph \code{L(G)} of a \code{G} undirected graph is defined as
follows. \code{L(G)} has one vertex for each edge in \code{G} and two
vertices in \code{L(G)} are connected  by an edge if their
corresponding edges share an end point.

The line graph \code{L(G)} of a \code{G} directed graph is slightly
different, \code{L(G)} has one vertex for each edge in \code{G} and two
vertices in \code{L(G)} are connected by a directed edge if the target
of the first vertex's corresponding edge is the same as the source of
the second vertex's corresponding edge.
\end{Details}
\begin{Value}
A new graph object.
\end{Value}
\begin{Author}\relax
Gabor Csardi \email{csardi@rmki.kfki.hu}, the first version of the C
code was written by Vincent Matossian.
\end{Author}
\begin{Examples}
\begin{ExampleCode}
# generate the first De-Bruijn graphs
g <- graph.full(2, directed=TRUE, loops=TRUE)
line.graph(g)
line.graph(line.graph(g))
line.graph(line.graph(line.graph(g)))
\end{ExampleCode}
\end{Examples}

