1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
<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 <class <a href="./IncidenceGraph.html">IncidenceGraph</a>, class <a href="./DFSVisitor.html">DFSVisitor</a>, class <a href="#ColorMap">ColorMap</a>>
void depth_first_visit(IncidenceGraph& g,
typename graph_traits<IncidenceGraph>::vertex_descriptor s,
DFSVisitor& 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& 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 © 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>
|