1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/structural.properties.R
3\name{topo_sort}
4\alias{topo_sort}
5\alias{topological.sort}
6\title{Topological sorting of vertices in a graph}
7\usage{
8topo_sort(graph, mode = c("out", "all", "in"))
9}
10\arguments{
11\item{graph}{The input graph, should be directed}
12
13\item{mode}{Specifies how to use the direction of the edges.  For
14\dQuote{\code{out}}, the sorting order ensures that each node comes before
15all nodes to which it has edges, so nodes with no incoming edges go first.
16For \dQuote{\code{in}}, it is quite the opposite: each node comes before all
17nodes from which it receives edges. Nodes with no outgoing edges go first.}
18}
19\value{
20A vertex sequence (by default, but see the \code{return.vs.es}
21option of \code{\link{igraph_options}}) containing vertices in
22topologically sorted order.
23}
24\description{
25A topological sorting of a directed acyclic graph is a linear ordering of
26its nodes where each node comes before all nodes to which it has edges.
27}
28\details{
29Every DAG has at least one topological sort, and may have many.  This
30function returns a possible topological sort among them. If the graph is not
31acyclic (it has at least one cycle), a partial topological sort is returned
32and a warning is issued.
33}
34\examples{
35
36g <- barabasi.game(100)
37topo_sort(g)
38
39}
40\author{
41Tamas Nepusz \email{ntamas@gmail.com} and Gabor Csardi
42\email{csardi.gabor@gmail.com} for the R interface
43}
44\keyword{graphs}
45