2
0
mirror of https://github.com/boostorg/graph.git synced 2026-01-20 16:42:13 +00:00
Files
graph/doc/depth_first_visit.html
Jeremy Siek f79bd7ef42 updated email addresses
[SVN r11507]
2001-11-01 17:22:28 +00:00

116 lines
3.5 KiB
HTML

<HTML>
<!--
-- Copyright (c) Jeremy Siek 2000
--
-- Permission to use, copy, modify, distribute and sell this software
-- and its documentation for any purpose is hereby granted without fee,
-- provided that the above copyright notice appears in all copies and
-- that both that copyright notice and this permission notice appear
-- in supporting documentation. Silicon Graphics makes no
-- representations about the suitability of this software for any
-- purpose. It is provided "as is" without express or implied warranty.
-->
<Head>
<Title>Boost Graph Library: Depth-First Visit</Title>
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
ALINK="#ff0000">
<IMG SRC="../../../c++boost.gif"
ALT="C++ Boost" width="277" height="86">
<BR Clear>
<H2><A NAME="sec:dfs"></A>
<TT>depth_first_visit</TT>
</H2>
<P>
<PRE>
template &lt;class <a href="./IncidenceGraph.html">IncidenceGraph</a>, class <a href="./DFSVisitor.html">DFSVisitor</a>, class <a href="#ColorMap">ColorMap</a>&gt;
void depth_first_visit(IncidenceGraph& g,
typename graph_traits&lt;IncidenceGraph&gt;::vertex_descriptor s,
DFSVisitor&amp; vis, ColorMap color)
</PRE>
<P>
This function visits all of the vertices in the same connected
component as the source vertex <tt>s</tt>, using the <a
href="./graph_theory_review.html#sec:dfs-algorithm">depth-first
pattern</a>. The main purpose of the function is for the
implementation of <TT>depth_first_search()</TT> though sometimes it is
useful on its own.
<p>
The <tt>DFSVisitor</tt> supplied by the user determines what
actions are taken at each event-point within the algorithm.
<p>
The <tt>ColorMap</tt> is used by the algorithm to keep track
of which vertices have been visited.
<P>
<h3>Where Defined:</h3>
<a href="../../../boost/graph/depth_first_search.hpp"><TT>boost/graph/depth_first_search.hpp</TT></a>
<h3>Parameters</h3>
IN <tt>IncidenceGraph&amp; g</tt>
<blockquote>
A directed or undirected graph. The graph's type must be a model of
<a href="./IncidenceGraph.html">Incidence Graph</a>.
</blockquote>
IN: <tt>vertex_descriptor s</tt>
<blockquote>
The source vertex from which to start the search.
</blockquote>
IN: <tt>DFSVisitor visitor</tt>
<blockquote>
A visitor object that is invoked inside the algorithm at the
event-points specified by the <a href="./DFSVisitor.html">DFS
Visitor</a> concept. The visitor object is passed by value <a
href="#1">[1]</a>.
</blockquote>
UTIL: <tt>ColorMap color</tt>
<blockquote>
This is used by the algorithm to keep track of its progress through
the graph. The type <tt>ColorMap</tt> must be a model of <a
href="../../property_map/ReadWritePropertyMap.html">Read/Write
Property Map</a> and its key type must be the graph's vertex
descriptor type and the value type of the color map map must model
<a href="./ColorValue.html">Color Value</a>.
</blockquote>
<P>
<h3>Complexity</h3>
Time complexity is <i>O(E)</i>.
<h3>Notes</h3>
<p><a name="1">[1]</a>
Since the visitor parameter is passed by value, if your visitor
contains state then any changes to the state during the algorithm
will be made to a copy of the visitor object, not the visitor object
passed in. Therefore you may want the visitor to hold this state by
pointer or reference.
<br>
<HR>
<TABLE>
<TR valign=top>
<TD nowrap>Copyright &copy 2000-2001</TD><TD>
<A HREF="../../../people/jeremy_siek.htm">Jeremy Siek</A>, Indiana University (<A HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)
</TD></TR></TABLE>
</BODY>
</HTML>