[boost-doc-zh] r284 committed - graph 库文档第21.1-20.3.1节

  • From: codesite-noreply@xxxxxxxxxx
  • To: boost-doc-zh-notify@xxxxxxxxxxxxx
  • Date: Mon, 03 Aug 2009 05:27:29 +0000

Revision: 284
Author: alai04
Date: Sun Aug  2 22:26:22 2009
Log: graph 库文档第21.1-20.3.1节
http://code.google.com/p/boost-doc-zh/source/detail?r=284

Added:
 /trunk/libs/graph/test/CMakeLists.txt
 /trunk/libs/graph/test/Jamfile.v2
 /trunk/libs/graph/test/adj_list_invalidation.cpp
 /trunk/libs/graph/test/adj_list_loops.cpp
 /trunk/libs/graph/test/cycle_ratio_s382.90.dot
 /trunk/libs/graph/test/dimacs.cpp
 /trunk/libs/graph/test/is_straight_line_draw_test.cpp
 /trunk/libs/graph/test/metric_tsp_approx.cpp
 /trunk/libs/graph/test/metric_tsp_approx.txt
 /trunk/libs/graph/test/named_vertices_test.cpp
 /trunk/libs/graph/test/r_c_shortest_paths_test.cpp
 /trunk/libs/graph/test/regression.cfg
Modified:
 /trunk/libs/graph/doc/bellman_ford_shortest.html
 /trunk/libs/graph/doc/bgl_named_params.html
 /trunk/libs/graph/doc/breadth_first_search.html
 /trunk/libs/graph/doc/breadth_first_visit.html
 /trunk/libs/graph/doc/dag_shortest_paths.html
 /trunk/libs/graph/doc/depth_first_search.html
 /trunk/libs/graph/doc/depth_first_visit.html
 /trunk/libs/graph/doc/dijkstra_shortest_paths.html
 /trunk/libs/graph/doc/floyd_warshall_shortest.html
 /trunk/libs/graph/doc/johnson_all_pairs_shortest.html
 /trunk/libs/graph/doc/r_c_shortest_paths.html
 /trunk/libs/graph/doc/undirected_dfs.html

=======================================
--- /dev/null
+++ /trunk/libs/graph/test/CMakeLists.txt       Sun Aug  2 22:26:22 2009
@@ -0,0 +1,63 @@
+boost_additional_test_dependencies(graph BOOST_DEPENDS test assign)
+
+boost_test_run(transitive_closure_test)
+boost_test_compile(adj_list_cc)
+boost_test_run(adj_list_edge_list_set)
+boost_test_compile(adj_matrix_cc)
+boost_test_run(bfs)
+boost_test_compile(bfs_cc)
+boost_test_run(bellman-test)
+boost_test_run(betweenness_centrality_test DEPENDS boost_graph SHARED)
+boost_test_run(csr_graph_test)
+boost_test_run(dag_longest_paths)
+boost_test_run(dfs)
+boost_test_compile(dfs_cc)
+boost_test_compile(dijkstra_cc)
+boost_test_run(dijkstra_heap_performance ARGS 10000 DEPENDS boost_graph SHARED)
+boost_test_run(dominator_tree_test)
+boost_test_run(relaxed_heap_test ARGS 5000 15000)
+boost_test_compile(edge_list_cc)
+boost_test_compile(filtered_graph_cc)
+boost_test_run(graph)
+boost_test_compile(graph_concepts)
+boost_test_run(graphviz_test
+  DEPENDS boost_test_exec_monitor boost_graph STATIC)
+boost_test_run(gursoy_atun_layout_test)
+boost_test_run(layout_test)
+boost_test_run(serialize DEPENDS boost_serialization)
+boost_test_compile(reverse_graph_cc)
+boost_test_run(sequential_vertex_coloring)
+boost_test_run(subgraph)
+boost_test_run(isomorphism)
+boost_test_run(adjacency_matrix_test)
+boost_test_compile(vector_graph_cc)
+boost_test_compile(copy)
+boost_test_compile(property_iter)
+boost_test_run(bundled_properties)
+boost_test_run(floyd_warshall_test)
+boost_test_run(astar_search_test)
+boost_test_run(biconnected_components_test)
+boost_test_run(cuthill_mckee_ordering)
+boost_test_run(king_ordering)
+boost_test_run(matching_test)
+# boost_test_run(max_flow_test)
+# boost_test_run(kolmogorov_max_flow_test) TODO: Boost 1.34.x only
+
+# GraphML Tests - not for Boost 1.34.x
+#include(FindEXPAT)
+#if (EXPAT_FOUND)
+#  include_directories(${EXPAT_INCLUDE_DIRS})
+#  boost_test_run(graphml_test LIBRARIES boost_graph)
+#endif (EXPAT_FOUND)
+
+# Stanford GraphBase Tests
+if ($ENV{SDB})
+  include_directories("$ENV{SDB}")
+  boost_test_compile(stanford_graph_cc)
+endif ($ENV{SDB})
+
+# LEDA tests
+if ($ENV{LEDA})
+  include_directories("$ENV{LEDA}/incl")
+  boost_test_compile(leda_graph_cc)
+endif ($ENV{LEDA})
=======================================
--- /dev/null
+++ /trunk/libs/graph/test/Jamfile.v2   Sun Aug  2 22:26:22 2009
@@ -0,0 +1,145 @@
+# Copyright (c) 2002 Trustees of Indiana University
+#
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+# Define SGB (stanford graph base top level directory) and
+# LEDA (also top level directory) at the command line of jam using -s
+
+import modules ;
+
+local optional_tests ;
+
+path-constant PLANAR_INPUT_FILES : ./planar_input_graphs ;
+
+path-constant CYCLE_RATIO_INPUT_FILE : ./cycle_ratio_s382.90.dot ;
+
+if [ modules.peek : EXPAT_INCLUDE ] && [ modules.peek : EXPAT_LIBPATH ]
+{
+ optional_tests += [ run graphml_test.cpp ../build//boost_graph : : "graphml_test.xml" ] ;
+}
+
+test-suite graph_test :
+
+    [ run transitive_closure_test.cpp ]
+    [ compile adj_list_cc.cpp ]
+
+    # adj_list_test needs some work -JGS
+    # unit-test adj_list_test : adj_list_test.cpp  ;
+
+    [ run adj_list_edge_list_set.cpp ]
+    [ run adj_list_loops.cpp ]
+    [ compile adj_matrix_cc.cpp ]
+    [ run bfs.cpp ../../test/build//boost_test_exec_monitor ]
+    [ compile bfs_cc.cpp ]
+    [ run bellman-test.cpp ]
+    [ run betweenness_centrality_test.cpp ]
+    [ run bidir_remove_edge.cpp ]
+    [ run csr_graph_test.cpp : : : : : <variant>release ]
+    [ run dag_longest_paths.cpp ]
+    [ run dfs.cpp ../../test/build//boost_test_exec_monitor ]
+    [ compile dfs_cc.cpp ]
+    [ compile dijkstra_cc.cpp ]
+    [ run dijkstra_heap_performance.cpp : 10000 ]
+    [ run dominator_tree_test.cpp ]
+    [ run relaxed_heap_test.cpp : 5000 15000 ]
+    [ compile edge_list_cc.cpp ]
+    [ compile filtered_graph_cc.cpp ]
+    [ run graph.cpp ]
+    [ compile graph_concepts.cpp ]
+    [ run graphviz_test.cpp
+            /boost/test//boost_test_exec_monitor/<link>static
+            ../build//boost_graph ]
+    [ run gursoy_atun_layout_test.cpp ]
+ [ run layout_test.cpp : : : <test-info>always_show_run_output <toolset>intel:<debug-symbols>off ]
+
+    [ run serialize.cpp
+          ../../serialization/build//boost_serialization
+      : : : ]
+
+    [ compile reverse_graph_cc.cpp ]
+
+    [ run sequential_vertex_coloring.cpp ]
+
+    [ run subgraph.cpp ../../test/build//boost_test_exec_monitor ]
+
+    [ run isomorphism.cpp ../../test/build//boost_test_exec_monitor ]
+
+    [ run adjacency_matrix_test.cpp ]
+
+    [ compile vector_graph_cc.cpp ]
+
+    [ compile copy.cpp ]
+
+    [ compile property_iter.cpp ]
+
+    [ run bundled_properties.cpp ]
+
+    [ run floyd_warshall_test.cpp ]
+
+    [ run astar_search_test.cpp ]
+
+    [ run biconnected_components_test.cpp ]
+
+    [ run cuthill_mckee_ordering.cpp ]
+
+    [ run king_ordering.cpp ]
+
+    [ run matching_test.cpp ]
+
+    [ run max_flow_test.cpp ]
+
+    [ run kolmogorov_max_flow_test.cpp ]
+
+ [ run cycle_ratio_tests.cpp ../build//boost_graph : $(CYCLE_RATIO_INPUT_FILE) ]
+
+    [ run basic_planarity_test.cpp ]
+
+    [ run make_connected_test.cpp ]
+
+    [ run make_bicon_planar_test.cpp ]
+
+    [ run make_maximal_planar_test.cpp ]
+
+    [ run named_vertices_test.cpp ]
+
+    [ run all_planar_input_files_test.cpp
+        ../../filesystem/build
+        ../../system/build
+        : $(PLANAR_INPUT_FILES) ]
+
+    [ run parallel_edges_loops_test.cpp
+        ../../filesystem/build
+        ../../system/build
+        : $(PLANAR_INPUT_FILES) ]
+
+    # [ run r_c_shortest_paths_test.cpp ]
+    [ run is_straight_line_draw_test.cpp ]
+    [ run metric_tsp_approx.cpp : metric_tsp_approx.txt ]
+    [ compile dimacs.cpp ]
+
+    $(optional_tests)
+    ;
+
+# Run SDB tests only when -sSDB= is set.
+if [ modules.peek : SDB ] != ""
+{
+    local SDB_DEPENDCIES =
+        <include>$(SGB) <library-file>$(SGB)/libgb.a  ;
+
+    compile stanford_graph_cc.cpp
+        $(SDB_DEPENDCIES)  ;
+}
+
+# Run LEDA tests only when -sLEDA= is set.
+if [ modules.peek : LEDA ] != ""
+{
+     local LEDA_DEPENDENCIES =
+        <include>$(LEDA)/incl
+        <library-file>$(LEDA)/libG.a
+        ;
+
+    compile leda_graph_cc.cpp
+       $(LEDA_DEPENDENCIES) ;
+}
=======================================
--- /dev/null
+++ /trunk/libs/graph/test/adj_list_invalidation.cpp Sun Aug 2 22:26:22 2009
@@ -0,0 +1,144 @@
+
+#include <iostream>
+#include <string>
+#include <boost/graph/adjacency_list.hpp>
+
+#include "../../../../../gpld/common/typestr.hpp"
+
+using namespace std;
+using namespace boost;
+
+// The purpose of this test is simply to provide a testing ground for the
+// invalidation of iterators and descriptors.
+
+template <typename Graph>
+void make_graph(Graph& g)
+{
+    // Build a simple (barbell) graph.
+    typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
+    Vertex u = add_vertex(10, g);
+    Vertex v = add_vertex(20, g);
+    add_edge(u, v, 100, g);
+}
+
+// Invalid iterators and descriptors will cause a segfault.
+template <typename Graph, typename Iterator, typename Descriptor>
+void test(Graph& g, Iterator i, Descriptor d, string const& str)
+{
+    int x;
+    cout << "... " << str << " iter" << endl;
+    x = g[*i];
+//     cout << "... " << x << endl;
+    cout << "... " << str << " desc" << endl;
+    x = g[d];
+//     cout << "... " << x << endl;
+}
+
+template <typename Graph>
+void invalidate_edges()
+{
+    typedef typename graph_traits<Graph>::edge_descriptor Edge;
+    typedef typename graph_traits<Graph>::edge_iterator EdgeIterator;
+
+    Graph g;
+    make_graph(g);
+
+    // The actual test. These are valid here.
+    EdgeIterator i = edges(g).first;
+    Edge e = *i;
+
+    // Add a vertex, see what breaks.
+    add_vertex(g);
+    test(g, i, e, "edges");
+};
+
+template <typename Graph>
+void invalidate_vertices()
+{
+    typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
+    typedef typename graph_traits<Graph>::vertex_iterator VertexIterator;
+
+    Graph g;
+    make_graph(g);
+
+    // The actual test. These are valid here.
+    VertexIterator i = vertices(g).first;
+    Vertex v = *i;
+
+    // Add a vertex, see what breaks.
+    add_vertex(g);
+    test(g, i, v, "vertices");
+}
+
+template <typename Graph>
+void invalidate_out_edges()
+{
+    typedef typename graph_traits<Graph>::edge_descriptor Edge;
+    typedef typename graph_traits<Graph>::out_edge_iterator OutIterator;
+
+    Graph g;
+    make_graph(g);
+
+    // The actual test. These are valid here.
+    OutIterator i = out_edges(*vertices(g).first, g).first;
+    Edge e = *i;
+
+    // Add a vertex, see what breaks.
+    add_vertex(g);
+    test(g, i, e, "out edges");
+}
+
+template <typename Graph>
+void invalidate_adj_verts()
+{
+    typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
+    typedef typename graph_traits<Graph>::adjacency_iterator AdjIterator;
+
+    Graph g;
+    make_graph(g);
+
+    // The actual test. These are valid here.
+    AdjIterator i = adjacent_vertices(*vertices(g).first, g).first;
+    Vertex v = *i;
+
+    // Add a vertex, see what breaks.
+    add_vertex(g);
+    test(g, i, v, "adjacent vertices");
+}
+
+
+int main()
+{
+    typedef adjacency_list<vecS, vecS, undirectedS, int, int> VVU;
+    cout << "vecS vecS undirectedS" << endl;
+    invalidate_vertices<VVU>();
+    invalidate_edges<VVU>();
+    invalidate_out_edges<VVU>();
+    invalidate_adj_verts<VVU>();
+
+    typedef adjacency_list<vecS, vecS, bidirectionalS, int, int> VVB;
+    cout << "vecS vecS bidirectionals" << endl;
+    invalidate_vertices<VVB>();
+    invalidate_edges<VVB>();
+    invalidate_out_edges<VVB>();
+    invalidate_adj_verts<VVB>();
+
+    // If you comment out the tests before this, then adj_verts test will
+ // run without segfaulting - at least under gcc-4.3. Not really sure why, + // but I'm guessing it's still not generating valid results, and shouldn't
+    // be taken as an indicator of stability.
+    typedef adjacency_list<vecS, vecS, directedS, int, int> VVD;
+    cout << "vecS vecS directedS" << endl;
+    invalidate_vertices<VVD>();
+//     invalidate_edges<VVD>();
+//     invalidate_out_edges<VVD>();
+//     invalidate_adj_verts<VVD>();
+
+    typedef adjacency_list<listS, vecS, directedS, int, int> LVD;
+    cout << "listS vecS directedS" << endl;
+    invalidate_vertices<LVD>();
+//     invalidate_edges<LVD>();
+//     invalidate_out_edges<LVD>();
+//     invalidate_adj_verts<LVD>();
+}
+
=======================================
--- /dev/null
+++ /trunk/libs/graph/test/adj_list_loops.cpp   Sun Aug  2 22:26:22 2009
@@ -0,0 +1,117 @@
+
+#if __GNUC__ == 4 && __GNUC_MINOR__ >= 3
+# define BOOST_NO_HASH
+#endif
+
+#include <iostream>
+
+#include <boost/assert.hpp>
+#include <boost/graph/adjacency_list.hpp>
+
+using namespace boost;
+
+// TODO: Integrate this into a larger adj_list test suite.
+
+template <typename Graph>
+void test_graph_nonloop()
+{
+    typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
+    typedef typename graph_traits<Graph>::edge_descriptor Edge;
+
+    // Build a graph with 1 edge and turn it into a loop.
+    Graph g(5);
+    Vertex u = *vertices(g).first;
+    Vertex v = *next(vertices(g).first, 2);
+    add_edge(u, v, g);
+    BOOST_ASSERT(num_vertices(g) == 5);
+    BOOST_ASSERT(num_edges(g) == 1);
+    remove_edge(u, v, g);
+    BOOST_ASSERT(num_edges(g) == 0);
+
+}
+
+
+template <typename Graph>
+void test_multigraph_nonloop()
+{
+    typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
+    typedef typename graph_traits<Graph>::edge_descriptor Edge;
+
+    // Build a graph with 1 edge and turn it into a loop.
+    Graph g(5);
+    Vertex u = *vertices(g).first;
+    Vertex v = *next(vertices(g).first, 2);
+    add_edge(u, v, g);
+    add_edge(u, v, g);
+    BOOST_ASSERT(num_vertices(g) == 5);
+    BOOST_ASSERT(num_edges(g) == 2);
+    remove_edge(u, v, g);
+    BOOST_ASSERT(num_edges(g) == 0);
+
+}
+
+template <typename Graph>
+void test_graph_loop()
+{
+    typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
+    typedef typename graph_traits<Graph>::edge_descriptor Edge;
+
+    Graph g(5);
+    Vertex v = *next(vertices(g).first, 2);
+    add_edge(v, v, g);
+    BOOST_ASSERT(num_vertices(g) == 5);
+    BOOST_ASSERT(num_edges(g) == 1);
+    remove_edge(v, v, g);
+    BOOST_ASSERT(num_edges(g) == 0);
+}
+
+template <typename Graph>
+void test_multigraph_loop()
+{
+    typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
+    typedef typename graph_traits<Graph>::edge_descriptor Edge;
+
+    Graph g(5);
+    Vertex v = *next(vertices(g).first, 2);
+    add_edge(v, v, g);
+    add_edge(v, v, g);
+    BOOST_ASSERT(num_vertices(g) == 5);
+    BOOST_ASSERT(num_edges(g) == 2);
+    remove_edge(v, v, g);
+    BOOST_ASSERT(num_edges(g) == 0);
+}
+
+template <typename Kind>
+void test()
+{
+    typedef no_property na;
+    typedef adjacency_list<vecS, vecS, Kind, na, na, na, listS> VVL;
+    typedef adjacency_list<listS, vecS, Kind, na, na, na, listS> LVL;
+    typedef adjacency_list<setS, vecS, Kind, na, na, na, listS> SVL;
+    typedef adjacency_list<multisetS, vecS, Kind, na, na, na, listS> MVL;
+
+    test_graph_nonloop<VVL>();
+    test_graph_nonloop<LVL>();
+    test_graph_nonloop<SVL>();
+    test_graph_nonloop<MVL>();
+    test_multigraph_nonloop<VVL>();
+    test_multigraph_nonloop<LVL>();
+    test_multigraph_nonloop<MVL>();
+    test_graph_loop<VVL>();
+    test_graph_loop<LVL>();
+    test_graph_loop<SVL>();
+    test_graph_loop<MVL>();
+    test_multigraph_loop<VVL>();
+    test_multigraph_loop<LVL>();
+    test_multigraph_loop<MVL>();
+}
+
+
+int main()
+{
+    test<undirectedS>();
+    test<directedS>();
+    test<bidirectionalS>();
+
+    return 0;
+}
=======================================
--- /dev/null
+++ /trunk/libs/graph/test/cycle_ratio_s382.90.dot      Sun Aug  2 22:26:22 2009
@@ -0,0 +1,259 @@
+digraph G {
+ edge [w2=1];
+  n79 -> n5 [w1=1];
+  n74 -> n6 [w1=1];
+  n15 -> n7 [w1=1];
+  n102 -> n7 [w1=1];
+  n94 -> n8 [w1=1];
+  n95 -> n8 [w1=1];
+  n93 -> n8 [w1=1];
+  n93 -> n9 [w1=1];
+  n42 -> n9 [w1=1];
+  n7 -> n10 [w1=1];
+  n68 -> n10 [w1=1];
+  n1 -> n11 [w1=1];
+  n39 -> n11 [w1=1];
+  n99 -> n12 [w1=1];
+  n50 -> n12 [w1=1];
+  n23 -> n13 [w1=1];
+  n29 -> n13 [w1=1];
+  n95 -> n14 [w1=1];
+  n37 -> n14 [w1=1];
+  n99 -> n15 [w1=1];
+  n50 -> n15 [w1=0];
+  n35 -> n16 [w1=1];
+  n81 -> n16 [w1=1];
+  n39 -> n17 [w1=1];
+  n88 -> n17 [w1=1];
+  n99 -> n18 [w1=1];
+  n98 -> n18 [w1=1];
+  n102 -> n18 [w1=1];
+  n95 -> n19 [w1=1];
+  n37 -> n19 [w1=1];
+  n94 -> n20 [w1=1];
+  n95 -> n20 [w1=1];
+  n38 -> n20 [w1=0];
+  n1 -> n21 [w1=0];
+  n93 -> n21 [w1=1];
+  n49 -> n21 [w1=1];
+  n55 -> n21 [w1=1];
+  n104 -> n22 [w1=1];
+  n105 -> n22 [w1=1];
+  n96 -> n22 [w1=1];
+  n94 -> n23 [w1=1];
+  n85 -> n23 [w1=1];
+  n1 -> n24 [w1=1];
+  n93 -> n24 [w1=1];
+  n12 -> n25 [w1=0];
+  n53 -> n25 [w1=1];
+  n1 -> n26 [w1=1];
+  n60 -> n26 [w1=1];
+  n76 -> n26 [w1=1];
+  n2 -> n27 [w1=1];
+  n61 -> n28 [w1=1];
+  n69 -> n28 [w1=1];
+  n94 -> n29 [w1=1];
+  n85 -> n29 [w1=1];
+  n3 -> n30 [w1=1];
+  n92 -> n30 [w1=1];
+  n48 -> n31 [w1=1];
+  n54 -> n31 [w1=1];
+  n65 -> n32 [w1=1];
+  n71 -> n32 [w1=1];
+  n9 -> n33 [w1=0];
+  n80 -> n33 [w1=1];
+  n14 -> n34 [w1=0];
+  n19 -> n34 [w1=1];
+  n98 -> n35 [w1=1];
+  n43 -> n35 [w1=1];
+  n1 -> n36 [w1=1];
+  n46 -> n36 [w1=1];
+  n52 -> n36 [w1=1];
+  n94 -> n37 [w1=1];
+  n85 -> n37 [w1=1];
+  n62 -> n38 [w1=1];
+  n83 -> n38 [w1=1];
+  n45 -> n39 [w1=0];
+  n64 -> n39 [w1=1];
+  n103 -> n40 [w1=1];
+  n91 -> n40 [w1=1];
+  n11 -> n41 [w1=1];
+  n72 -> n41 [w1=1];
+  n77 -> n41 [w1=1];
+  n86 -> n41 [w1=1];
+  n94 -> n42 [w1=1];
+  n95 -> n42 [w1=1];
+  n85 -> n42 [w1=1];
+  n99 -> n43 [w1=1];
+  n102 -> n43 [w1=1];
+  n50 -> n43 [w1=1];
+  n1 -> n44 [w1=1];
+  n59 -> n44 [w1=1];
+  n95 -> n44 [w1=1];
+  n93 -> n44 [w1=1];
+  n94 -> n45 [w1=1];
+  n44 -> n45 [w1=1];
+  n94 -> n46 [w1=1];
+  n95 -> n46 [w1=1];
+  n93 -> n46 [w1=1];
+  n39 -> n46 [w1=1];
+  n17 -> n47 [w1=0];
+  n21 -> n47 [w1=1];
+  n105 -> n48 [w1=1];
+  n96 -> n48 [w1=1];
+  n59 -> n49 [w1=1];
+  n94 -> n49 [w1=1];
+  n95 -> n49 [w1=1];
+  n92 -> n50 [w1=1];
+  n57 -> n50 [w1=1];
+  n30 -> n51 [w1=0];
+  n56 -> n51 [w1=1];
+  n26 -> n52 [w1=1];
+  n39 -> n52 [w1=1];
+  n93 -> n52 [w1=1];
+  n99 -> n53 [w1=1];
+  n50 -> n53 [w1=1];
+  n105 -> n54 [w1=1];
+  n96 -> n54 [w1=1];
+  n59 -> n55 [w1=1];
+  n26 -> n55 [w1=1];
+  n3 -> n56 [w1=1];
+  n92 -> n56 [w1=1];
+  n103 -> n57 [w1=1];
+  n22 -> n57 [w1=1];
+  n39 -> n58 [w1=1];
+  n90 -> n58 [w1=1];
+  n1 -> n59 [w1=0];
+  n32 -> n59 [w1=1];
+  n8 -> n60 [w1=1];
+  n26 -> n60 [w1=1];
+  n85 -> n60 [w1=1];
+  n104 -> n61 [w1=1];
+  n70 -> n61 [w1=1];
+  n1 -> n62 [w1=1];
+  n26 -> n62 [w1=1];
+  n93 -> n62 [w1=1];
+  n1 -> n63 [w1=0];
+  n26 -> n63 [w1=1];
+  n94 -> n63 [w1=1];
+  n95 -> n63 [w1=1];
+  n75 -> n64 [w1=1];
+  n82 -> n64 [w1=1];
+  n4 -> n65 [w1=1];
+  n59 -> n65 [w1=1];
+  n98 -> n66 [w1=1];
+  n39 -> n66 [w1=1];
+  n94 -> n67 [w1=1];
+  n87 -> n67 [w1=1];
+  n102 -> n68 [w1=1];
+  n15 -> n68 [w1=1];
+  n104 -> n69 [w1=1];
+  n70 -> n69 [w1=1];
+  n105 -> n70 [w1=1];
+  n96 -> n70 [w1=1];
+  n4 -> n71 [w1=1];
+  n59 -> n71 [w1=1];
+  n1 -> n72 [w1=1];
+  n26 -> n72 [w1=1];
+  n94 -> n72 [w1=1];
+  n39 -> n73 [w1=1];
+  n101 -> n73 [w1=1];
+  n73 -> n74 [w1=1];
+  n78 -> n74 [w1=1];
+  n1 -> n75 [w1=1];
+  n39 -> n75 [w1=1];
+  n26 -> n76 [w1=1];
+  n106 -> n76 [w1=1];
+  n1 -> n77 [w1=1];
+  n94 -> n77 [w1=1];
+  n95 -> n77 [w1=1];
+  n98 -> n78 [w1=1];
+  n101 -> n78 [w1=1];
+  n58 -> n79 [w1=1];
+  n66 -> n79 [w1=1];
+  n93 -> n80 [w1=1];
+  n42 -> n80 [w1=1];
+  n98 -> n81 [w1=1];
+  n43 -> n81 [w1=1];
+  n59 -> n82 [w1=1];
+  n26 -> n82 [w1=1];
+  n93 -> n82 [w1=1];
+  n89 -> n82 [w1=1];
+  n1 -> n83 [w1=1];
+  n59 -> n83 [w1=1];
+  n26 -> n83 [w1=1];
+  n93 -> n83 [w1=1];
+  n97 -> n84 [w1=1];
+  n100 -> n84 [w1=1];
+  n18 -> n85 [w1=1];
+  n50 -> n85 [w1=1];
+  n97 -> n85 [w1=1];
+  n1 -> n86 [w1=1];
+  n93 -> n86 [w1=1];
+  n1 -> n87 [w1=1];
+  n95 -> n87 [w1=1];
+  n93 -> n87 [w1=1];
+  n39 -> n87 [w1=1];
+  n59 -> n88 [w1=1];
+  n26 -> n88 [w1=1];
+  n94 -> n88 [w1=1];
+  n95 -> n88 [w1=1];
+  n94 -> n89 [w1=1];
+  n95 -> n89 [w1=1];
+  n24 -> n90 [w1=1];
+  n63 -> n90 [w1=1];
+  n104 -> n91 [w1=1];
+  n105 -> n91 [w1=1];
+  n96 -> n91 [w1=1];
+  n1 -> n92 [w1=1];
+  n51 -> n92 [w1=0];
+  n1 -> n93 [w1=0];
+  n33 -> n93 [w1=1];
+  n60 -> n93 [w1=1];
+  n1 -> n94 [w1=1];
+  n13 -> n94 [w1=1];
+  n60 -> n94 [w1=1];
+  n1 -> n95 [w1=1];
+  n34 -> n95 [w1=1];
+  n60 -> n95 [w1=1];
+  n1 -> n96 [w1=0];
+  n57 -> n96 [w1=1];
+  n96 -> n96 [w1=1];
+  n1 -> n97 [w1=1];
+  n84 -> n97 [w1=1];
+  n85 -> n97 [w1=1];
+  n1 -> n98 [w1=1];
+  n16 -> n98 [w1=1];
+  n85 -> n98 [w1=0];
+  n1 -> n99 [w1=1];
+  n25 -> n99 [w1=0];
+  n85 -> n99 [w1=1];
+  n99 -> n100 [w1=1];
+  n98 -> n100 [w1=1];
+  n102 -> n100 [w1=1];
+  n50 -> n100 [w1=1];
+  n20 -> n101 [w1=1];
+  n64 -> n101 [w1=1];
+  n1 -> n102 [w1=1];
+  n10 -> n102 [w1=0];
+  n85 -> n102 [w1=1];
+  n1 -> n103 [w1=1];
+  n40 -> n103 [w1=1];
+  n57 -> n103 [w1=0];
+  n1 -> n104 [w1=1];
+  n28 -> n104 [w1=1];
+  n57 -> n104 [w1=0];
+  n1 -> n105 [w1=1];
+  n31 -> n105 [w1=1];
+  n57 -> n105 [w1=1];
+  n94 -> n106 [w1=1];
+  n95 -> n106 [w1=1];
+  n93 -> n106 [w1=1];
+  n85 -> n106 [w1=1];
+  n47 -> n107 [w1=1];
+  n36 -> n108 [w1=1];
+  n5 -> n109 [w1=1];
+  n41 -> n110 [w1=1];
+  n6 -> n111 [w1=1];
+  n67 -> n112 [w1=1];
+}
=======================================
--- /dev/null
+++ /trunk/libs/graph/test/dimacs.cpp   Sun Aug  2 22:26:22 2009
@@ -0,0 +1,11 @@
+
+#include <boost/graph/read_dimacs.hpp>
+#include <boost/graph/write_dimacs.hpp>
+
+// This is obviously just a stub test. It's currently only used as a compile
+// check to make sure that the includes are appropriate.
+
+int main()
+{
+    return 0;
+}
=======================================
--- /dev/null
+++ /trunk/libs/graph/test/is_straight_line_draw_test.cpp Sun Aug 2 22:26:22 2009
@@ -0,0 +1,161 @@
+//=======================================================================
+// Copyright 2008 Aaron Windsor
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//=======================================================================
+
+#include <boost/property_map.hpp>
+#include <boost/test/minimal.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/properties.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/is_straight_line_drawing.hpp>
+
+#include <vector>
+
+using namespace boost;
+
+struct coord_t
+{
+  std::size_t x;
+  std::size_t y;
+};
+
+
+int test_main(int argc, char* argv [])
+{
+  typedef adjacency_list< vecS, vecS, undirectedS,
+                          property<vertex_index_t, int>
+                         > graph_t;
+
+  typedef std::vector< coord_t > drawing_storage_t;
+
+  typedef boost::iterator_property_map
+      < drawing_storage_t::iterator,
+        property_map<graph_t, vertex_index_t>::type
+       > drawing_t;
+
+  graph_t g(4);
+  add_edge(0,1,g);
+  add_edge(2,3,g);
+
+  drawing_storage_t drawing_storage(num_vertices(g));
+  drawing_t drawing(drawing_storage.begin(), get(vertex_index,g));
+
+  // two perpendicular lines that intersect at (1,1)
+  drawing[0].x = 1; drawing[0].y = 0;
+  drawing[1].x = 1; drawing[1].y = 2;
+  drawing[2].x = 0; drawing[2].y = 1;
+  drawing[3].x = 2; drawing[3].y = 1;
+
+  BOOST_REQUIRE(!is_straight_line_drawing(g,drawing));
+
+  // two parallel horizontal lines
+  drawing[0].x = 0; drawing[0].y = 0;
+  drawing[1].x = 2; drawing[1].y = 0;
+
+  BOOST_REQUIRE(is_straight_line_drawing(g,drawing));
+
+  // two parallel vertical lines
+  drawing[0].x = 0; drawing[0].y = 0;
+  drawing[1].x = 0; drawing[1].y = 2;
+  drawing[2].x = 1; drawing[2].y = 0;
+  drawing[3].x = 1; drawing[3].y = 2;
+
+  BOOST_REQUIRE(is_straight_line_drawing(g,drawing));
+
+  // two lines that intersect at (1,1)
+  drawing[0].x = 0; drawing[0].y = 0;
+  drawing[1].x = 2; drawing[1].y = 2;
+  drawing[2].x = 0; drawing[2].y = 2;
+  drawing[3].x = 2; drawing[3].y = 0;
+
+  BOOST_REQUIRE(!is_straight_line_drawing(g,drawing));
+
+  // K_4 arranged in a diamond pattern, so that edges intersect
+  g = graph_t(4);
+  add_edge(0,1,g);
+  add_edge(0,2,g);
+  add_edge(0,3,g);
+  add_edge(1,2,g);
+  add_edge(1,3,g);
+  add_edge(2,3,g);
+
+  drawing_storage = drawing_storage_t(num_vertices(g));
+  drawing = drawing_t(drawing_storage.begin(), get(vertex_index,g));
+
+  drawing[0].x = 1; drawing[0].y = 2;
+  drawing[1].x = 2; drawing[1].y = 1;
+  drawing[2].x = 1; drawing[2].y = 0;
+  drawing[3].x = 0; drawing[3].y = 1;
+
+  BOOST_REQUIRE(!is_straight_line_drawing(g, drawing));
+
+  // K_4 arranged so that no edges intersect
+  drawing[0].x = 0; drawing[0].y = 0;
+  drawing[1].x = 1; drawing[1].y = 1;
+  drawing[2].x = 1; drawing[2].y = 2;
+  drawing[3].x = 2; drawing[3].y = 0;
+
+  BOOST_REQUIRE(is_straight_line_drawing(g, drawing));
+
+  // a slightly more complicated example - edges (0,1) and (4,5)
+  // intersect
+  g = graph_t(8);
+  add_edge(0,1,g);
+  add_edge(2,3,g);
+  add_edge(4,5,g);
+  add_edge(6,7,g);
+
+  drawing_storage = drawing_storage_t(num_vertices(g));
+  drawing = drawing_t(drawing_storage.begin(), get(vertex_index,g));
+
+  drawing[0].x = 1; drawing[0].y = 1;
+  drawing[1].x = 5; drawing[1].y = 4;
+  drawing[2].x = 2; drawing[2].y = 5;
+  drawing[3].x = 4; drawing[3].y = 4;
+  drawing[4].x = 3; drawing[4].y = 4;
+  drawing[5].x = 3; drawing[5].y = 2;
+  drawing[6].x = 4; drawing[6].y = 2;
+  drawing[7].x = 1; drawing[7].y = 1;
+
+  BOOST_REQUIRE(!is_straight_line_drawing(g, drawing));
+
+  // form a graph consisting of a bunch of parallel vertical edges,
+  // then place an edge at various positions to intersect edges
+  g = graph_t(22);
+  for(int i = 0; i < 11; ++i)
+    add_edge(2*i,2*i+1,g);
+
+  drawing_storage = drawing_storage_t(num_vertices(g));
+  drawing = drawing_t(drawing_storage.begin(), get(vertex_index,g));
+
+  for(int i = 0; i < 10; ++i)
+    {
+      drawing[2*i].x = i; drawing[2*i].y = 0;
+      drawing[2*i+1].x = i; drawing[2*i+1].y = 10;
+    }
+
+  // put the final edge as a horizontal edge intersecting one other edge
+  drawing[20].x = 5; drawing[20].y = 5;
+  drawing[21].x = 7; drawing[21].y = 5;
+
+  BOOST_REQUIRE(!is_straight_line_drawing(g, drawing));
+
+  // make the final edge a diagonal intersecting multiple edges
+  drawing[20].x = 2; drawing[20].y = 4;
+  drawing[21].x = 9; drawing[21].y = 7;
+
+  BOOST_REQUIRE(!is_straight_line_drawing(g, drawing));
+
+  // reverse the slope
+  drawing[20].x = 2; drawing[20].y = 7;
+  drawing[21].x = 9; drawing[21].y = 4;
+
+  BOOST_REQUIRE(!is_straight_line_drawing(g, drawing));
+
+  return 0;
+}
+
=======================================
--- /dev/null
+++ /trunk/libs/graph/test/metric_tsp_approx.cpp        Sun Aug  2 22:26:22 2009
@@ -0,0 +1,324 @@
+//=======================================================================
+// Copyright 2008
+// Author: Matyas W Egyhazy
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//=======================================================================
+
+#include <iostream>
+#include <vector>
+#include <fstream>
+#include <set>
+#include <ctime>
+
+#include <boost/assert.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/random.hpp>
+#include <boost/timer.hpp>
+#include <boost/integer_traits.hpp>
+#include <boost/graph/adjacency_matrix.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/simple_point.hpp>
+#include <boost/graph/metric_tsp_approx.hpp>
+#include <boost/graph/graphviz.hpp>
+
+// TODO: Integrate this into the test system a little better. We need to run
+// the test with some kind of input file.
+
+template<typename PointType>
+struct cmpPnt
+{
+    bool operator()(const boost::simple_point<PointType>& l,
+                    const boost::simple_point<PointType>& r) const
+    { return (l.x > r.x); }
+};
+
+//add edges to the graph (for each node connect it to all other nodes)
+template<typename VertexListGraph, typename PointContainer,
+    typename WeightMap, typename VertexIndexMap>
+void connectAllEuclidean(VertexListGraph& g,
+                        const PointContainer& points,
+ WeightMap wmap, // Property maps passed by value + VertexIndexMap vmap, // Property maps passed by value
+                        int sz)
+{
+    using namespace boost;
+    using namespace std;
+    typedef typename graph_traits<VertexListGraph>::edge_descriptor Edge;
+    typedef typename graph_traits<VertexListGraph>::vertex_iterator VItr;
+
+    Edge e;
+    bool inserted;
+
+    pair<VItr, VItr> verts(vertices(g));
+    for (VItr src(verts.first); src != verts.second; src++)
+    {
+        for (VItr dest(src); dest != verts.second; dest++)
+        {
+            if (dest != src)
+            {
+                double weight(sqrt(pow(
+                    static_cast<double>(points[vmap[*src]].x -
+                        points[vmap[*dest]].x), 2.0) +
+                    pow(static_cast<double>(points[vmap[*dest]].y -
+                        points[vmap[*src]].y), 2.0)));
+
+                tie(e, inserted) = add_edge(*src, *dest, g);
+
+                wmap[e] = weight;
+            }
+
+        }
+
+    }
+}
+
+// Create a randomly generated point
+// scatter time execution
+void testScalability(unsigned numpts)
+{
+    using namespace boost;
+    using namespace std;
+
+    typedef adjacency_matrix<undirectedS, no_property,
+        property <edge_weight_t, double,
+        property<edge_index_t, int> > > Graph;
+    typedef graph_traits<Graph>::vertex_descriptor Vertex;
+    typedef graph_traits <Graph>::edge_descriptor Edge;
+    typedef property_map<Graph, edge_weight_t>::type WeightMap;
+    typedef set<simple_point<double>, cmpPnt<double> > PointSet;
+    typedef vector< Vertex > Container;
+
+    mt19937 rng(time(0));
+    uniform_int<> range(0.01, (numpts * 2));
+    variate_generator<mt19937&, uniform_int<> >
+        pnt_gen(rng, range);
+
+    PointSet points;
+    simple_point<double> pnt;
+
+    while (points.size() < numpts)
+    {
+        pnt.x = pnt_gen();
+        pnt.y = pnt_gen();
+        points.insert(pnt);
+    }
+
+    Graph g(numpts);
+    WeightMap weight_map(get(edge_weight, g));
+    vector<simple_point<double> > point_vec(points.begin(), points.end());
+
+ connectAllEuclidean(g, point_vec, weight_map, get(vertex_index, g), numpts);
+
+    Container c;
+    timer t;
+    double len = 0.0;
+
+    // Run the TSP approx, creating the visitor on the fly.
+ metric_tsp_approx(g, make_tsp_tour_len_visitor(g, back_inserter(c), len, weight_map));
+
+    cout << "Number of points: " << num_vertices(g) << endl;
+    cout << "Number of edges: " << num_edges(g) << endl;
+    cout << "Length of tour: " << len << endl;
+    cout << "Elapsed: " << t.elapsed() << endl;
+}
+
+template <typename PositionVec>
+void checkAdjList(PositionVec v)
+{
+    using namespace std;
+    using namespace boost;
+
+    typedef adjacency_list<listS, listS, undirectedS> Graph;
+    typedef graph_traits<Graph>::vertex_descriptor Vertex;
+    typedef graph_traits <Graph>::edge_descriptor Edge;
+    typedef vector<Vertex> Container;
+    typedef map<Vertex, std::size_t> VertexIndexMap;
+    typedef map<Edge, double> EdgeWeightMap;
+    typedef associative_property_map<VertexIndexMap> VPropertyMap;
+    typedef associative_property_map<EdgeWeightMap> EWeightPropertyMap;
+    typedef graph_traits<Graph>::vertex_iterator VItr;
+
+    Container c;
+    EdgeWeightMap w_map;
+    VertexIndexMap v_map;
+    VPropertyMap v_pmap(v_map);
+    EWeightPropertyMap w_pmap(w_map);
+
+    Graph g(v.size());
+
+    //create vertex index map
+    VItr vi, ve;
+    int idx(0);
+    for (tie(vi, ve) = vertices(g); vi != ve; ++vi)
+    {
+        Vertex v(*vi);
+        v_pmap[v] = idx;
+        idx++;
+    }
+
+    connectAllEuclidean(g, v, w_pmap,
+        v_pmap, v.size());
+
+    metric_tsp_approx_from_vertex(g,
+        *vertices(g).first,
+        w_pmap,
+        v_pmap,
+        tsp_tour_visitor<back_insert_iterator<Container > >
+        (back_inserter(c)));
+
+    cout << "adj_list" << endl;
+    for (Container::iterator itr = c.begin(); itr != c.end(); ++itr) {
+        cout << v_map[*itr] << " ";
+    }
+    cout << endl << endl;
+
+    c.clear();
+}
+
+static void usage()
+{
+    using namespace std;
+    cerr << "To run this program properly please place a "
+         << "file called graph.txt"
+         << endl << "into the current working directory." << endl
+         << "Each line of this file should be a coordinate specifying the"
+         << endl << "location of a vertex" << endl
+         << "For example: " << endl << "1,2" << endl << "20,4" << endl
+         << "15,7" << endl << endl;
+}
+
+int main(int argc, char* argv[])
+{
+   using namespace boost;
+   using namespace std;
+
+    typedef vector<simple_point<double> > PositionVec;
+    typedef adjacency_matrix<undirectedS, no_property,
+        property <edge_weight_t, double> > Graph;
+    typedef graph_traits<Graph>::vertex_descriptor Vertex;
+    typedef graph_traits <Graph>::edge_descriptor Edge;
+    typedef vector<Vertex> Container;
+    typedef property_map<Graph, edge_weight_t>::type WeightMap;
+    typedef property_map<Graph, vertex_index_t>::type VertexMap;
+
+    // Make sure that the the we can parse the given file.
+    if(argc < 2) {
+        usage();
+        // return -1;
+        return 0;
+    }
+
+    // Open the graph file, failing if one isn't given on the command line.
+    ifstream fin(argv[1]);
+    if (!fin)
+    {
+        usage();
+        // return -1;
+        return 0;
+    }
+
+   string line;
+   PositionVec position_vec;
+
+   int n(0);
+   while (getline(fin, line))
+   {
+       simple_point<double> vertex;
+
+       size_t idx(line.find(","));
+       string xStr(line.substr(0, idx));
+       string yStr(line.substr(idx + 1, line.size() - idx));
+
+       vertex.x = lexical_cast<double>(xStr);
+       vertex.y = lexical_cast<double>(yStr);
+
+       position_vec.push_back(vertex);
+       n++;
+   }
+
+   fin.close();
+
+   Container c;
+   Graph g(position_vec.size());
+   WeightMap weight_map(get(edge_weight, g));
+   VertexMap v_map = get(vertex_index, g);
+
+   connectAllEuclidean(g, position_vec, weight_map, v_map, n);
+
+   metric_tsp_approx_tour(g, back_inserter(c));
+
+   for (vector<Vertex>::iterator itr = c.begin(); itr != c.end(); ++itr)
+   {
+       cout << *itr << " ";
+   }
+   cout << endl << endl;
+
+   c.clear();
+
+   checkAdjList(position_vec);
+
+   metric_tsp_approx_from_vertex(g, *vertices(g).first,
+       get(edge_weight, g), get(vertex_index, g),
+       tsp_tour_visitor<back_insert_iterator<vector<Vertex> > >
+       (back_inserter(c)));
+
+   for (vector<Vertex>::iterator itr = c.begin(); itr != c.end(); ++itr)
+   {
+       cout << *itr << " ";
+   }
+   cout << endl << endl;
+
+   c.clear();
+
+   double len(0.0);
+   try {
+ metric_tsp_approx(g, make_tsp_tour_len_visitor(g, back_inserter(c), len, weight_map));
+   }
+   catch (const bad_graph& e) {
+       cerr << "bad_graph: " << e.what() << endl;
+       return -1;
+   }
+
+   cout << "Number of points: " << num_vertices(g) << endl;
+   cout << "Number of edges: " << num_edges(g) << endl;
+   cout << "Length of Tour: " << len << endl;
+
+   int cnt(0);
+   pair<Vertex,Vertex> triangleEdge;
+   for (vector<Vertex>::iterator itr = c.begin(); itr != c.end();
+       ++itr, ++cnt)
+   {
+       cout << *itr << " ";
+
+       if (cnt == 2)
+       {
+           triangleEdge.first = *itr;
+       }
+       if (cnt == 3)
+       {
+           triangleEdge.second = *itr;
+       }
+   }
+   cout << endl << endl;
+   c.clear();
+
+   testScalability(1000);
+
+   // if the graph is not fully connected then some of the
+   // assumed triangle-inequality edges may not exist
+   remove_edge(edge(triangleEdge.first, triangleEdge.second, g).first, g);
+
+    // Make sure that we can actually trap incomplete graphs.
+    bool caught = false;
+    try {
+        double len = 0.0;
+ metric_tsp_approx(g, make_tsp_tour_len_visitor(g, back_inserter(c), len, weight_map));
+    }
+    catch (const bad_graph& e) { caught = true; }
+    BOOST_ASSERT(caught);
+
+   return 0;
+}
=======================================
--- /dev/null
+++ /trunk/libs/graph/test/metric_tsp_approx.txt        Sun Aug  2 22:26:22 2009
@@ -0,0 +1,8 @@
+2,5
+2,3
+1,2
+4,5
+5,4
+4,3
+6,3
+3,1
=======================================
--- /dev/null
+++ /trunk/libs/graph/test/named_vertices_test.cpp      Sun Aug  2 22:26:22 2009
@@ -0,0 +1,91 @@
+// Copyright (C) 2007-2008 The Trustees of Indiana University.
+
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Test support for named vertices in adjacency_list.
+#include <boost/config.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/test/minimal.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/iteration_macros.hpp>
+#include <string>
+#include <iostream>
+
+#ifdef BOOST_NO_EXCEPTIONS
+void
+boost::throw_exception(std::exception const& ex)
+{
+    std::cout << ex.what() << std::endl;
+    abort();
+}
+#endif
+
+using namespace boost;
+
+/// City structure to be attached to each vertex
+struct City {
+  City() {}
+
+  City(const std::string& name, int population = -1)
+    : name(name), population(population) { }
+
+  std::string name;
+  int population;
+};
+
+namespace boost { namespace graph {
+
+/// Use the City name as a key for indexing cities in a graph
+template<>
+struct internal_vertex_name<City>
+{
+  typedef multi_index::member<City, std::string, &City::name> type;
+};
+
+/// Allow the graph to build cities given only their names (filling in
+/// the defaults for fields).
+template<>
+struct internal_vertex_constructor<City>
+{
+  typedef vertex_from_name<City> type;
+};
+
+} } // end namespace boost::graph
+
+/// Our road map, where each of the vertices are cities
+typedef adjacency_list<vecS, vecS, directedS, City> RoadMap;
+typedef graph_traits<RoadMap>::vertex_descriptor Vertex;
+
+int test_main(int argc, char* argv[])
+{
+  RoadMap map;
+
+  /// Create vertices for Bloomington, Indianapolis, Chicago
+  Vertex bloomington = add_vertex(City("Bloomington", 69291), map);
+  Vertex indianapolis = add_vertex(City("Indianapolis", 791926), map);
+  Vertex chicago = add_vertex(City("Chicago", 9500000), map);
+
+  BOOST_CHECK(add_vertex(City("Bloomington", 69291), map) == bloomington);
+
+  BGL_FORALL_VERTICES(city, map, RoadMap)
+    std::cout << map[city].name << ", population " << map[city].population
+              << std::endl;
+
+  BOOST_CHECK(*find_vertex("Bloomington", map) == bloomington);
+  BOOST_CHECK(*find_vertex("Indianapolis", map) == indianapolis);
+  BOOST_CHECK(*find_vertex("Chicago", map) == chicago);
+
+  add_edge(bloomington, "Indianapolis", map);
+  add_edge("Indianapolis", chicago, map);
+  add_edge("Indianapolis", "Cincinnatti", map);
+
+  BGL_FORALL_EDGES(road, map, RoadMap)
+    std::cout << map[source(road, map)].name << " -> "
+              << map[target(road, map)].name << std::endl;
+
+  BOOST_CHECK(map[*find_vertex("Cincinnatti", map)].population == -1);
+
+  return 0;
+}
=======================================
--- /dev/null
+++ /trunk/libs/graph/test/r_c_shortest_paths_test.cpp Sun Aug 2 22:26:22 2009
@@ -0,0 +1,641 @@
+// Copyright Michael Drexl 2005, 2006.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_MSVC
+#  pragma warning(disable: 4267)
+#endif
+
+#include <boost/graph/adjacency_list.hpp>
+//#include <boost/graph/dijkstra_shortest_paths.hpp>
+
+#include <boost/graph/r_c_shortest_paths.hpp>
+#include <iostream>
+#include <boost/test/minimal.hpp>
+
+using namespace boost;
+
+struct SPPRC_Example_Graph_Vert_Prop
+{
+  SPPRC_Example_Graph_Vert_Prop( int n = 0, int e = 0, int l = 0 )
+  : num( n ), eat( e ), lat( l ) {}
+  int num;
+  // earliest arrival time
+  int eat;
+  // latest arrival time
+  int lat;
+};
+
+struct SPPRC_Example_Graph_Arc_Prop
+{
+  SPPRC_Example_Graph_Arc_Prop( int n = 0, int c = 0, int t = 0 )
+  : num( n ), cost( c ), time( t ) {}
+  int num;
+  // traversal cost
+  int cost;
+  // traversal time
+  int time;
+};
+
+typedef adjacency_list<vecS,
+                       vecS,
+                       directedS,
+                       SPPRC_Example_Graph_Vert_Prop,
+                       SPPRC_Example_Graph_Arc_Prop>
+  SPPRC_Example_Graph;
+
+// data structures for spp without resource constraints:
+// ResourceContainer model
+struct spp_no_rc_res_cont
+{
+  spp_no_rc_res_cont( int c = 0 ) : cost( c ) {};
+  spp_no_rc_res_cont& operator=( const spp_no_rc_res_cont& other )
+  {
+    if( this == &other )
+      return *this;
+    this->~spp_no_rc_res_cont();
+    new( this ) spp_no_rc_res_cont( other );
+    return *this;
+  }
+  int cost;
+};
+
+bool operator==( const spp_no_rc_res_cont& res_cont_1,
+                 const spp_no_rc_res_cont& res_cont_2 )
+{
+  return ( res_cont_1.cost == res_cont_2.cost );
+}
+
+bool operator<( const spp_no_rc_res_cont& res_cont_1,
+                const spp_no_rc_res_cont& res_cont_2 )
+{
+  return ( res_cont_1.cost < res_cont_2.cost );
+}
+
+// ResourceExtensionFunction model
+class ref_no_res_cont
+{
+public:
+  inline bool operator()( const SPPRC_Example_Graph& g,
+                          spp_no_rc_res_cont& new_cont,
+                          const spp_no_rc_res_cont& old_cont,
+                          graph_traits
+ <SPPRC_Example_Graph>::edge_descriptor ed ) const
+  {
+    new_cont.cost = old_cont.cost + g[ed].cost;
+    return true;
+  }
+};
+
+// DominanceFunction model
+class dominance_no_res_cont
+{
+public:
+  inline bool operator()( const spp_no_rc_res_cont& res_cont_1,
+                          const spp_no_rc_res_cont& res_cont_2 ) const
+  {
+    // must be "<=" here!!!
+    // must NOT be "<"!!!
+    return res_cont_1.cost <= res_cont_2.cost;
+    // this is not a contradiction to the documentation
+    // the documentation says:
+ // "A label $l_1$ dominates a label $l_2$ if and only if both are resident + // at the same vertex, and if, for each resource, the resource consumption
+    // of $l_1$ is less than or equal to the resource consumption of $l_2$,
+ // and if there is at least one resource where $l_1$ has a lower resource
+    // consumption than $l_2$."
+ // one can think of a new label with a resource consumption equal to that + // of an old label as being dominated by that old label, because the new + // one will have a higher number and is created at a later point in time, + // so one can implicitly use the number or the creation time as a resource
+    // for tie-breaking
+  }
+};
+// end data structures for spp without resource constraints:
+
+// data structures for shortest path problem with time windows (spptw)
+// ResourceContainer model
+struct spp_spptw_res_cont
+{
+  spp_spptw_res_cont( int c = 0, int t = 0 ) : cost( c ), time( t ) {}
+  spp_spptw_res_cont& operator=( const spp_spptw_res_cont& other )
+  {
+    if( this == &other )
+      return *this;
+    this->~spp_spptw_res_cont();
+    new( this ) spp_spptw_res_cont( other );
+    return *this;
+  }
+  int cost;
+  int time;
+};
+
+bool operator==( const spp_spptw_res_cont& res_cont_1,
+                 const spp_spptw_res_cont& res_cont_2 )
+{
+  return ( res_cont_1.cost == res_cont_2.cost
+           && res_cont_1.time == res_cont_2.time );
+}
+
+bool operator<( const spp_spptw_res_cont& res_cont_1,
+                const spp_spptw_res_cont& res_cont_2 )
+{
+  if( res_cont_1.cost > res_cont_2.cost )
+    return false;
+  if( res_cont_1.cost == res_cont_2.cost )
+    return res_cont_1.time < res_cont_2.time;
+  return true;
+}
+
+// ResourceExtensionFunction model
+class ref_spptw
+{
+public:
+  inline bool operator()( const SPPRC_Example_Graph& g,
+                          spp_spptw_res_cont& new_cont,
+                          const spp_spptw_res_cont& old_cont,
+                          graph_traits
+ <SPPRC_Example_Graph>::edge_descriptor ed ) const
+  {
+    const SPPRC_Example_Graph_Arc_Prop& arc_prop =
+      get( edge_bundle, g )[ed];
+    const SPPRC_Example_Graph_Vert_Prop& vert_prop =
+      get( vertex_bundle, g )[target( ed, g )];
+    new_cont.cost = old_cont.cost + arc_prop.cost;
+    int& i_time = new_cont.time;
+    i_time = old_cont.time + arc_prop.time;
+    i_time < vert_prop.eat ? i_time = vert_prop.eat : 0;
+    return i_time <= vert_prop.lat ? true : false;
+  }
+};
+
+// DominanceFunction model
+class dominance_spptw
+{
+public:
+  inline bool operator()( const spp_spptw_res_cont& res_cont_1,
+                          const spp_spptw_res_cont& res_cont_2 ) const
+  {
+    // must be "<=" here!!!
+    // must NOT be "<"!!!
+    return res_cont_1.cost <= res_cont_2.cost
+           && res_cont_1.time <= res_cont_2.time;
+    // this is not a contradiction to the documentation
+    // the documentation says:
+ // "A label $l_1$ dominates a label $l_2$ if and only if both are resident + // at the same vertex, and if, for each resource, the resource consumption
+    // of $l_1$ is less than or equal to the resource consumption of $l_2$,
+ // and if there is at least one resource where $l_1$ has a lower resource
+    // consumption than $l_2$."
+ // one can think of a new label with a resource consumption equal to that + // of an old label as being dominated by that old label, because the new + // one will have a higher number and is created at a later point in time, + // so one can implicitly use the number or the creation time as a resource
+    // for tie-breaking
+  }
+};
+// end data structures for shortest path problem with time windows (spptw)
+
+int test_main(int argc, char* argv[])
+{
+  SPPRC_Example_Graph g;
+  add_vertex( SPPRC_Example_Graph_Vert_Prop( 0, 0, 1000000000 ), g );
+  add_vertex( SPPRC_Example_Graph_Vert_Prop( 1, 56, 142 ), g );
+  add_vertex( SPPRC_Example_Graph_Vert_Prop( 2, 0, 1000000000 ), g );
+  add_vertex( SPPRC_Example_Graph_Vert_Prop( 3, 89, 178 ), g );
+  add_vertex( SPPRC_Example_Graph_Vert_Prop( 4, 0, 1000000000 ), g );
+  add_vertex( SPPRC_Example_Graph_Vert_Prop( 5, 49, 76 ), g );
+  add_vertex( SPPRC_Example_Graph_Vert_Prop( 6, 0, 1000000000 ), g );
+  add_vertex( SPPRC_Example_Graph_Vert_Prop( 7, 98, 160 ), g );
+  add_vertex( SPPRC_Example_Graph_Vert_Prop( 8, 0, 1000000000 ), g );
+  add_vertex( SPPRC_Example_Graph_Vert_Prop( 9, 90, 158 ), g );
+  add_edge( 0, 7, SPPRC_Example_Graph_Arc_Prop( 6, 33, 2 ), g );
+  add_edge( 0, 6, SPPRC_Example_Graph_Arc_Prop( 5, 31, 6 ), g );
+  add_edge( 0, 4, SPPRC_Example_Graph_Arc_Prop( 3, 14, 4 ), g );
+  add_edge( 0, 1, SPPRC_Example_Graph_Arc_Prop( 0, 43, 8 ), g );
+  add_edge( 0, 4, SPPRC_Example_Graph_Arc_Prop( 4, 28, 10 ), g );
+  add_edge( 0, 3, SPPRC_Example_Graph_Arc_Prop( 1, 31, 10 ), g );
+  add_edge( 0, 3, SPPRC_Example_Graph_Arc_Prop( 2, 1, 7 ), g );
+  add_edge( 0, 9, SPPRC_Example_Graph_Arc_Prop( 7, 25, 9 ), g );
+  add_edge( 1, 0, SPPRC_Example_Graph_Arc_Prop( 8, 37, 4 ), g );
+  add_edge( 1, 6, SPPRC_Example_Graph_Arc_Prop( 9, 7, 3 ), g );
+  add_edge( 2, 6, SPPRC_Example_Graph_Arc_Prop( 12, 6, 7 ), g );
+  add_edge( 2, 3, SPPRC_Example_Graph_Arc_Prop( 10, 13, 7 ), g );
+  add_edge( 2, 3, SPPRC_Example_Graph_Arc_Prop( 11, 49, 9 ), g );
+  add_edge( 2, 8, SPPRC_Example_Graph_Arc_Prop( 13, 47, 5 ), g );
+  add_edge( 3, 4, SPPRC_Example_Graph_Arc_Prop( 17, 5, 10 ), g );
+  add_edge( 3, 1, SPPRC_Example_Graph_Arc_Prop( 15, 47, 1 ), g );
+  add_edge( 3, 2, SPPRC_Example_Graph_Arc_Prop( 16, 26, 9 ), g );
+  add_edge( 3, 9, SPPRC_Example_Graph_Arc_Prop( 21, 24, 10 ), g );
+  add_edge( 3, 7, SPPRC_Example_Graph_Arc_Prop( 20, 50, 10 ), g );
+  add_edge( 3, 0, SPPRC_Example_Graph_Arc_Prop( 14, 41, 4 ), g );
+  add_edge( 3, 6, SPPRC_Example_Graph_Arc_Prop( 19, 6, 1 ), g );
+  add_edge( 3, 4, SPPRC_Example_Graph_Arc_Prop( 18, 8, 1 ), g );
+  add_edge( 4, 5, SPPRC_Example_Graph_Arc_Prop( 26, 38, 4 ), g );
+  add_edge( 4, 9, SPPRC_Example_Graph_Arc_Prop( 27, 32, 10 ), g );
+  add_edge( 4, 3, SPPRC_Example_Graph_Arc_Prop( 24, 40, 3 ), g );
+  add_edge( 4, 0, SPPRC_Example_Graph_Arc_Prop( 22, 7, 3 ), g );
+  add_edge( 4, 3, SPPRC_Example_Graph_Arc_Prop( 25, 28, 9 ), g );
+  add_edge( 4, 2, SPPRC_Example_Graph_Arc_Prop( 23, 39, 6 ), g );
+  add_edge( 5, 8, SPPRC_Example_Graph_Arc_Prop( 32, 6, 2 ), g );
+  add_edge( 5, 2, SPPRC_Example_Graph_Arc_Prop( 30, 26, 10 ), g );
+  add_edge( 5, 0, SPPRC_Example_Graph_Arc_Prop( 28, 38, 9 ), g );
+  add_edge( 5, 2, SPPRC_Example_Graph_Arc_Prop( 31, 48, 10 ), g );
+  add_edge( 5, 9, SPPRC_Example_Graph_Arc_Prop( 33, 49, 2 ), g );
+  add_edge( 5, 1, SPPRC_Example_Graph_Arc_Prop( 29, 22, 7 ), g );
+  add_edge( 6, 1, SPPRC_Example_Graph_Arc_Prop( 34, 15, 7 ), g );
+  add_edge( 6, 7, SPPRC_Example_Graph_Arc_Prop( 35, 20, 3 ), g );
+  add_edge( 7, 9, SPPRC_Example_Graph_Arc_Prop( 40, 1, 3 ), g );
+  add_edge( 7, 0, SPPRC_Example_Graph_Arc_Prop( 36, 23, 5 ), g );
+  add_edge( 7, 6, SPPRC_Example_Graph_Arc_Prop( 38, 36, 2 ), g );
+  add_edge( 7, 6, SPPRC_Example_Graph_Arc_Prop( 39, 18, 10 ), g );
+  add_edge( 7, 2, SPPRC_Example_Graph_Arc_Prop( 37, 2, 1 ), g );
+  add_edge( 8, 5, SPPRC_Example_Graph_Arc_Prop( 46, 36, 5 ), g );
+  add_edge( 8, 1, SPPRC_Example_Graph_Arc_Prop( 42, 13, 10 ), g );
+  add_edge( 8, 0, SPPRC_Example_Graph_Arc_Prop( 41, 40, 5 ), g );
+  add_edge( 8, 1, SPPRC_Example_Graph_Arc_Prop( 43, 32, 8 ), g );
+  add_edge( 8, 6, SPPRC_Example_Graph_Arc_Prop( 47, 25, 1 ), g );
+  add_edge( 8, 2, SPPRC_Example_Graph_Arc_Prop( 44, 44, 3 ), g );
+  add_edge( 8, 3, SPPRC_Example_Graph_Arc_Prop( 45, 11, 9 ), g );
+  add_edge( 9, 0, SPPRC_Example_Graph_Arc_Prop( 48, 41, 5 ), g );
+  add_edge( 9, 1, SPPRC_Example_Graph_Arc_Prop( 49, 44, 7 ), g );
+
+  // spp without resource constraints
+
+  std::vector
+    <std::vector
+      <graph_traits<SPPRC_Example_Graph>::edge_descriptor> >
+        opt_solutions;
+  std::vector<spp_no_rc_res_cont> pareto_opt_rcs_no_rc;
+  std::vector<int> i_vec_opt_solutions_spp_no_rc;
+  //std::cout << "r_c_shortest_paths:" << std::endl;
+  for( int s = 0; s < 10; ++s )
+  {
+    for( int t = 0; t < 10; ++t )
+    {
+      r_c_shortest_paths
+      ( g,
+        get( &SPPRC_Example_Graph_Vert_Prop::num, g ),
+        get( &SPPRC_Example_Graph_Arc_Prop::num, g ),
+        s,
+        t,
+        opt_solutions,
+        pareto_opt_rcs_no_rc,
+        spp_no_rc_res_cont( 0 ),
+        ref_no_res_cont(),
+        dominance_no_res_cont(),
+        std::allocator
+          <r_c_shortest_paths_label
+            <SPPRC_Example_Graph, spp_no_rc_res_cont> >(),
+        default_r_c_shortest_paths_visitor() );
+ i_vec_opt_solutions_spp_no_rc.push_back( pareto_opt_rcs_no_rc[0].cost );
+      //std::cout << "From " << s << " to " << t << ": ";
+      //std::cout << pareto_opt_rcs_no_rc[0].cost << std::endl;
+    }
+  }
+
+  //std::vector<graph_traits<SPPRC_Example_Graph>::vertex_descriptor>
+  //  p( num_vertices( g ) );
+  //std::vector<int> d( num_vertices( g ) );
+  //std::vector<int> i_vec_dijkstra_distances;
+  //std::cout << "Dijkstra:" << std::endl;
+  //for( int s = 0; s < 10; ++s )
+  //{
+  //  dijkstra_shortest_paths( g,
+  //                           s,
+  //                           &p[0],
+  //                           &d[0],
+ // get( &SPPRC_Example_Graph_Arc_Prop::cost, g ), + // get( &SPPRC_Example_Graph_Vert_Prop::num, g ),
+  //                           std::less<int>(),
+  //                           closed_plus<int>(),
+  //                           (std::numeric_limits<int>::max)(),
+  //                           0,
+  //                           default_dijkstra_visitor() );
+  //  for( int t = 0; t < 10; ++t )
+  //  {
+  //    i_vec_dijkstra_distances.push_back( d[t] );
+ // std::cout << "From " << s << " to " << t << ": " << d[t] << std::endl;
+  //  }
+  //}
+
+  std::vector<int> i_vec_correct_solutions;
+  i_vec_correct_solutions.push_back( 0 );
+  i_vec_correct_solutions.push_back( 22 );
+  i_vec_correct_solutions.push_back( 27 );
+  i_vec_correct_solutions.push_back( 1 );
+  i_vec_correct_solutions.push_back( 6 );
+  i_vec_correct_solutions.push_back( 44 );
+  i_vec_correct_solutions.push_back( 7 );
+  i_vec_correct_solutions.push_back( 27 );
+  i_vec_correct_solutions.push_back( 50 );
+  i_vec_correct_solutions.push_back( 25 );
+  i_vec_correct_solutions.push_back( 37 );
+  i_vec_correct_solutions.push_back( 0 );
+  i_vec_correct_solutions.push_back( 29 );
+  i_vec_correct_solutions.push_back( 38 );
+  i_vec_correct_solutions.push_back( 43 );
+  i_vec_correct_solutions.push_back( 81 );
+  i_vec_correct_solutions.push_back( 7 );
+  i_vec_correct_solutions.push_back( 27 );
+  i_vec_correct_solutions.push_back( 76 );
+  i_vec_correct_solutions.push_back( 28 );
+  i_vec_correct_solutions.push_back( 25 );
+  i_vec_correct_solutions.push_back( 21 );
+  i_vec_correct_solutions.push_back( 0 );
+  i_vec_correct_solutions.push_back( 13 );
+  i_vec_correct_solutions.push_back( 18 );
+  i_vec_correct_solutions.push_back( 56 );
+  i_vec_correct_solutions.push_back( 6 );
+  i_vec_correct_solutions.push_back( 26 );
+  i_vec_correct_solutions.push_back( 47 );
+  i_vec_correct_solutions.push_back( 27 );
+  i_vec_correct_solutions.push_back( 12 );
+  i_vec_correct_solutions.push_back( 21 );
+  i_vec_correct_solutions.push_back( 26 );
+  i_vec_correct_solutions.push_back( 0 );
+  i_vec_correct_solutions.push_back( 5 );
+  i_vec_correct_solutions.push_back( 43 );
+  i_vec_correct_solutions.push_back( 6 );
+  i_vec_correct_solutions.push_back( 26 );
+  i_vec_correct_solutions.push_back( 49 );
+  i_vec_correct_solutions.push_back( 24 );
+  i_vec_correct_solutions.push_back( 7 );
+  i_vec_correct_solutions.push_back( 29 );
+  i_vec_correct_solutions.push_back( 34 );
+  i_vec_correct_solutions.push_back( 8 );
+  i_vec_correct_solutions.push_back( 0 );
+  i_vec_correct_solutions.push_back( 38 );
+  i_vec_correct_solutions.push_back( 14 );
+  i_vec_correct_solutions.push_back( 34 );
+  i_vec_correct_solutions.push_back( 44 );
+  i_vec_correct_solutions.push_back( 32 );
+  i_vec_correct_solutions.push_back( 29 );
+  i_vec_correct_solutions.push_back( 19 );
+  i_vec_correct_solutions.push_back( 26 );
+  i_vec_correct_solutions.push_back( 17 );
+  i_vec_correct_solutions.push_back( 22 );
+  i_vec_correct_solutions.push_back( 0 );
+  i_vec_correct_solutions.push_back( 23 );
+  i_vec_correct_solutions.push_back( 43 );
+  i_vec_correct_solutions.push_back( 6 );
+  i_vec_correct_solutions.push_back( 41 );
+  i_vec_correct_solutions.push_back( 43 );
+  i_vec_correct_solutions.push_back( 15 );
+  i_vec_correct_solutions.push_back( 22 );
+  i_vec_correct_solutions.push_back( 35 );
+  i_vec_correct_solutions.push_back( 40 );
+  i_vec_correct_solutions.push_back( 78 );
+  i_vec_correct_solutions.push_back( 0 );
+  i_vec_correct_solutions.push_back( 20 );
+  i_vec_correct_solutions.push_back( 69 );
+  i_vec_correct_solutions.push_back( 21 );
+  i_vec_correct_solutions.push_back( 23 );
+  i_vec_correct_solutions.push_back( 23 );
+  i_vec_correct_solutions.push_back( 2 );
+  i_vec_correct_solutions.push_back( 15 );
+  i_vec_correct_solutions.push_back( 20 );
+  i_vec_correct_solutions.push_back( 58 );
+  i_vec_correct_solutions.push_back( 8 );
+  i_vec_correct_solutions.push_back( 0 );
+  i_vec_correct_solutions.push_back( 49 );
+  i_vec_correct_solutions.push_back( 1 );
+  i_vec_correct_solutions.push_back( 23 );
+  i_vec_correct_solutions.push_back( 13 );
+  i_vec_correct_solutions.push_back( 37 );
+  i_vec_correct_solutions.push_back( 11 );
+  i_vec_correct_solutions.push_back( 16 );
+  i_vec_correct_solutions.push_back( 36 );
+  i_vec_correct_solutions.push_back( 17 );
+  i_vec_correct_solutions.push_back( 37 );
+  i_vec_correct_solutions.push_back( 0 );
+  i_vec_correct_solutions.push_back( 35 );
+  i_vec_correct_solutions.push_back( 41 );
+  i_vec_correct_solutions.push_back( 44 );
+  i_vec_correct_solutions.push_back( 68 );
+  i_vec_correct_solutions.push_back( 42 );
+  i_vec_correct_solutions.push_back( 47 );
+  i_vec_correct_solutions.push_back( 85 );
+  i_vec_correct_solutions.push_back( 48 );
+  i_vec_correct_solutions.push_back( 68 );
+  i_vec_correct_solutions.push_back( 91 );
+  i_vec_correct_solutions.push_back( 0 );
+ BOOST_CHECK(i_vec_opt_solutions_spp_no_rc.size() == i_vec_correct_solutions.size() ); + for( int i = 0; i < static_cast<int>( i_vec_correct_solutions.size() ); ++i ) + BOOST_CHECK( i_vec_opt_solutions_spp_no_rc[i] == i_vec_correct_solutions[i] );
+
+  // spptw
+  std::vector
+    <std::vector
+      <graph_traits<SPPRC_Example_Graph>::edge_descriptor> >
+        opt_solutions_spptw;
+  std::vector<spp_spptw_res_cont> pareto_opt_rcs_spptw;
+  std::vector
+    <std::vector
+      <std::vector
+        <std::vector
+          <graph_traits<SPPRC_Example_Graph>::edge_descriptor> > > >
+            vec_vec_vec_vec_opt_solutions_spptw( 10 );
+
+  for( int s = 0; s < 10; ++s )
+  {
+    for( int t = 0; t < 10; ++t )
+    {
+      r_c_shortest_paths
+      ( g,
+        get( &SPPRC_Example_Graph_Vert_Prop::num, g ),
+        get( &SPPRC_Example_Graph_Arc_Prop::num, g ),
+        s,
+        t,
+        opt_solutions_spptw,
+        pareto_opt_rcs_spptw,
+        // be careful, do not simply take 0 as initial value for time
+        spp_spptw_res_cont( 0, g[s].eat ),
+        ref_spptw(),
+        dominance_spptw(),
+        std::allocator
+          <r_c_shortest_paths_label
+            <SPPRC_Example_Graph, spp_spptw_res_cont> >(),
+        default_r_c_shortest_paths_visitor() );
+ vec_vec_vec_vec_opt_solutions_spptw[s].push_back( opt_solutions_spptw );
+      if( opt_solutions_spptw.size() )
+      {
+        bool b_is_a_path_at_all = false;
+        bool b_feasible = false;
+        bool b_correctly_extended = false;
+        spp_spptw_res_cont actual_final_resource_levels( 0, 0 );
+ graph_traits<SPPRC_Example_Graph>::edge_descriptor ed_last_extended_arc;
+        check_r_c_path( g,
+                        opt_solutions_spptw[0],
+                        spp_spptw_res_cont( 0, g[s].eat ),
+                        true,
+                        pareto_opt_rcs_spptw[0],
+                        actual_final_resource_levels,
+                        ref_spptw(),
+                        b_is_a_path_at_all,
+                        b_feasible,
+                        b_correctly_extended,
+                        ed_last_extended_arc );
+ BOOST_CHECK(b_is_a_path_at_all && b_feasible && b_correctly_extended);
+        b_is_a_path_at_all = false;
+        b_feasible = false;
+        b_correctly_extended = false;
+        spp_spptw_res_cont actual_final_resource_levels2( 0, 0 );
+ graph_traits<SPPRC_Example_Graph>::edge_descriptor ed_last_extended_arc2;
+        check_r_c_path( g,
+                        opt_solutions_spptw[0],
+                        spp_spptw_res_cont( 0, g[s].eat ),
+                        false,
+                        pareto_opt_rcs_spptw[0],
+                        actual_final_resource_levels2,
+                        ref_spptw(),
+                        b_is_a_path_at_all,
+                        b_feasible,
+                        b_correctly_extended,
+                        ed_last_extended_arc2 );
+ BOOST_CHECK(b_is_a_path_at_all && b_feasible && b_correctly_extended);
+      }
+    }
+  }
+
+  std::vector<int> i_vec_correct_num_solutions_spptw;
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 3 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 3 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 4 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 3 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 4 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 4 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 3 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 0 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 4 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 4 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 4 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 4 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 5 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 3 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 0 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 3 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 3 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 3 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 4 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  i_vec_correct_num_solutions_spptw.push_back( 3 );
+  i_vec_correct_num_solutions_spptw.push_back( 0 );
+  i_vec_correct_num_solutions_spptw.push_back( 2 );
+  i_vec_correct_num_solutions_spptw.push_back( 3 );
+  i_vec_correct_num_solutions_spptw.push_back( 4 );
+  i_vec_correct_num_solutions_spptw.push_back( 1 );
+  for( int s = 0; s < 10; ++s )
+    for( int t = 0; t < 10; ++t )
+      BOOST_CHECK( static_cast<int>
+            ( vec_vec_vec_vec_opt_solutions_spptw[s][t].size() ) ==
+                   i_vec_correct_num_solutions_spptw[10 * s + t] );
+
+  // one pareto-optimal solution
+  SPPRC_Example_Graph g2;
+  add_vertex( SPPRC_Example_Graph_Vert_Prop( 0, 0, 1000000000 ), g2 );
+  add_vertex( SPPRC_Example_Graph_Vert_Prop( 1, 0, 1000000000 ), g2 );
+  add_vertex( SPPRC_Example_Graph_Vert_Prop( 2, 0, 1000000000 ), g2 );
+  add_vertex( SPPRC_Example_Graph_Vert_Prop( 3, 0, 1000000000 ), g2 );
+  add_edge( 0, 1, SPPRC_Example_Graph_Arc_Prop( 0, 1, 1 ), g2 );
+  add_edge( 0, 2, SPPRC_Example_Graph_Arc_Prop( 1, 2, 1 ), g2 );
+  add_edge( 1, 3, SPPRC_Example_Graph_Arc_Prop( 2, 3, 1 ), g2 );
+  add_edge( 2, 3, SPPRC_Example_Graph_Arc_Prop( 3, 1, 1 ), g2 );
+ std::vector<graph_traits<SPPRC_Example_Graph>::edge_descriptor> opt_solution;
+  spp_spptw_res_cont pareto_opt_rc;
+  r_c_shortest_paths( g2,
+                      get( &SPPRC_Example_Graph_Vert_Prop::num, g2 ),
+                      get( &SPPRC_Example_Graph_Arc_Prop::num, g2 ),
+                      0,
+                      3,
+                      opt_solution,
+                      pareto_opt_rc,
+                      spp_spptw_res_cont( 0, 0 ),
+                      ref_spptw(),
+                      dominance_spptw(),
+                      std::allocator
+                        <r_c_shortest_paths_label
+                          <SPPRC_Example_Graph, spp_spptw_res_cont> >(),
+                      default_r_c_shortest_paths_visitor() );
+
+  BOOST_CHECK(pareto_opt_rc.cost == 3);
+
+  return 0;
+}
=======================================
--- /dev/null
+++ /trunk/libs/graph/test/regression.cfg       Sun Aug  2 22:26:22 2009
@@ -0,0 +1,22 @@
+// Boost Graph Library regression test configuration file
+//
+// From the boost/status directory, run
+// ./regression --tests ../libs/graph/test/regression.cfg -o graph.html
+//
+// Please keep the entries ordered alphabetically by the test's file name.
+
+run libs/graph/test/graph.cpp
+compile libs/graph/test/dijkstra_cc.cpp
+compile libs/graph/test/adj_list_cc.cpp
+compile libs/graph/test/bfs_cc.cpp
+compile libs/graph/test/dfs_cc.cpp
+compile libs/graph/test/graph_concepts.cpp
+compile libs/graph/test/edge_list_cc.cpp
+compile libs/graph/test/reverse_graph_cc.cpp
+compile libs/graph/test/adj_matrix_cc.cpp
+compile libs/graph/test/filtered_graph_cc.cpp
+compile libs/graph/test/stanford_graph_cc.cpp
+compile libs/graph/test/vector_graph_cc.cpp
+run libs/graph/test/adj_list_test.cpp
+run libs/graph/test/bfs.cpp
+run libs/graph/test/dfs.cpp
=======================================
--- /trunk/libs/graph/doc/bellman_ford_shortest.html Mon Mar 30 07:58:04 2009 +++ /trunk/libs/graph/doc/bellman_ford_shortest.html Sun Aug 2 22:26:22 2009
@@ -1,84 +1,39 @@
-<HTML>
-<!--
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><!--
   -- Copyright (c) Jeremy Siek 2000
   --
   -- Distributed under the Boost Software License, Version 1.0.
   -- (See accompanying file LICENSE_1_0.txt or copy at
   -- http://www.boost.org/LICENSE_1_0.txt)
   -->
-<Head>
-<Title>Bellman Ford Shortest Paths</Title>
-<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
-        ALINK="#ff0000">
-<IMG SRC="../../../boost.png"
-     ALT="C++ Boost" width="277" height="86">
-
-<BR Clear>
-
-
-<H1><A NAME="sec:bellman-ford"></A><img src="figs/python.gif" alt="(Python)"/>
-<TT>bellman_ford_shortest_paths</TT>
-</H1>
-
-<P>
-<PRE>
-<i>// named paramter version</i>
-template &lt;class <a href="./EdgeListGraph.html">EdgeListGraph</a>, class Size, class P, class T, class R&gt;
-bool bellman_ford_shortest_paths(const EdgeListGraph&amp; g, Size N,
-  const bgl_named_params&lt;P, T, R&gt;&amp; params = <i>all defaults</i>);
-
-template &lt;class <a href="./VertexAndEdgeListGraph.html">VertexAndEdgeListGraph</a>, class P, class T, class R&gt;
-bool bellman_ford_shortest_paths(const VertexAndEdgeListGraph&amp; g,
-  const bgl_named_params&lt;P, T, R&gt;&amp; params = <i>all defaults</i>);
-
-<i>// non-named parameter version</i>
-template &lt;class <a href="./EdgeListGraph.html">EdgeListGraph</a>, class Size, class WeightMap,
-         class PredecessorMap, class DistanceMap,
- class <a href="http://www.sgi.com/tech/stl/BinaryFunction.html";>BinaryFunction</a>, class <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html";>BinaryPredicate</a>,
-         class <a href="./BellmanFordVisitor.html">BellmanFordVisitor</a>&gt;
-bool bellman_ford_shortest_paths(EdgeListGraph&amp; g, Size N,
-  WeightMap weight, PredecessorMap pred, DistanceMap distance,
-  BinaryFunction combine, BinaryPredicate compare, BellmanFordVisitor v)
-</PRE>
-
-<P>
-The Bellman-Ford algorithm&nbsp;[<A
-HREF="bibliography.html#bellman58">4</A>,<A
-HREF="bibliography.html#ford62:_flows">11</A>,<A
-HREF="bibliography.html#lawler76:_comb_opt">20</A>,<A
-HREF="bibliography.html#clr90">8</A>] solves the single-source
-shortest paths problem for a graph with both positive and negative
-edge weights. For the definition of the shortest paths problem see
-Section <A
-HREF="./graph_theory_review.html#sec:shortest-paths-algorithms">Shortest-Paths
-Algorithms</A>.
-If you only need to solve the shortest paths problem for positive edge
-weights, Dijkstra's algorithm provides a more efficient
-alternative. If all the edge weights are all equal to one then breadth-first
-search provides an even more efficient alternative.
+<title>Bellman Ford Shortest Paths</title></head>
+
+<body alink="#ff0000" bgcolor="#ffffff" link="#0000ee" text="#000000" vlink="#551a8b">
+<img src="../../../boost.png" alt="C++ Boost" height="86" width="277">
+
+<br clear="">
+
+
+<h1><a name="sec:bellman-ford"></a><img src="figs/python.gif" alt="(Python)">
+<tt>bellman_ford_shortest_paths</tt>
+</h1>
+
+<p>
+</p><pre><i>// 命名参数版本</i>
+template &lt;class <a href="./EdgeListGraph.html">EdgeListGraph</a>, class Size, class P, class T, class R&gt;<br>bool bellman_ford_shortest_paths(const EdgeListGraph&amp; g, Size N, <br> const bgl_named_params&lt;P, T, R&gt;&amp; params = <i>all defaults</i>);<br><br>template &lt;class <a href="./VertexAndEdgeListGraph.html">VertexAndEdgeListGraph</a>, class P, class T, class R&gt;<br>bool bellman_ford_shortest_paths(const VertexAndEdgeListGraph&amp; g,<br> const bgl_named_params&lt;P, T, R&gt;&amp; params = <i>all defaults</i>);<br><br><i>// 非命名参数版本</i> +template &lt;class <a href="./EdgeListGraph.html">EdgeListGraph</a>, class Size, class WeightMap,<br> class PredecessorMap, class DistanceMap,<br> class <a href="http://www.sgi.com/tech/stl/BinaryFunction.html";>BinaryFunction</a>, class <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html";>BinaryPredicate</a>,<br> class <a href="./BellmanFordVisitor.html">BellmanFordVisitor</a>&gt;<br>bool bellman_ford_shortest_paths(EdgeListGraph&amp; g, Size N, <br> WeightMap weight, PredecessorMap pred, DistanceMap distance, <br> BinaryFunction combine, BinaryPredicate compare, BellmanFordVisitor v)<br></pre>
+
+<p>
+Bellman-Ford 算法[<a href="bibliography.html#bellman58">4</a>,<a href="bibliography.html#ford62:_flows">11</a>,<a href="bibliography.html#lawler76:_comb_opt">20</a>,<a href="bibliography.html#clr90">8</a>]用于解决同时带有正权重和负权重的图的单 源最短路径问题。关于最短路径问题的定义,请见 <a href="./graph_theory_review.html#sec:shortest-paths-algorithms">最短路径算法 </a> 一节。如果你只需解决正权重的最短路径问题,则 Dijkstra 算法更为高效。如 果所有的边权重均为一,则广度优先搜索提供了更为高效的方法。
 </p>

-<p>
-Before calling the <tt>bellman_ford_shortest_paths()</tt> function,
-the user must assign the source vertex a distance of zero and all
-other vertices a distance of infinity <i>unless</i> you are providing
-a starting vertex. The Bellman-Ford algorithm
-proceeds by looping through all of the edges in the graph, applying
-the relaxation operation to each edge. In the following pseudo-code,
-<i>v</i> is a vertex adjacent to <i>u</i>, <i>w</i> maps edges to
-their weight, and <i>d</i> is a distance map that records the length
-of the shortest path to each vertex seen so far. <i>p</i> is a
-predecessor map which records the parent of each vertex, which will
-ultimately be the parent in the shortest paths tree
+<p>在调用 <tt>bellman_ford_shortest_paths()</tt> 函数之前,用户必须给源顶点 赋一个零距离,给其它所有顶点赋一个无限距离<i>除非</i>你提供了一个开始顶点。 Bellman-Ford 算法对图中所有边进行重复处理,对每条边应用松驰操作。在以下伪代 码中,<i>v</i> 是一个邻接于 <i>u</i> 的顶点,<i>w</i> 将边映射至它们的权 重,而 <i>d</i> 则是一个距离映射,用于记录当前对每个顶点可估算的最短路径长 度。<i>p</i> 是一个前趋映射,记录了每个顶点的父顶点,即最终在最短路径树中的 父节点。
 </p>

 <table>
-<tr>
+<tbody><tr>
 <td valign="top">
-<pre>
-RELAX(<i>u</i>, <i>v</i>, <i>w</i>, <i>d</i>, <i>p</i>)
-  <b>if</b> (<i>w(u,v) + d[u] < d[v]</i>)
-    <i>d[v] := w(u,v) + d[u]</i>
+<pre>RELAX(<i>u</i>, <i>v</i>, <i>w</i>, <i>d</i>, <i>p</i>)<br> <b>if</b> (<i>w(u,v) + d[u] &lt; d[v]</i>) <br> <i>d[v] := w(u,v) + d[u]</i>
     <i>p[v] := u</i>
   <b>else</b>
     ...
@@ -87,51 +42,27 @@
 <td valign="top">
 <pre>

-
-relax edge <i>(u,v)</i>
-
-
-edge <i>(u,v)</i> is not relaxed
-</pre>
+松驰边 <i>(u,v)</i>
+
+
+边 <i>(u,v)</i> 未被松驰<br></pre>
 </td>
 </tr>
-</table>
-
-<p>
-The algorithm repeats this loop <i>|V|</i> times after which it is
-guaranteed that the distances to each vertex have been reduced to the
-minimum possible unless there is a negative cycle in the graph. If
-there is a negative cycle, then there will be edges in the graph that
-were not properly minimized. That is, there will be edges <i>(u,v)</i> such
-that <i>w(u,v) + d[u] < d[v]</i>.  The algorithm loops over the edges in
-the graph one final time to check if all the edges were minimized,
-returning <tt>true</tt> if they were and returning <tt>false</tt>
-otherwise.
+</tbody></table>
+
+<p>该算法会重复这个循环 <i>|V|</i> 次,之后即可保证每个顶点的距离值被减少至 可能的最小值,除非图中存在负权回路。如果存在负权回路,则图中会有一些边未被正 确地最小化。即,存在边 <i>(u,v)</i> 满足 <i>w(u,v) + d[u] &lt; d[v]</i>。本 算法最后会按图中的边进行循环,检查是否所有边已最小化。如果是的话就返回 <tt>true</tt>,否则返回 <tt>false</tt>。
 </p>

 <table>
-<tr>
+<tbody><tr>
 <td valign="top">
-<pre>
-BELLMAN-FORD(<i>G</i>)
-  <i>// Optional initialization</i>
-  <b>for</b> each vertex <i>u in V</i>
-    <i>d[u] := infinity</i>
-    <i>p[u] := u</i>
+<pre>BELLMAN-FORD(<i>G</i>)<br>  <i>// Optional initialization</i>
+  <b>for</b> each vertex <i>u in V</i> <br>    <i>d[u] := infinity</i>
+    <i>p[u] := u</i> <br>  <b>end for</b>
+ <b>for</b> <i>i := 1</i> <b>to</b> <i>|V|-1</i> <br> <b>for</b> each edge <i>(u,v) in E</i> <br> RELAX(<i>u</i>, <i>v</i>, <i>w</i>, <i>d</i>, <i>p</i>)<br> <b>end for</b>
   <b>end for</b>
-  <b>for</b> <i>i := 1</i> <b>to</b> <i>|V|-1</i>
-    <b>for</b> each edge <i>(u,v) in E</i>
-      RELAX(<i>u</i>, <i>v</i>, <i>w</i>, <i>d</i>, <i>p</i>)
-    <b>end for</b>
-  <b>end for</b>
-  <b>for</b> each edge <i>(u,v) in E</i>
-    <b>if</b> (<i>w(u,v) + d[u] < d[v]</i>)
-      <b>return</b> (false, , )
-    <b>else</b>
-      ...
-  <b>end for</b>
-  <b>return</b> (true, <i>p</i>, <i>d</i>)
-</pre>
+ <b>for</b> each edge <i>(u,v) in E</i> <br> <b>if</b> (<i>w(u,v) + d[u] &lt; d[v]</i>)<br> <b>return</b> (false, , )<br> <b>else</b> <br> ...<br> <b>end for</b>
+  <b>return</b> (true, <i>p</i>, <i>d</i>)<br></pre>
 </td>
 <td valign="top">
 <pre>
@@ -141,209 +72,139 @@



-
-examine edge <i>(u,v)</i>
+检查边 <i>(u,v)</i>
+




-
-edge <i>(u,v)</i> was not minimized
-
-edge <i>(u,v)</i> was minimized
-</pre>
+边 <i>(u,v)</i> 未最小化<br><br>边 <i>(u,v)</i> 为最小化<br></pre>
 </td>
 </tr>
-</table>
-
-There are two main options for obtaining output from the
-<tt>bellman_ford_shortest_paths()</tt> function. If the user provides
-a distance property map through the <tt>distance_map()</tt> parameter
-then the shortest distance from the source vertex to every other
-vertex in the graph will be recorded in the distance map (provided the
-function returns <tt>true</tt>). The second option is recording the
-shortest paths tree in the <tt>predecessor_map()</tt>. For each vertex
-<i>u in V</i>, <i>p[u]</i> will be the predecessor of <i>u</i> in the
-shortest paths tree (unless <i>p[u] = u</i>, in which case <i>u</i> is
-either the source vertex or a vertex unreachable from the source).  In
-addition to these two options, the user can provide her own
-custom-made visitor that can take actions at any of the
-algorithm's event points.
-
-<P>
-
-<h3>Parameters</h3>
-
-
-IN: <tt>EdgeListGraph&amp; g</tt>
-<blockquote>
-  A directed or undirected graph whose type must be a model of
-  <a href="./EdgeListGraph.html">Edge List Graph</a>. If a root vertex is
-  provided, then the graph must also model
-  <a href="./VertexListGraph.html">Vertex List Graph</a>.<br>
-
-  <b>Python</b>: The parameter is named <tt>graph</tt>.
+</tbody></table>
+
+<p>从&nbsp;<tt>bellman_ford_shortest_paths</tt><tt>()</tt> 函数获得输出,有 两个主要选项。如果用户通过 <tt>distance_map()</tt> 参数提供一个距离属性映 射,则从源顶点到图中每个顶点的最短距离将被记录在这个距离映射中(当函数返回 <tt>true</tt> 时提供)。第二个选项是将最短路径树记录在 <tt>predecessor_map()</tt> 中。对于<i> V</i> 中的每个顶点 +<i>u</i>,<i>p[u]</i> 为顶点 <i>u</i> 在最短路径树中的前趋(除非 <i>p[u] = u</i>,此时 <i>u</i> 为源顶点或某个不能从源顶点到达的顶点)。除了这两个选 项,用户还可以提供他们自己定制的遍历器,在算法中的某些事件点上执行动作。 </p><h3>Parameters 参数</h3>
+
+
+IN: <tt>EdgeListGraph&amp; g</tt>
+<blockquote>一个有向图或无向图,其类型必须符合
+ <a href="./EdgeListGraph.html">边列表图Edge List Graph</a>。如果提供了根 顶点,则该图还必须符合
+  <a href="./VertexListGraph.html">点列表图Vertex List Graph</a>。<br>
+
+
+
+
+
+  <b>Python</b>: 该参数被命名为 <tt>graph</tt>.&nbsp;
+
 </blockquote>

 IN: <tt>Size N</tt>
-<blockquote>
-  The number of vertices in the graph. The type <tt>Size</tt> must
-  be an integer type.<br>
-  <b>Default:</b> <tt>num_vertices(g)</tt>.<br>
-
-  <b>Python</b>: Unsupported parameter.
+<blockquote>图中的顶点数。类型 <tt>Size</tt> 必须是一个整数类型。<br>
+  <b>缺省值:</b><tt>num_vertices(g)</tt>.<br>
+
+
+
+  <b>Python</b>: 不支持该参数。&nbsp;
+
 </blockquote>


 <h3>Named Parameters</h3>

 IN: <tt>weight_map(WeightMap w)</tt>
-<blockquote>
-  The weight (also know as ``length'' or ``cost'') of each edge in the
-  graph.  The <tt>WeightMap</tt> type must be a model of <a
-  href="../../property_map/ReadablePropertyMap.html">Readable Property
-  Map</a>.  The key type for this property map must be the edge
-  descriptor of the graph.  The value type for the weight map must be
-  <i>Addable</i> with the distance map's value type. <br>
-  <b>Default:</b> <tt>get(edge_weight, g)</tt><br>
-
-  <b>Python</b>: Must be an <tt>edge_double_map</tt> for the graph.<br>
-  <b>Python default</b>: <tt>graph.get_edge_double_map("weight")</tt>
+<blockquote>图中各边的权重(又称为"长度"或"代价")。类型 <tt>WeightMap</tt> 必须符合 + <a href="../../property_map/ReadablePropertyMap.html">可读属性映射</a>。 这个属性映射的键类型必须是该图的边描述符类型。权重映射的值类型必须可以与距离 映射的值类型相加。<br>
+  <b>缺省值:</b><tt>get(edge_weight, g)</tt><br>
+
+  <b>Python</b>: 必须为该图的一个 <tt>edge_double_map</tt>。<br>
+  <b>Python 缺省值:</b><tt>graph.get_edge_double_map("weight")</tt>
 </blockquote>

 OUT: <tt>predecessor_map(PredecessorMap p_map)</tt>
-<blockquote>
-  The predecessor map records the edges in the minimum spanning
-  tree. Upon completion of the algorithm, the edges <i>(p[u],u)</i>
-  for all <i>u in V</i> are in the minimum spanning tree. If <i>p[u] =
-  u</i> then <i>u</i> is either the source vertex or a vertex that is
-  not reachable from the source.  The <tt>PredecessorMap</tt> type
-  must be a <a
-  href="../../property_map/ReadWritePropertyMap.html">Read/Write
-  Property Map</a> which key and vertex types the same as the vertex
-  descriptor type of the graph.<br>
-  <b>Default:</b> <tt>dummy_property_map</tt><br>
-
-  <b>Python</b>: Must be a <tt>vertex_vertex_map</tt> for the graph.<br>
+<blockquote>这个前趋映射用于记录最小生成树中的边。当该算法结束后,对于<i> V</i> 中的所有 <i>u</i>,边 <i>(p[u],u)</i>&nbsp;<span style="font-style: italic;"></span>均属于最小生成树。如果 <i>p[u] = + u</i> 则 <i>u</i> 为源顶点或某个不能从源顶点到达的顶点。类型 <tt>PredecessorMap</tt> 必须符合 <a href="../../property_map/ReadWritePropertyMap.html">读/写属性映射</a>,且其 键类型和值类型均与图的顶点描述符类型相同。<br>
+  <b>缺省值:</b><tt>dummy_property_map</tt><br>
+
+  <b>Python</b>: 必须为该图的一个 <tt>vertex_vertex_map</tt>。<br>
 </blockquote>

 IN/OUT: <tt>distance_map(DistanceMap d)</tt>
-<blockquote>
-  The shortest path weight from the source vertex to each vertex in
-  the graph <tt>g</tt> is recorded in this property map.  The type
-  <tt>DistanceMap</tt> must be a model of <a
-  href="../../property_map/ReadWritePropertyMap.html">Read/Write
-  Property Map</a>. The key type of the property map must be the
-  vertex descriptor type of the graph, and the value type of the
-  distance map must be <a
-  href="http://www.sgi.com/tech/stl/LessThanComparable.html";> Less
-  Than Comparable</a>.<br> <b>Default:</b> <tt>get(vertex_distance,
+<blockquote>从源顶点到图 <tt>g</tt> 中每个顶点的最短路径权重被记录在这个属 性映射中。类型 <tt>DistanceMap</tt> 必须符合 <a href="../../property_map/ReadWritePropertyMap.html">读/写属性映射</a>。这个 属性映射的键类型必须是该图的顶点描述符类型,且距离映射的值类型必须符合 <a href="http://www.sgi.com/tech/stl/LessThanComparable.html";> 可小于比较</a>。 <br>
+  <b>缺省值:</b><tt>get(vertex_distance,
   g)</tt><br>
-  <b>Python</b>: Must be a <tt>vertex_double_map</tt> for the graph.<br>
+  <b>Python</b>: 必须为该图的一个 <tt>vertex_double_map</tt>。<br>
 </blockquote>

 IN: <tt>root_vertex(Vertex s)</tt>
-<blockquote>
-  The starting (or "root") vertex from which shortest paths will be
-  computed. When provided, the distance map need not be initialized
-  (the algorithm will perform the initialization itself). However, the
-  graph must model <a href="./VertexListGraph.html">Vertex List
-  Graph</a> when this parameter is provided.<br>
-  <b>Default:</b> None; if omitted, the user must initialize the
-  distance map.
+<blockquote>计算最短路径的开始(或"根")顶点。如果提供,则距离映射无需初始化 (算法本身会执行这个初始化)。但是,提供该参数时,图必须符合 <a href="./VertexListGraph.html">点列表图Vertex List
+  Graph</a>。<br>
+  <b>缺省值:</b>无;如果提供,用户必须初始化距离映射。
 </blockquote>

 IN: <tt>visitor(BellmanFordVisitor v)</tt>
-<blockquote>
-  The visitor object, whose type must be a model of
-  <a href="./BellmanFordVisitor.html">Bellman-Ford Visitor</a>.
-  The visitor object is passed by value <a
-  href="#1">[1]</a>.
-<br>
-  <b>Default:</b> <tt>bellman_visitor&lt;null_visitor&gt;</tt><br>
-
-  <b>Python</b>: The parameter should be an object that derives from
-  the <a
- href="BellmanFordVisitor.html#python"><tt>BellmanFordVisitor</tt></a> type
-  of the graph.
+<blockquote>遍历器对象,其类型必须符合
+ <a href="./BellmanFordVisitor.html">Bellman-Ford 遍历器</a>。该遍历器对象 是以值方式传递的<a href="#1">[1]</a>。<br>
+  <b>缺省值:</b><tt>bellman_visitor&lt;null_visitor&gt;</tt><br>
+
+
+
+ <b>Python</b>: 该参数应为派生自该图的 <a href="BellmanFordVisitor.html#python"><tt>BellmanFordVisitor</tt></a> 类型的 一个对象。&nbsp;

 </blockquote>

 IN: <tt>distance_combine(BinaryFunction combine)</tt>
-<blockquote>
-  This function object replaces the role of addition in the relaxation
-  step. The first argument type must match the distance map's value
-  type and the second argument type must match the weight map's value
-  type.  The result type must be the same as the distance map's value
-  type.<br>
-  <b>Default:</b><tt>std::plus&lt;D&gt;</tt>
- with <tt>D=typename&nbsp;property_traits&lt;DistanceMap&gt;::value_type</tt>.<br>
-
-  <b>Python</b>: Unsupported parameter.
+<blockquote>该函数对象将替换松驰操作中的加法角色。第一个参数类型必须与距离 映射的值类型相匹配,第二个参数类型必须与权重映射的值类型相匹配。结果类型必须 与距离映射的值类型相同。<br> + <b>缺省值:</b><tt>std::plus&lt;D&gt;</tt> 其中 <tt>D=typename&nbsp;property_traits&lt;DistanceMap&gt;::value_type</tt>.<br>
+
+
+
+  <b>Python</b>: 不支持该参数。&nbsp;
+
 </blockquote>

 IN: <tt>distance_compare(BinaryPredicate compare)</tt>
 <blockquote>
-  This function object replaces the role of the less-than operator
-  that compares distances in the relaxation step. The argument types
-  must match the distance map's value type.<br>
-  <b>Default:</b> <tt>std::less&lt;D&gt;</tt>
- with <tt>D=typename&nbsp;property_traits&lt;DistanceMap&gt;::value_type</tt>.<br>
-
-  <b>Python</b>: Unsupported parameter.
+ 该函数对象将替换松驰操作中进行距离比较的小于操作符角色。参数类型必须与距 离映射的值类型相匹配。<br> + <b>缺省值:</b><tt>std::less&lt;D&gt;</tt> 其中 <tt>D=typename&nbsp;property_traits&lt;DistanceMap&gt;::value_type</tt>.<br>
+
+
+
+  <b>Python</b>: 不支持该参数。&nbsp;
+
 </blockquote>

-<P>
-
-<H3>Complexity</H3>
-
-<P>
-The time complexity is <i>O(V E)</i>.
+<p>
+
+</p><h3>Complexity 复杂度</h3>
+
+<p>时间复杂度为 <i>O(V E)</i>.


-<h3>Visitor Event Points</h3>
+</p><h3>Visitor Event Points 遍历器事件点</h3>

 <ul>
-<li><b><tt>vis.examine_edge(e, g)</tt></b>  is invoked on every edge in
-  the graph <i>|V|</i> times.
-<li><b><tt>vis.edge_relaxed(e, g)</tt></b>  is invoked when the distance
-  label for the target vertex is decreased. The edge <i>(u,v)</i> that
-  participated in the last relaxation for vertex <i>v</i> is an edge in the
-  shortest paths tree.
-<li><b><tt>vis.edge_not_relaxed(e, g)</tt></b> is invoked if the distance label
-  for the target vertex is not decreased.
-<li><b><tt>vis.edge_minimized(e, g)</tt></b>  is invoked during the
-  second stage of the algorithm, during the test of whether each edge
-  was minimized. If the edge is minimized then this function
-  is invoked.
-<li><b><tt>vis.edge_not_minimized(e, g)</tt></b> is also invoked during the
-  second stage of the algorithm, during the test of whether each edge
-  was minimized.  If the edge was not minimized, this function is
-  invoked.  This happens when there is a negative cycle in the graph.
-</ul>
-
-<H3>Example</H3>
-
-<P>
-An example of using the Bellman-Ford algorithm is in <a
-href="../example/bellman-example.cpp"><TT>examples/bellman-example.cpp</TT></a>.
-
-<h3>Notes</h3>
+<li><b><tt>vis.examine_edge(e, g)</tt></b> 对图中每条边调用 <i>|V|</i> 次。 +</li><li><b><tt>vis.edge_relaxed(e, g)</tt></b> 当目标顶点的距离标号减少时 被调用。参与顶点 <i>v</i> 最后一次松驰的边 <i>(u,v)</i> 为最短路径树的一条 边。 +</li><li><b><tt>vis.edge_not_relaxed(e, g)</tt></b> 当目标顶点的距离标号未 能减少时被调用。 +</li><li><b><tt>vis.edge_minimized(e, g)</tt></b> 在算法的第二阶段中测试每 条边是否最小化时,如果某条边是最小化的,则调用该函数。 +</li><li><b><tt>vis.edge_not_minimized(e, g)</tt></b>&nbsp;在算法的第二阶段 中测试每条边是否最小化时,如果某条边不是最小化的,则调用该函数。当图中存在负 权回路时才会发生。
+</li></ul>
+
+<h3>Example 示例</h3>
+
+<p>使用 Bellman-Ford 算法的一个例子在 <a href="../example/bellman-example.cpp"><tt>examples/bellman-example.cpp</tt></a> 中。
+
+</p><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</TD><TD>
-<A HREF="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</A>, Indiana University (<A HREF="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</A>)
-</TD></TR></TABLE>
-
-</BODY>
-</HTML>
+ 由于 visitor 参数是以值方式传递的,所以如果你的遍历器含有状态,则在算法中 对该状态的所有修改都是针对该遍历器对象的一个拷贝,而不对传入的遍历器对象进行 的。因此你应该让该遍历器以指针或引用的方式保存该状态。<br>
+</p><hr>
+<table>
+<tbody><tr valign="top">
+<td nowrap="nowrap">Copyright © 2000</td><td>
+<a href="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</a>, Indiana University (<a href="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</a>)
+</td></tr></tbody></table>
+
+</body></html>
=======================================
--- /trunk/libs/graph/doc/bgl_named_params.html Mon Jun  1 21:27:33 2009
+++ /trunk/libs/graph/doc/bgl_named_params.html Sun Aug  2 22:26:22 2009
@@ -1,96 +1,56 @@
-<HTML>
-<!--
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><!--
   -- Copyright (c) Jeremy Siek 2000
   --
   -- Distributed under the Boost Software License, Version 1.0.
   -- (See accompanying file LICENSE_1_0.txt or copy at
   -- http://www.boost.org/LICENSE_1_0.txt)
   -->
-<Head>
-<Title>Boost Graph Library: Named Parameters</Title>
-<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
-        ALINK="#ff0000">
-<IMG SRC="../../../boost.png"
-     ALT="C++ Boost" width="277" height="86">
-
-<BR Clear>
-
-<H1><A NAME="sec:bgl-named-params"></A>
-<pre>
-bgl_named_params&lt;Param, Type, Rest&gt;
-</pre>
-</H1>
-
-<p>
-Many of the Boost.Graph algorithms have a long list of parameters,
-most of which have default values. This causes several problems.
-First, C++ does not provide a mechanism for handling default
-parameters of template functions. However, this can be overcome by
-creating multiply version of an algorithm with different numbers of
-parameters with each version providing defaults for some subset of
-the parameters. This is the approach used in previous versions of
-Boost.Graph. This solution is still unsatisfactory for several
-reasons:
-
-<ul>
-  <li>The defaults for parameters can only been used in a particular
-  order. If the ordering of the defaults does not fit the users situation
-  he or she has to resort to providing all the parameters.
-
-  <li>Since the list of parameters is long, it is easy to forget
-   the ordering.
-</ul>
+<title>Boost Graph Library: Named Parameters</title></head>
+
+<body alink="#ff0000" bgcolor="#ffffff" link="#0000ee" text="#000000" vlink="#551a8b">
+<img src="../../../boost.png" alt="C++ Boost" height="86" width="277">
+
+<br clear="">
+
+<h1><a name="sec:bgl-named-params"></a>
+<pre>bgl_named_params&lt;Param, Type, Rest&gt;<br></pre>
+</h1>

 <p>
-A better solution is provided by <tt>bgl_named_params</tt>. This class
-allows users to provide parameters is any order, and matches
-arguments to parameters based on parameter names.
-
-<p>
-The following code shows an example of calling
-<tt>bellman_ford_shortest_paths</tt> using the named parameter
-technique. Each of the arguments is passed to a function whose name
-indicates which parameter the argument is for. Each of the named
-parameters is separated by a <b>period</b>, not a comma.
-
-<pre>
-  bool r = boost::bellman_ford_shortest_paths(g, int(N),
-     boost::weight_map(weight).
-     distance_map(&amp;distance[0]).
-     predecessor_map(&amp;parent[0]));
-</pre>
-
-<p>The order in which the arguments are provided does not matter as
-long as they are matched with the correct parameter function.  Here is
-an call to <tt>bellman_ford_shortest_paths</tt> that is equivalent to
-the one above.
-
-<pre>
-  bool r = boost::bellman_ford_shortest_paths(g, int(N),
-     boost::predecessor_map(&amp;parent[0]).
-     distance_map(&amp;distance[0]).
-     weight_map(weight));
-</pre>
-
-<p>Typically the user never needs to deal with the
-<tt>bgl_named_params</tt> class directly, since there are functions
-like <tt>boost::weight_map</tt> that create an instance of
-<tt>bgl_named_params</tt>.
-
-
-<br>
-<HR>
-<TABLE>
-<TR valign=top>
-<TD nowrap>Copyright &copy 2000-2001</TD><TD>
-<A HREF="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</A>,
-Indiana University (<A
-HREF="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</A>)<br>
-<A HREF="http://www.boost.org/people/liequan_lee.htm";>Lie-Quan Lee</A>, Indiana University (<A HREF="mailto:llee@xxxxxxxxxxxxxx";>llee@xxxxxxxxxxxxxx</A>)<br>
-<A HREF="http://www.osl.iu.edu/~lums";>Andrew Lumsdaine</A>,
-Indiana University (<A
-HREF="mailto:lums@xxxxxxxxxx";>lums@xxxxxxxxxx</A>)
-</TD></TR></TABLE>
-
-</BODY>
-</HTML>
+许多 Boost.Graph
+算法都有一个很长的参数列表,而其中多数参数又具有缺省值。这引起了几个问题。 首先,C++没有提供一种机制来处理模板函数的缺省参数。但是,可以通过对 +一个算法创建多个不同参数数量的版本来实现,每一个版本对参数的某个子集提供缺 省值。这是早先版本的
+Boost.Graph 所用的方法。这种解决方案还是不能令人满意,有以下原因:
+</p><ul>
+ <li>参数的缺省值只能以特定的顺序来使用。如果缺省值的顺序不符合用户的情 形,则他或她就必须重新排序以提供所有参数。
+
+  </li><li>由于参数列表很长,很容易忘记其顺序。
+</li></ul>
+
+<p><tt>bgl_named_params</tt> 提供了一个更好的解决方案。这个类允许用户以任意 顺序提供参数,并基于参数名来将实参匹配至形参。
+
+</p><p>以下代码示范了一个以命名参数技术来调用
+<tt>bellman_ford_shortest_paths</tt> 的例子。传给函数的每个实参都带有名 字,表明了该实参用于哪个形参。各个命名参数以<b>句号</b>,而不是逗号来分隔。
+
+</p><pre> bool r = boost::bellman_ford_shortest_paths(g, int(N), <br> boost::weight_map(weight).<br> distance_map(&amp;distance[0]).<br> predecessor_map(&amp;parent[0]));<br></pre>
+
+<p>所提供的实参的顺序并不重要,它们会匹配至正确的形参。以下是一个与上述例子 等价的 <tt>bellman_ford_shortest_paths</tt> 调用。
+
+</p><pre> bool r = boost::bellman_ford_shortest_paths(g, int(N), <br> boost::predecessor_map(&amp;parent[0]).<br> distance_map(&amp;distance[0]).<br> weight_map(weight));<br></pre>
+
+<p>通常,用户不需要直接操作
+<tt>bgl_named_params</tt> 类,因为象 <tt>boost::weight_map</tt> 这样的函数 会创建相应
+<tt>bgl_named_params</tt> 实例。<br>
+</p><hr>
+<table>
+<tbody><tr valign="top">
+<td nowrap="nowrap">Copyright © 2000-2001</td><td>
+<a href="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</a>,
+Indiana University (<a href="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</a>)<br> +<a href="http://www.boost.org/people/liequan_lee.htm";>Lie-Quan Lee</a>, Indiana University (<a href="mailto:llee@xxxxxxxxxxxxxx";>llee@xxxxxxxxxxxxxx</a>)<br>
+<a href="http://www.osl.iu.edu/%7Elums";>Andrew Lumsdaine</a>,
+Indiana University (<a href="mailto:lums@xxxxxxxxxx";>lums@xxxxxxxxxx</a>)
+</td></tr></tbody></table>
+
+</body></html>
=======================================
--- /trunk/libs/graph/doc/breadth_first_search.html     Mon Mar 30 07:58:04 2009
+++ /trunk/libs/graph/doc/breadth_first_search.html     Sun Aug  2 22:26:22 2009
@@ -1,30 +1,26 @@
-<HTML>
-<!--
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><!--
   -- Copyright (c) Jeremy Siek 2000, 2001
   --
   -- Distributed under the Boost Software License, Version 1.0.
   -- (See accompanying file LICENSE_1_0.txt or copy at
   -- http://www.boost.org/LICENSE_1_0.txt)
   -->
-<Head>
-<Title>Boost Graph Library: Breadth-First Search</Title>
-<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
-        ALINK="#ff0000">
-<IMG SRC="../../../boost.png"
-     ALT="C++ Boost" width="277" height="86">
-
-<BR Clear>
-
-<H1><A NAME="sec:bfs">
-<img src="figs/python.gif" alt="(Python)"/>
-<TT>breadth_first_search</TT>
-</H1>
-
-<P>
-<PRE>
-<i>// named parameter version</i>
+<title>Boost Graph Library: Breadth-First Search</title></head>
+<body alink="#ff0000" bgcolor="#ffffff" link="#0000ee" text="#000000" vlink="#551a8b">
+<img src="../../../boost.png" alt="C++ Boost" height="86" width="277">
+
+<br clear="">
+
+<h1><a name="sec:bfs">
+<img src="figs/python.gif" alt="(Python)">
+<tt>breadth_first_search</tt>
+</a></h1>
+
+<p>
+</p><pre><a name="sec:bfs"><i>// named parameter version</i>
 template &lt;class Graph, class P, class T, class R&gt;
-void breadth_first_search(Graph& G,
+void breadth_first_search(Graph&amp; G,
   typename graph_traits&lt;Graph&gt;::vertex_descriptor s,
   const bgl_named_params&lt;P, T, R&gt;&amp; params);

@@ -34,305 +30,170 @@
 void breadth_first_search(const Graph&amp; g,
    typename graph_traits&lt;Graph&gt;::vertex_descriptor s,
    Buffer&amp; Q, BFSVisitor vis, ColorMap color);
-</PRE>
+</a></pre>


 <p>
-The <tt>breadth_first_search()</tt> function performs a breadth-first
-traversal [<a href="./bibliography.html#moore59">49</a>] of a directed
-or undirected graph.  A breadth-first traversal visits vertices that
-are closer to the source before visiting vertices that are further
-away. In this context ``distance'' is defined as the number of edges
-in the shortest path from the source vertex. The
-<tt>breadth_first_search()</tt> function can be used to compute the
-shortest path from the source to all reachable vertices and the
-resulting shortest-path distances. For more definitions related to BFS
-see section <a href="./graph_theory_review.html#sec:bfs-algorithm">
-Breadth-First Search</a>.
+<a name="sec:bfs">函数 <tt>breadth_first_search()</tt> 对一个有向图或无向图 执行广度优先的遍历[</a><a href="./bibliography.html#moore59">49</a>]。广度优 先遍历会在访问较远的顶点之前先访问较近的顶点。在这里,"距离"被定义为从源顶点 至指定顶点的最短路径的边数。函数 +<tt>breadth_first_search()</tt> 可用于计算从源顶点至所有可达顶点的最短路径 并得到最短路径距离。关于BFS的更多定义,请见 <a href="./graph_theory_review.html#sec:bfs-algorithm">
+广度优先搜索</a> 一节。
 </p>

 <p>
-BFS uses two data structures to to implement the traversal: a color
-marker for each vertex and a queue. White vertices are undiscovered
-while gray vertices are discovered but have undiscovered adjacent
-vertices. Black vertices are discovered and are adjacent to only other
-black or gray vertices.  The algorithm proceeds by removing a vertex
-</i>u</i> from the queue and examining each out-edge <i>(u,v)</i>. If an
-adjacent vertex <i>v</i> is not already discovered, it is colored gray and
-placed in the queue. After all of the out-edges are examined, vertex
-<i>u</i> is colored black and the process is repeated.  Pseudo-code for the
-BFS algorithm is a listed below.
+BFS使用两个数据结构来实现遍历:一个对各顶点进行着色的着色器,和一个队列。白 色顶点为未被发现的顶点,而灰色顶点则为已被发现但带有未被发现的邻接顶点的顶 点。黑色顶点则是已被发现且其只有黑色或灰色邻接顶点的顶点。该算法的处理过程 是,从队列中取出一个顶点 +u,检查它的每一条出边 <i>(u,v)</i>。如果某个邻接顶点 <i>v</i> 未被发现,则 将它着色为灰色并放入队列中。当所有出边都检查完后,顶点
+<i>u</i> 被着色为黑色,然后重复该过程。BFS算法的伪代码列出如下。
 </p>

 <table>
-<tr>
+<tbody><tr>
 <td valign="top">
-<pre>
-BFS(<i>G</i>, <i>s</i>)
-  <b>for</b> each vertex <i>u in V[G]</i>
-    <i>color[u] :=</i> WHITE
-    <i>d[u] := infinity</i>
-    <i>p[u] := u</i>
-  <b>end for</b>
-  <i>color[s] :=</i> GRAY
-  <i>d[s] := 0</i>
-  ENQUEUE(<i>Q</i>, <i>s</i>)
-  <b>while</b> (<i>Q != &Oslash;</i>)
-    <i>u :=</i> DEQUEUE(Q)
-    <b>for</b> each vertex <i>v in Adj[u]</i>
-      <b>if</b> (<i>color[v] =</i> WHITE)
-        <i>color[v] :=</i> GRAY
-        <i>d[v] := d[u] + 1</i>
-        <i>p[v] := u</i>
-        ENQUEUE(<i>Q</i>, <i>v</i>)
-      <b>else</b>
-        <b>if</b> (<i>color[v] =</i> GRAY)
-          ...
-        <b>else</b>
-          ...
-    <b>end for</b>
-    <i>color[u] :=</i> BLACK
-  <b>end while</b>
-  return (<i>d</i>, <i>p</i>)
-</pre>
+<pre>BFS(<i>G</i>, <i>s</i>)<br>  <b>for</b> each vertex <i>u in V[G]</i>
+ <i>color[u] :=</i> WHITE <br> <i>d[u] := infinity</i> <br> <i>p[u] := u</i> <br> <b>end for</b> + <i>color[s] :=</i> GRAY <br> <i>d[s] := 0</i> <br> ENQUEUE(<i>Q</i>, <i>s</i>)<br> <b>while</b> (<i>Q != Ø</i>) <br> <i>u :=</i> DEQUEUE(Q)<br> <b>for</b> each vertex <i>v in Adj[u]</i> + <b>if</b> (<i>color[v] =</i> WHITE)<br> <i>color[v] :=</i> GRAY <br> <i>d[v] := d[u] + 1</i> <br> <i>p[v] := u</i> <br> ENQUEUE(<i>Q</i>, <i>v</i>)<br> <b>else</b> + <b>if</b> (<i>color[v] =</i> GRAY) <br> ...<br> <b>else</b> <br> ...<br> <b>end for</b>
+    <i>color[u] :=</i> BLACK<br>  <b>end while</b>
+  return (<i>d</i>, <i>p</i>)<br></pre>
 </td>
 <td valign="top">
-<pre>
-
-initialize vertex <i>u</i>
-
-
-
-
-
-
-discover vertex <i>s</i>
-
-examine vertex <i>u</i>
-examine edge <i>(u,v)</i>
-<i>(u,v)</i> is a tree edge
-
-
-
-discover vertex <i>v</i>
-<i>(u,v)</i> is a non-tree edge
-
-<i>(u,v)</i> has a gray target
-
-<i>(u,v)</i> has a black target
-
-finish vertex <i>u</i>
-</pre>
-</tr>
-</table>
-
-The <tt>breadth_first_search()</tt> function can be extended with
-user-defined actions that will be called a certain event points. The
-actions must be provided in the form of a visitor object, that is, an
-object who's type meets the requirements for a <a
-href="./BFSVisitor.html">BFS Visitor</a>. In the above pseudo-code,
-the event points are the labels on the right. Also a description of
-each event point is given below. By default, the
-<tt>breadth_first_search()</tt> function does not carry out any
-actions, not even recording distances or predecessors. However these
-can be easily added using the <a
-href="./distance_recorder.html"><tt>distance_recorder</tt></a> and <a
-href="./predecessor_recorder.html"><tt>predecessor_recorder</tt></a>
-event visitors.
-
-
-<H3>Where Defined</H3>
-
-<P>
-<a href="../../../boost/graph/breadth_first_search.hpp"><TT>boost/graph/breadth_first_search.hpp</TT></a>
-
-<P>
-
-<h3>Parameters</h3>
+<pre>初始化顶点 <i>u</i> <br><br><br><br><br><br><br>发现顶点 <i>s</i> <br><br>检查顶点 <i>u</i> <br>检查边 <i>(u,v)</i> +<i>(u,v)</i> 是一条树边<br><br><br><br>发现顶点 <i>v</i> <br><i>(u,v)</i> 是一条非树边<br><br><i>(u,v)</i> 带有灰色的目标顶点<br><br><i>(u,v)</i> 带有 黑色的目标顶点<br><br>完成顶点 <i>u</i> <br></pre>
+</td></tr>
+</tbody></table>函数 <tt>breadth_first_search()</tt> 可以被扩展,在一些特定 的事件点调用某些用户自定义的动作。这些动作必须以遍历器对象的形式提供,即对象 的类型要符合 <a href="./BFSVisitor.html">BFS 遍历器</a> 的要求。在上面的伪代 码中,各个事件点在右侧标出。下面还会给出各个事件点的说明。缺省情况 下,<tt>breadth_first_search()</tt> 函数不执行任何动作,包括记录距离或前趋。 不过可以通过加入 <a href="./distance_recorder.html"><tt>distance_recorder</tt></a> 和 <a href="./predecessor_recorder.html"><tt>predecessor_recorder</tt></a>
+事件遍历器很容易地实现这些功能。
+
+
+<h3>Where Defined 定义于</h3>
+
+<p>
+<a href="../../../boost/graph/breadth_first_search.hpp"><tt>boost/graph/breadth_first_search.hpp</tt></a>
+
+</p><p>
+
+</p><h3>Parameters 参数</h3>

 IN: <tt>Graph&amp; g</tt>
-<blockquote>
-  A directed or undirected graph. The graph type must
-  be a model of <a href="./VertexListGraph.html">Vertex List Graph</a>
-  and <a href="./IncidenceGraph.html">Incidence Graph</a>.<br>
-
-  <b>Python</b>: The parameter is named <tt>graph</tt>.
+<blockquote>一个有向图或无向图。图类型必须符合 <a href="./VertexListGraph.html">点列表图Vertex List Graph</a> 和 <a href="./IncidenceGraph.html">关联图Incidence Graph</a>。<br>
+
+  <b>Python</b>: 该参数被命名为 <tt>graph</tt>.
 </blockquote>

 IN: <tt>vertex_descriptor s</tt>
-<blockquote>
-  The source vertex where the search is started.<br>
-
-  <b>Python</b>: The parameter is named <tt>root_vertex</tt>.
+<blockquote>开始搜索的源顶点。<br>
+
+  <b>Python</b>: 该参数被命名为 <tt>root_vertex</tt>.
 </blockquote>


-<h3>Named Parameters</h3>
+<h3>Named Parameters 命名参数</h3>

 IN: <tt>visitor(BFSVisitor vis)</tt>
-<blockquote>
-  A visitor object that is invoked inside the algorithm at the
-  event-points specified by the <a href="BFSVisitor.html">BFS
-  Visitor</a> concept. The visitor object is passed by value <a
-  href="#1">[1]</a>.<br> <b>Default:</b>
-  <tt>bfs_visitor&lt;null_visitor&gt;</tt> <br>
-
-  <b>Python</b>: The parameter should be an object that derives from
- the <a href="BFSVisitor.html#python"><tt>BFSVisitor</tt></a> type of the graph.
+<blockquote>一个遍历器对象,在算法内部某些由 <a href="BFSVisitor.html">BFS
+ 遍历器</a> 概念所指定的事件点被调用。这个遍历器对象是以值方式传递的<a href="#1">[1]</a>。<br> <b>缺省 值:</b><tt>bfs_visitor&lt;null_visitor&gt;</tt> <br>
+
+ <b>Python</b>: 该参数应为派生自该图的 <a href="BFSVisitor.html#python"><tt>BFSVisitor</tt></a> 类型的一个对象。

 </blockquote>

 UTIL/OUT: <tt>color_map(ColorMap color)</tt>
-<blockquote>
-  This is used by the algorithm to keep track of its progress through
-  the graph. The user need not initialize the color map before calling
-  <tt>breadth_first_search()</tt> since the algorithm initializes the
-  color of every vertex to white at the start of the algorihtm. If you
-  need to perform multiple breadth-first searches on a graph (for
-  example, if there are some disconnected components) then use the <a
-  href="./breadth_first_visit.html"><tt>breadth_first_visit()</tt></a>
-  function and do your own color initialization.
-
-  <p>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 must model
-  <a href="./ColorValue.html">ColorValue</a>.<br>
-  <b>Default:</b> an <a
-  href="../../property_map/iterator_property_map.html">
-  </tt>iterator_property_map</tt></a> created from a
-  <tt>std::vector</tt> of <tt>default_color_type</tt> of size
-  <tt>num_vertices(g)</tt> and using the <tt>i_map</tt> for the index
-  map.<br>
-
-  <b>Python</b>: The color map must be a <tt>vertex_color_map</tt> for
-  the graph.
-</blockquote>
+<blockquote>被该算法用于跟踪对图的处理过程。用户不需要在调用
+ <tt>breadth_first_search()</tt> 之前初始化这个颜色映射,因为算法会在开始 前将每个顶点的颜色初始化为白色。如果你需要对一个图执行多次广度优先搜索(例 如,图中有一些分离的组件),那么就要使用 <a href="./breadth_first_visit.html"><tt>breadth_first_visit()</tt></a>
+  函数并自己进行颜色初始化。
+
+ <p>类型 <tt>ColorMap</tt> 必须符合 <a href="../../property_map/ReadWritePropertyMap.html">读/写属性映射</a> 并且其 键类型必须为图的顶点描述符类型,值类型必须符合
+  <a href="./ColorValue.html">颜色值ColorValue</a>。<br>
+ <b>缺省值:</b>一个 <a href="../../property_map/iterator_property_map.html">
+  iterator_property_map</a>,创建自一个大小为
+  <tt>num_vertices(g)</tt>,值为 <tt>default_color_type</tt> 的
+  <tt>std::vector</tt>,且使用 <tt>i_map</tt> 作为索引映射。<br>
+
+  <b>Python</b>: 这个颜色映射必须是图的一个 <tt>vertex_color_map</tt>。
+</p></blockquote>

 IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
-<blockquote>
-  This maps each vertex to an integer in the range <tt>[0,
-  num_vertices(g))</tt>. This parameter is only necessary when the
-  default color property map is used. The type <tt>VertexIndexMap</tt>
-  must be a model of <a
-  href="../../property_map/ReadablePropertyMap.html">Readable Property
-  Map</a>. The value type of the map must be an integer type. The
-  vertex descriptor type of the graph needs to be usable as the key
-  type of the map.<br>
-
-  <b>Default:</b> <tt>get(vertex_index, g)</tt>.
-    Note: if you use this default, make sure your graph has
-    an internal <tt>vertex_index</tt> property. For example,
-    <tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
-    not have an internal <tt>vertex_index</tt> property.<br>
-
-  <b>Python</b>: Unsupported parameter.
+<blockquote>它将每个顶点映射至位于区间 <tt>[0,
+ num_vertices(g))</tt> 中的一个整数。仅当缺省颜色属性映射被使用时,需要这 个参数。类型 <tt>VertexIndexMap</tt> + 必须符合 <a href="../../property_map/ReadablePropertyMap.html">可读属性映 射</a>。该映射的值类型必须是一个整数类型。图的顶点描述符类型需要可以被用作该 映射的键类型。<br>
+
+  <b>缺省值:</b><tt>get(vertex_index, g)</tt>.
+ 注意:如果你使用该缺省值,请确认你的图具有一个内部的 <tt>vertex_index</tt> 属性。例如,带 <tt>VertexList=listS</tt> 的
+    <tt>adjacenty_list</tt> 并不具有内部的 <tt>vertex_index</tt> 属性。<br>
+
+  <b>Python</b>: 不支持该参数。
 </blockquote>

 UTIL: <tt>buffer(Buffer&amp; Q)</tt>
-<blockquote>
-  The queue used to determine the order in which vertices will be
-  discovered.  If a FIFO queue is used, then the traversal will
-  be according to the usual BFS ordering. Other types of queues
-  can be used, but the traversal order will be different.
-  For example Dijkstra's algorithm can be implemented
-  using a priority queue. The type <tt>Buffer</tt> must be a model of
-  <a href="./Buffer.html">Buffer</a>.<br> The <tt>value_type</tt>
- of the buffer must be the <tt>vertex_descriptor</tt> type for the graph.<br>
-  <b>Default:</b> <tt>boost::queue</tt><br>
-
-  <b>Python</b>: The buffer must derive from the <a
-  href="./Buffer.html">Buffer</a> type for the graph.
+<blockquote>该队列用于决定顶点被发现的顺序。如果用的是 FIFO 队列,则遍历顺 序为通常的 BFS 顺序。也可以使用其它类型的队列,但遍历顺序将会不同。例 如,Dijkstra 算法可以通过使用一个优先队列来实现。类型 <tt>Buffer</tt> 必须符
+  <a href="./Buffer.html">Buffer</a>。<br>该缓冲区的 <tt>value_type</tt>
+  必须是图的 <tt>vertex_descriptor</tt> 类型。<br>
+  <b>缺省值:</b><tt>boost::queue</tt><br>
+
+ <b>Python</b>: 该缓冲区必须派生自图的 <a href="./Buffer.html">Buffer</a> 类型。

 </blockquote>


-<H3><A NAME="SECTION001330300000000000000">
-Complexity</A>
-</H3>
-
-<P>
-The time complexity is <i>O(E + V)</i>.
-
-<P>
-
-<h3>Visitor Event Points</h3>
+<h3><a name="SECTION001330300000000000000">
+Complexity 复杂度</a>
+</h3>
+
+<p>时间复杂度为 <i>O(E + V)</i>.
+
+</p><p>
+
+</p><h3>Visitor Event Points 遍历器事件点</h3>

 <ul>
-<li><b><tt>vis.initialize_vertex(v, g)</tt></b> is invoked on every vertex
-  before the start of the search.
-
-<li><b><tt>vis.examine_vertex(u, g)</tt></b>r is invoked in each
-  vertex as it is removed from the queue.
-
-<li><b><tt>vis.examine_edge(e, g)</tt></b> is invoked on every out-edge
-  of each vertex immediately after the vertex is removed from the queue.
-
-<li><b><tt>vis.tree_edge(e, g)</tt></b> is invoked (in addition to
-  <tt>examine_edge()</tt>) if the edge is a tree edge. The
-  target vertex of edge <tt>e</tt> is discovered at this time.
-
-<li><b><tt>vis.discover_vertex(u, g)</tt></b> is invoked the first time the
-  algorithm encounters vertex <i>u</i>. All vertices closer to the
-  source vertex have been discovered, and vertices further from the
-  source have not yet been discovered.
-
-<li><b><tt>vis.non_tree_edge(e, g)</tt></b> is invoked (in addition to
-  <tt>examine_edge()</tt>) if the edge is not a tree edge.
-
-<li><b><tt>vis.gray_target(e, g)</tt></b> is invoked (in addition to
-  <tt>non_tree_edge()</tt>) if the target vertex is colored gray at the
-  time of examination. The color gray indicates that
-  the vertex is currently in the queue.
-
-<li><b><tt>vis.black_target(e, g)</tt></b> is invoked (in addition to
-  <tt>non_tree_edge()</tt>) if the target vertex is colored black at the
-  time of examination. The color black indicates that the
-  vertex is no longer in the queue.
-
-<li><b><tt>vis.finish_vertex(u, g)</tt></b> is invoked after all of the out
-  edges of <i>u</i> have been examined and all of the adjacent vertices
-  have been discovered.
-
-</ul>
-
-<H3><A NAME="SECTION001330400000000000000">
-Example</A>
-</H3>
-
-<P>
-The example in <a
-href="../example/bfs-example.cpp"><TT>example/bfs-example.cpp</TT></a>
-demonstrates using the BGL Breadth-first search algorithm on the graph
-from <A HREF="./graph_theory_review.html#fig:bfs-example">Figure
-5</A>. The file
-<a href="../example/bfs-example2.cpp"><TT>example/bfs-example2.cpp</TT></a>
-contains the same example, except that the <tt>adacency_list</tt>
-class used has <tt>VertexList</tt> and <tt>EdgeList</tt> set
-to <tt>listS</tt>.
-</P>
-
-<h3>See Also</h3>
-
-<a href="./bfs_visitor.html"><tt>bfs_visitor</tt></a> and
+<li><b><tt>vis.initialize_vertex(v, g)</tt></b> 在搜索开始前对每个顶点调 用。
+
+</li><li><b><tt>vis.examine_vertex(u, g)</tt></b> 当各顶点被移出队列时被调 用。
+
+</li><li><b><tt>vis.examine_edge(e, g)</tt></b> 在某顶点被移出队列时,对其 每条出边调用。
+
+</li><li><b><tt>vis.tree_edge(e, g)</tt></b> 如果该边为树边,则被调用(在
+  <tt>examine_edge()</tt> 之后)。边 <tt>e</tt> 的目标顶点在此时被发现。
+
+</li><li><b><tt>vis.discover_vertex(u, g)</tt></b> 在该算法第一次遇到顶点 <i>u</i> 时调用。所有离源顶点更近的顶点已被发出,而离源顶点更远的顶点则尚未 被发现。
+
+</li><li><b><tt>vis.non_tree_edge(e, g)</tt></b> 如是该边为非树边,则被调用 (在
+  <tt>examine_edge()</tt> 之后)。
+
+</li><li><b><tt>vis.gray_target(e, g)</tt></b> 如果目标顶点在检查时被着色为 灰色,则被调用(在
+  <tt>non_tree_edge()</tt> 之后)。灰色表示该顶点已在队列中。
+
+</li><li><b><tt>vis.black_target(e, g)</tt></b> 如果目标顶点在检查时被着色 为黑色,则被调用(在
+  <tt>non_tree_edge()</tt> 之后)。黑色表示该顶点已不在队列中。
+
+</li><li><b><tt>vis.finish_vertex(u, g)</tt></b> 当 <i>u</i> 的所有出边都完 成检查且所有邻接顶点都被发现后调用。
+
+</li></ul>
+
+<h3><a name="SECTION001330400000000000000">
+Example 示例</a>
+</h3>
+
+<p><a href="../example/bfs-example.cpp"><tt>example/bfs-example.cpp</tt></a> +中的例子示范了对&nbsp;<a href="./graph_theory_review.html#fig:bfs-example">图
+5</a> 中的图使用BGL广度优先搜索算法。文件
+<a href="../example/bfs-example2.cpp"><tt>example/bfs-example2.cpp</tt></a> 也 包含了同一个例子,但所使用的 <tt>adacency_list</tt>
+类的 <tt>VertexList</tt> 和 <tt>EdgeList</tt> 被设置为 <tt>listS</tt>。
+</p>
+
+<h3>See Also 参见</h3>
+
+<a href="./bfs_visitor.html"><tt>bfs_visitor</tt></a> 和
 <a href="./depth_first_search.html"><tt>depth_first_search()</tt></a>

-<h3>Notes</h3>
+<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="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</A>, Indiana University (<A HREF="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</A>)
-</TD></TR></TABLE>
-
-</BODY>
-</HTML>
+ 由于 visitor 参数是以值方式传递的,所以如果你的遍历器含有状态,则在算法中 对该状态的所有修改都是针对该遍历器对象的一个拷贝,而不对传入的遍历器对象进行 的。因此你应该让该遍历器以指针或引用的方式保存该状态。<br>
+</p><hr>
+<table>
+<tbody><tr valign="top">
+<td nowrap="nowrap">Copyright © 2000-2001</td><td>
+<a href="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</a>, Indiana University (<a href="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</a>)
+</td></tr></tbody></table>
+
+</body></html>
=======================================
--- /trunk/libs/graph/doc/breadth_first_visit.html      Mon Mar 30 07:58:04 2009
+++ /trunk/libs/graph/doc/breadth_first_visit.html      Sun Aug  2 22:26:22 2009
@@ -1,186 +1,125 @@
-<HTML>
-<!--
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><!--
   -- Copyright (c) Jeremy Siek 2000, 2001
   --
   -- Distributed under the Boost Software License, Version 1.0.
   -- (See accompanying file LICENSE_1_0.txt or copy at
   -- http://www.boost.org/LICENSE_1_0.txt)
   -->
-<Head>
-<Title>Boost Graph Library: Breadth-First Visit</Title>
-<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
-        ALINK="#ff0000">
-<IMG SRC="../../../boost.png"
-     ALT="C++ Boost" width="277" height="86">
-
-<BR Clear>
-
-<H1><A NAME="sec:bfv"><img src="figs/python.gif" alt="(Python)"/>
-<TT>breadth_first_visit</TT>
-</H1>
-
-<P>
-<PRE>
- template &lt;class <a href="./IncidenceGraph.html">IncidenceGraph</a>, class P, class T, class R&gt;
-  void breadth_first_visit(IncidenceGraph& G,
-    typename graph_traits&lt;IncidenceGraph&gt;::vertex_descriptor s,
-    const bgl_named_params&lt;P, T, R&gt;&amp; params);
-
- template &lt;class <a href="./IncidenceGraph.html">IncidenceGraph</a>, class <a href="./Buffer.html">Buffer</a>, class <a href="./BFSVisitor.html">BFSVisitor</a>, class ColorMap&gt;
-  void breadth_first_visit
-    (const IncidenceGraph&amp; g,
-     typename graph_traits&lt;IncidenceGraph&gt;::vertex_descriptor s,
-     Buffer&amp; Q, BFSVisitor vis, ColorMap color)
-</PRE>
-
-This function is basically the same as <tt>breadth_first_search()</tt>
-except that the color markers are not initialized in the
-algorithm. The user is responsible for making sure the color for every
-vertex is white before calling the algorithm.  With this difference,
-the graph type is only required to be an <a
-href="./IncidenceGraph.html">Incidence Graph</a> instead of a <a
-href="./VertexListGraph.html">Vertex List Graph</a>.  Also, this
-difference allows for more flexibility in the color property map. For
-example, one could use a map that only implements a partial function
-on the vertices, which could be more space efficient when the search
-only reaches a small portion of the graph.
-
-<H3>Where Defined</H3>
-
-<P>
-<a href="../../../boost/graph/breadth_first_search.hpp"><TT>boost/graph/breadth_first_search.hpp</TT></a>
-
-
-<h3>Parameters</h3>
+<title>Boost Graph Library: Breadth-First Visit</title></head>
+
+<body alink="#ff0000" bgcolor="#ffffff" link="#0000ee" text="#000000" vlink="#551a8b">
+<img src="../../../boost.png" alt="C++ Boost" height="86" width="277">
+
+<br clear="">
+
+<h1><a name="sec:bfv"><img src="figs/python.gif" alt="(Python)">
+<tt>breadth_first_visit</tt>
+</a></h1>
+
+<p>
+</p><pre><a name="sec:bfv"> template &lt;class </a><a href="./IncidenceGraph.html">IncidenceGraph</a>, class P, class T, class R&gt;<br> void breadth_first_visit(IncidenceGraph&amp; G, <br> typename graph_traits&lt;IncidenceGraph&gt;::vertex_descriptor s, <br> const bgl_named_params&lt;P, T, R&gt;&amp; params);<br><br> template &lt;class <a href="./IncidenceGraph.html">IncidenceGraph</a>, class <a href="./Buffer.html">Buffer</a>, class <a href="./BFSVisitor.html">BFSVisitor</a>, class ColorMap&gt;<br> void breadth_first_visit<br> (const IncidenceGraph&amp; g, <br> typename graph_traits&lt;IncidenceGraph&gt;::vertex_descriptor s, <br> Buffer&amp; Q, BFSVisitor vis, ColorMap color)<br></pre>这个函数基本上与 <tt>breadth_first_search()</tt> +相同,除了在该算法中不对颜色着色器进行初始化。用户要负责确保在调用该算法之 前每个顶点的颜色为白色。由于这个差异,图的类型只要求是 <a href="./IncidenceGraph.html">关联图Incidence Graph</a> 即可,不再是 <a href="./VertexListGraph.html">点列表图Vertex List Graph</a>。另外,这点差异 还使得颜色属性映射具有更多的灵活性。例如,你可以使用一个只实现了部分顶点功能 的映射,这样当搜索只涉及图的小部分时,可以提高空间效率。
+
+<h3>Where Defined 定义于</h3>
+
+<p>
+<a href="../../../boost/graph/breadth_first_search.hpp"><tt>boost/graph/breadth_first_search.hpp</tt></a>
+
+
+</p><h3>Parameters 参数</h3>

 IN: <tt>IncidenceGraph&amp; g</tt>
-<blockquote>
-  A directed or undirected graph. The graph type must
-  be a model of <a href="./IncidenceGraph.html">Incidence Graph</a>.<br>
-
-  <b>Python</b>: The parameter is named <tt>graph</tt>.
+<blockquote>一个有向图或无向图。图类型必须符合 <a href="./IncidenceGraph.html">关联图Incidence Graph</a>.<br>
+
+  <b>Python</b>:&nbsp;该参数被命名为 <tt>graph</tt>.
+
 </blockquote>

 IN: <tt>vertex_descriptor s</tt>
-<blockquote>
-  The source vertex where the search is started.<br>
-
-  <b>Python</b>: The parameter is named <tt>root_vertex</tt>.
+<blockquote>开始搜索的源顶点。<br>
+
+  <b>Python</b>:&nbsp;该参数被命名为 <tt>root_vertex</tt>.
+
 </blockquote>


-<h3>Named Parameters</h3>
+<h3>Named Parameters 命名参数</h3>

 IN: <tt>visitor(BFSVisitor vis)</tt>
-<blockquote>
-  A visitor object that is invoked inside the algorithm at the
-  event-points specified by the <a href="BFSVisitor.html">BFS
-  Visitor</a> concept. The visitor object is passed by value <a
-  href="#1">[1]</a>.<br> <b>Default:</b>
-  <tt>bfs_visitor&lt;null_visitor&gt;</tt><br>
-
-  <b>Python</b>: The parameter should be an object that derives from
- the <a href="BFSVisitor.html#python"><tt>BFSVisitor</tt></a> type of the graph. +<blockquote>一个遍历器对象,在算法内部某些由&nbsp; <a href="BFSVisitor.html">BFS + 遍历器</a>&nbsp;概念所指定的事件点被调用。这个遍历器对象是以值方式传递的 <a href="#1">[1]</a>。<br> <b>缺省 值:</b><tt>bfs_visitor&lt;null_visitor&gt;</tt><br>
+
+ <b>Python</b>: 该参数应为派生自该图的 <a href="BFSVisitor.html#python"><tt>BFSVisitor</tt></a>&nbsp;类型的一个对象。
+
+
 </blockquote>

 UTIL/OUT: <tt>color_map(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 must model
-  <a href="./ColorValue.html">ColorValue</a>.<br>
-  <b>Default:</b> <tt>get(vertex_color, g)</tt><br>
-
-  <b>Python</b>: The color map must be a <tt>vertex_color_map</tt> for
-  the graph.
+<blockquote>被该算法用于跟踪对图的处理过程。类型 <tt>ColorMap</tt> 必须符 合 <a href="../../property_map/ReadWritePropertyMap.html">读/写属性映射 Read/Write
+  Property Map</a> 并且其键类型必须为图的顶点描述符类型,值类型必须符合
+  <a href="./ColorValue.html">ColorValue</a>。<br>
+  <b>缺省值:</b><tt>get(vertex_color, g)</tt><br>
+
+  <b>Python</b>: 这个颜色映射必须是图的一个 <tt>vertex_color_map</tt>。
 </blockquote>

 UTIL: <tt>buffer(Buffer&amp; Q)</tt>
-<blockquote>
-  The queue used to determine the order in which vertices will be
-  discovered.  If a FIFO queue is used, then the traversal will
-  be according to the usual BFS ordering. Other types of queues
-  can be used, but the traversal order will be different.
-  For example Dijkstra's algorithm can be implemented
-  using a priority queue. The type <tt>Buffer</tt> must be a model of
-  <a href="./Buffer.html">Buffer</a>.<br>
-  <b>Default:</b> <tt>boost::queue</tt><br>
-
-  <b>Python</b>: The buffer must derive from the <a
-  href="./Buffer.html">Buffer</a> type for the graph.
+<blockquote>该队列用于决定顶点被发现的顺序。如果用的是 FIFO 队列,则遍历顺 序为通常的 BFS 顺序。也可以使用其它类型的队列,但遍历顺序将会不同。例 如,Dijkstra 算法可以通过使用一个优先队列来实现。类型 <tt>Buffer</tt> 必须符 合 <a href="./Buffer.html">Buffer</a>。<br>
+  <b>缺省值:</b><tt>boost::queue</tt><br>
+
+ <b>Python</b>:&nbsp;该缓冲区必须派生自图的 <a href="./Buffer.html">Buffer</a> 类型。
 </blockquote>


-<H3><A NAME="SECTION001330300000000000000">
-Complexity</A>
-</H3>
-
-<P>
-The time complexity is <i>O(E)</i>.
-
-<P>
-
-<h3>Visitor Event Points</h3>
+<h3><a name="SECTION001330300000000000000">
+Complexity 复杂度</a>
+</h3>
+
+<p>时间复杂度为 <i>O(E)</i>。
+
+</p><p>
+
+</p><h3>Visitor Event Points 遍历器事件点</h3>

 <ul>
-<li><b><tt>vis.examine_vertex(u, g)</tt></b>r is invoked in each
-  vertex as it is removed from the queue.
-
-<li><b><tt>vis.examine_edge(e, g)</tt></b> is invoked on every out-edge
-  of each vertex immediately after the vertex is removed from the queue.
-
-<li><b><tt>vis.tree_edge(e, g)</tt></b> is invoked (in addition to
-  <tt>examine_edge()</tt>) if the edge is a tree edge. The
-  target vertex of edge <tt>e</tt> is discovered at this time.
-
-<li><b><tt>vis.discover_vertex(u, g)</tt></b> is invoked the first time the
-  algorithm encounters vertex <i>u</i>. All vertices closer to the
-  source vertex have been discovered, and vertices further from the
-  source have not yet been discovered.
-
-<li><b><tt>vis.non_tree_edge(e, g)</tt></b> is invoked (in addition to
-  <tt>examine_edge()</tt>) if the edge is not a tree edge.
-
-<li><b><tt>vis.gray_target(e, g)</tt></b> is invoked (in addition to
-  <tt>non_tree_edge()</tt>) if the target vertex is colored gray at the
-  time of examination. The color gray indicates that
-  the vertex is currently in the queue.
-
-<li><b><tt>vis.black_target(e, g)</tt></b> is invoked (in addition to
-  <tt>non_tree_edge()</tt>) if the target vertex is colored black at the
-  time of examination. The color black indicates that the
-  vertex is no longer in the queue.
-
-<li><b><tt>vis.finish_vertex(u, g)</tt></b> is invoked after all of the out
-  edges of <i>u</i> have been examined and all of the adjacent vertices
-  have been discovered.
-
-</ul>
-
-<h3>See Also</h3>
+<li><b><tt>vis.examine_vertex(u, g)</tt></b> 当各顶点被移出队列时被调用。
+
+</li><li><b><tt>vis.examine_edge(e, g)</tt></b> 在某顶点被移出队列时,对其 每条出边调用。
+
+</li><li><b><tt>vis.tree_edge(e, g)</tt></b> 如果该边为树边,则被调用(在
+  <tt>examine_edge()</tt> 之后)。边 <tt>e</tt> 的目标顶点在此时被发现。
+
+</li><li><b><tt>vis.discover_vertex(u, g)</tt></b> 在该算法第一次遇到顶点 <i>u</i> 时调用。所有离源顶点更近的顶点已被发出,而离源顶点更远的顶点则尚未 被发现。
+
+</li><li><b><tt>vis.non_tree_edge(e, g)</tt></b> 如是该边为非树边,则被调用 (在
+  <tt>examine_edge()</tt> 之后)。
+
+</li><li><b><tt>vis.gray_target(e, g)</tt></b> 如果目标顶点在检查时被着色为 灰色,则被调用(在
+  <tt>non_tree_edge()</tt> 之后)。灰色表示该顶点已在队列中。
+
+</li><li><b><tt>vis.black_target(e, g)</tt></b> 如果目标顶点在检查时被着色 为黑色,则被调用(在
+  <tt>non_tree_edge()</tt> 之后)。黑色表示该顶点已不在队列中。
+
+</li><li><b><tt>vis.finish_vertex(u, g)</tt></b> 当 <i>u</i> 的所有出边都完 成检查且所有邻接顶点都被发现后调用。
+
+</li></ul>
+
+<h3>See Also 参见</h3>

 <a href="./breadth_first_search.html"><tt>breadth_first_search()</tt></a>,
-<a href="./bfs_visitor.html"><tt>bfs_visitor</tt></a>, and
+<a href="./bfs_visitor.html"><tt>bfs_visitor</tt></a>, 和
 <a href="./depth_first_search.html"><tt>depth_first_search()</tt></a>

-<h3>Notes</h3>
+<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="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</A>, Indiana University (<A HREF="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</A>)
-</TD></TR></TABLE>
-
-</BODY>
-</HTML>
+ 由于 visitor 参数是以值方式传递的,所以如果你的遍历器含有状态,则在算法中 对该状态的所有修改都是针对该遍历器对象的一个拷贝,而不对传入的遍历器对象进行 的。因此你应该让该遍历器以指针或引用的方式保存该状态。<br>
+</p><hr>
+<table>
+<tbody><tr valign="top">
+<td nowrap="nowrap">Copyright © 2000-2001</td><td>
+<a href="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</a>, Indiana University (<a href="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</a>)
+</td></tr></tbody></table>
+
+</body></html>
=======================================
--- /trunk/libs/graph/doc/dag_shortest_paths.html       Mon Mar 30 07:58:04 2009
+++ /trunk/libs/graph/doc/dag_shortest_paths.html       Sun Aug  2 22:26:22 2009
@@ -1,35 +1,31 @@
-<HTML>
-<!--
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><!--
   -- Copyright (c) Jeremy Siek 2000
   --
   -- Distributed under the Boost Software License, Version 1.0.
   -- (See accompanying file LICENSE_1_0.txt or copy at
   -- http://www.boost.org/LICENSE_1_0.txt)
   -->
-<Head>
-<Title>Boost Graph Library: Directed Acyclic Graph Shortest Paths</Title>
-<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
-        ALINK="#ff0000">
-<IMG SRC="../../../boost.png"
-     ALT="C++ Boost" width="277" height="86">
-
-<BR Clear>
-
-<H1><A NAME="sec:dag_shortest_paths"></A>
-<img src="figs/python.gif" alt="(Python)"/>
-<TT>dag_shortest_paths</TT>
-</H1>
+<title>Boost Graph Library: Directed Acyclic Graph Shortest Paths</title></head> +<body alink="#ff0000" bgcolor="#ffffff" link="#0000ee" text="#000000" vlink="#551a8b">
+<img src="../../../boost.png" alt="C++ Boost" height="86" width="277">
+
+<br clear="">
+
+<h1><a name="sec:dag_shortest_paths"></a>
+<img src="figs/python.gif" alt="(Python)">
+<tt>dag_shortest_paths</tt>
+</h1>


-<P>
-<PRE>
-<i>// named paramter version</i>
+<p>
+</p><pre><i>// 命名参数版本</i>
 template &lt;class VertexListGraph, class Param, class Tag, class Rest&gt;
 void dag_shortest_paths(const VertexListGraph&amp; g,
    typename graph_traits&lt;VertexListGraph&gt;::vertex_descriptor s,
    const bgl_named_params&lt;Param,Tag,Rest&gt;&amp; params)

-<i>// non-named parameter version</i>
+<i>// 非命名参数版本</i>
 template &lt;class VertexListGraph, class DijkstraVisitor,
          class DistanceMap, class WeightMap, class ColorMap,
          class PredecessorMap,
@@ -40,287 +36,166 @@
    DistanceMap distance, WeightMap weight, ColorMap color,
    PredecessorMap pred, DijkstraVisitor vis,
    Compare compare, Combine combine, DistInf inf, DistZero zero)
-</PRE>
-
-<P>
-This algorithm&nbsp;[<A HREF="bibliography.html#clr90">8</A>] solves
-the single-source shortest-paths problem on a weighted, directed
-acyclic graph (DAG). This algorithm is more efficient for DAG's
-than either the Dijkstra or Bellman-Ford algorithm.
-Use breadth-first search instead of this algorithm
-when all edge weights are equal to one.  For the definition of the
-shortest-path problem see Section <A
-HREF="graph_theory_review.html#sec:shortest-paths-algorithms">Shortest-Paths
-Algorithms</A> for some background to the shortest-path problem.
-</P>
-
-<P>
-There are two main options for obtaining output from the
-<tt>dag_shortest_paths()</tt> function. If you provide a
-distance property map through the <tt>distance_map()</tt> parameter
-then the shortest distance from the source vertex to every other
-vertex in the graph will be recorded in the distance map. Also you can
-record the shortest paths tree in a predecessor map: for each vertex
-<i>u in V</i>, <i>p[u]</i> will be the predecessor of <i>u</i> in
-the shortest paths tree (unless <i>p[u] = u</i>, in which case <i>u</i> is
-either the source or a vertex unreachable from the source).  In
-addition to these two options, the user can provide there own
-custom-made visitor that can takes actions during any of the
-algorithm's event points.</P>
-
-<h3>Where Defined</h3>
+</pre>
+
+<p>这个算法[<a href="bibliography.html#clr90">8</a>]用于解决带权重的有向无 环图(DAG)的单源最短路径问题。该算法对于DAG来说要比 Dijkstra 或 Bellman-Ford 算法更高效。当所有的边权重均为一时,用广度优先搜索更好。关于最短路径问题的定 义及其背景请见 <a href="graph_theory_review.html#sec:shortest-paths-algorithms">最短路径算法 </a> 一节。
+</p>
+
+<p>从
+<tt>dag_shortest_paths</tt><tt>()</tt> 函数获得输出,有两个主要选项。如果你 通过 <tt>distance_map()</tt> 参数提供一个距离属性映射,则从源顶点到图中每个 顶点的最短距离将被记录在这个距离映射中。你还可以将最短路径树记录在一个前趋映 射中:对于<i> V</i> 中的每个顶点 +<i>u</i>,<i>p[u]</i> 为顶点 <i>u</i> 在最短路径树中的前趋(除非 <i>p[u] = u</i>,此时 <i>u</i> 为源顶点或某个不能从源顶点到达的顶点)。除了这两个选 项,用户还可以提供他们自己定制的遍历器,在算法中的某些事件点上执行动作。 <br></p><h3>Where Defined 定义于</h3>

<a href="../../../boost/graph/dag_shortest_paths.hpp"><tt>boost/graph/dag_shortest_paths.hpp</tt></a>

-<h3>Parameters</h3>
+<h3>Parameters 参数</h3>

 IN: <tt>const VertexListGraph&amp; g</tt>
-<blockquote>
-  The graph object on which the algorithm will be applied.
- The type <tt>VertexListGraph</tt> must be a model of \concept{VertexListGraph}.<br>
-
-  <b>Python</b>: The parameter is named <tt>graph</tt>.
+<blockquote>应用该算法的图对象。类型&nbsp;<tt>VertexListGraph</tt> 必须符合
+  <a href="VertexListGraph.html">点列表图Vertex List Graph</a>。<br>
+
+
+
+  <b>Python</b>: 该参数被命名为 <tt>graph</tt>.
 </blockquote>

 IN: <tt>vertex_descriptor s</tt>
-<blockquote>
-  The source vertex. All distance will be calculated from this vertex,
-  and the shortest paths tree will be rooted at this vertex.<br>
-
-  <b>Python</b>: The parameter is named <tt>root_vertex</tt>.
+<blockquote>源顶点。所有距离都是从这个顶点开始计算,且最短路径树以此点为 根。<br>
+
+
+
+  <b>Python</b>: 该参数被命名为 <tt>root_vertex</tt>.&nbsp;
 </blockquote>

-<h3>Named Parameters</h3>
+<h3>Named Parameters 命名参数</h3>

 IN: <tt>weight_map(WeightMap w_map)</tt>
-<blockquote>
-  The weight or ``length'' of each edge in the graph.
-  The type <tt>WeightMap</tt> must be a model of
- <a href="../../property_map/ReadablePropertyMap.html">Readable Property Map</a>. The edge descriptor type of
-  the graph needs to be usable as the key type for the weight
-  map. The value type for the map must be
-  <i>Addable</i> with the value type of the distance map.<br>
-  <b>Default:</b>  <tt>get(edge_weight, g)</tt><br>
-  <b>Python</b>: Must be an <tt>edge_double_map</tt> for the graph.<br>
-  <b>Python default</b>: <tt>graph.get_edge_double_map("weight")</tt>
+<blockquote>图中每条边的权重或"长度"。类型 <tt>WeightMap</tt> 必须符合
+ <a href="../../property_map/ReadablePropertyMap.html">可读属性映射</a>。 图的边描述符类型必须可用作这个权重映射的键类型。该映射的值类型必须与距离映射 的值类型相同。<br>
+  <b>缺省值:</b><tt>get(edge_weight, g)</tt><br>
+
+  <b>Python</b>: 必须为该图的一个 <tt>edge_double_map</tt>。<br>
+  <b>Python 缺省值:</b><tt>graph.get_edge_double_map("weight")</tt>

 </blockquote>

 IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
-<blockquote>
-  This maps each vertex to an integer in the range <tt>[0,
-    num_vertices(g))</tt>. This is necessary for efficient updates of the
-  heap data structure when an edge is relaxed.  The type
-  <tt>VertexIndexMap</tt> must be a model of
- <a href="../../property_map/ReadablePropertyMap.html">Readable Property Map</a>. The value type of the map must be an
-  integer type. The vertex descriptor type of the graph needs to be
-  usable as the key type of the map.<br>
-  <b>Default:</b> <tt>get(vertex_index, g)</tt>.
-    Note: if you use this default, make sure your graph has
-    an internal <tt>vertex_index</tt> property. For example,
-    <tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
-    not have an internal <tt>vertex_index</tt> property.<br>
-
-  <b>Python</b>: Unsupported parameter.
+<blockquote>它将每个顶点映射至位于区间 <tt>[0,
+ num_vertices(g))</tt> 中的一个整数。当某条边被松驰时,堆数据结构必须可以 高效地更新。类型 <tt>VertexIndexMap</tt> + 必须符合 <a href="../../property_map/ReadablePropertyMap.html">可读属性映 射</a>。该映射的值类型必须是一个整数类型。图的顶点描述符类型需要可以被用作该 映射的键类型。<br>
+
+
+  <b>缺省值:</b><tt>get(vertex_index, g)</tt>.
+ 注意:如果你使用该缺省值,请确认你的图具有一个内部的 <tt>vertex_index</tt> 属性。例如,带 <tt>VertexList=listS</tt> 的
+    <tt>adjacenty_list</tt> 并不具有内部的 <tt>vertex_index</tt> 属性。<br>
+
+  <b>Python</b>: 不支持该参数。&nbsp;&nbsp;
 </blockquote>

 OUT: <tt>predecessor_map(PredecessorMap p_map)</tt>
-<blockquote>
-  The predecessor map records the edges in the minimum spanning
-  tree. Upon completion of the algorithm, the edges <i>(p[u],u)</i>
-  for all <i>u in V</i> are in the minimum spanning tree. If <i>p[u] =
-  u</i> then <i>u</i> is either the source vertex or a vertex that is
-  not reachable from the source.  The <tt>PredecessorMap</tt> type
-  must be a <a
-  href="../../property_map/ReadWritePropertyMap.html">Read/Write
-  Property Map</a> which key and vertex types the same as the vertex
-  descriptor type of the graph.<br>
-  <b>Default:</b> <tt>dummy_property_map</tt><br>
-  <b>Python</b>: Must be a <tt>vertex_vertex_map</tt> for the graph.<br>
+<blockquote>这个前趋映射用于记录最小生成树中的边。当该算法结束后,对于<i> V</i> 中的所有 <i>u</i>,边 <i>(p[u],u)</i>&nbsp;<span style="font-style: italic;"></span>均属于最小生成树。如果 <i>p[u] = + u</i> 则 <i>u</i> 为源顶点或某个不能从源顶点到达的顶点。类型 <tt>PredecessorMap</tt> 必须符合 <a href="../../property_map/ReadWritePropertyMap.html">读/写属性映射</a>,且其 键类型和值类型均与图的顶点描述符类型相同。<br>
+  <b>缺省值:</b><tt>dummy_property_map</tt><br>
+
+  <b>Python</b>: 必须为该图的一个 <tt>vertex_vertex_map</tt>。<br>
 </blockquote>

 UTIL/OUT: <tt>distance_map(DistanceMap d_map)</tt>
-<blockquote>
-  The shortest path weight from the source vertex <tt>s</tt> to each
-  vertex in the graph <tt>g</tt> is recorded in this property map. The
-  shortest path weight is the sum of the edge weights along the
-  shortest path.  The type <tt>DistanceMap</tt> must be a model of <a
-  href="../../property_map/ReadWritePropertyMap.html">Read/Write
-  Property Map</a>. The vertex descriptor type of the graph needs to
-  be usable as the key type of the distance map.
-
-  The value type of the distance map is the element type of a <a
-  href="./Monoid.html">Monoid</tt> formed with the <tt>combine</tt>
-  function object and the <tt>zero</tt> object for the identity
-  element. Also the distance value type must have a <a
-  href="http://www.sgi.com/tech/stl/StrictWeakOrdering.html";>
-  StrictWeakOrdering</a> provided by the <tt>compare</tt> function
-  object.<br>
-  <b>Default:</b> <a
-  href="../../property_map/iterator_property_map.html">
-  <tt>iterator_property_map</tt></a> created from a
-  <tt>std::vector</tt> of the <tt>WeightMap</tt>'s value type of size
-  <tt>num_vertices(g)</tt> and using the <tt>i_map</tt> for the index
-  map.<br>
-
-  <b>Python</b>: Must be a <tt>vertex_double_map</tt> for the graph.
+<blockquote>从源顶点 <tt>s</tt> 到图 <tt>g</tt> 中每个顶点的最短路径权重被 记录在这个属性映射中。最短路径权重为最短路径上各边权重之和。类型 <tt>DistanceMap</tt> 必须符合 <a href="../../property_map/ReadWritePropertyMap.html">读/写属性映射</a>。图的 顶点描述符类型必须可被用作这个距离映射的键类型。距离映射的值类型是一个 <a href="Monoid.html">Monoid</a> 的元素类型,它是由组合函数对象和 identity 元素 的"零"对象形成的。此外,距离值类型还必须具有由 <tt>compare</tt> 函数对象提供 的一个 <a href="http://www.sgi.com/tech/stl/StrictWeakOrdering.html";>
+  严格弱序</a>。<br>
+ <b>缺省值:</b><a href="../../property_map/iterator_property_map.html"><tt>iterator_property_map</tt></a> 创建自一个值类型为 <tt>WeightMap</tt>,大小为
+  <tt>num_vertices(g)</tt> 的
+ <tt>std::vector</tt><span style="font-family: monospace;">,</span>且以 <tt>i_map</tt> 作为索引映射。<br>
+
+  <b>Python</b>: 必须为该图的一个 <tt>vertex_double_map</tt>。
 </blockquote>

 IN: <tt>distance_compare(CompareFunction cmp)</tt>
-<blockquote>
-  This function is use to compare distances to determine which vertex
-  is closer to the source vertex.  The <tt>CompareFunction</tt> type
-  must be a model of <a
-  href="http://www.sgi.com/tech/stl/BinaryPredicate.html";>Binary
-  Predicate</a> and have argument types that match the value type of
-  the <tt>DistanceMap</tt> property map.<br>
-
-  <b>Default:</b>
-  <tt>std::less&lt;D&gt;</tt> with <tt>D=typename
+<blockquote>该函数用于比较距离,以决定哪个顶点更接近于源顶点。类型 <tt>CompareFunction</tt> 必须符合 <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html";>二元谓词</a> 且其参 数类型要与 <tt>DistanceMap</tt> 属性映射的值类型相匹配。<br>
+
+  <b>缺省值:</b><tt>std::less&lt;D&gt;</tt> 其中 <tt>D=typename
   property_traits&lt;DistanceMap&gt;::value_type</tt><br>

-  <b>Python</b>: Unsupported parameter.
+  <b>Python</b>:&nbsp;不支持该参数。
+
 </blockquote>

 IN: <tt>distance_combine(CombineFunction cmb)</tt>
-<blockquote>
-  This function is used to combine distances to compute the distance
-  of a path. The <tt>CombineFunction</tt> type must be a model of <a
-  href="http://www.sgi.com/tech/stl/BinaryFunction.html";>Binary
-  Function</a>. The first argument type of the binary function must
-  match the value type of the <tt>DistanceMap</tt> property map and
-  the second argument type must match the value type of the
-  <tt>WeightMap</tt> property map.  The result type must be the same
-  type as the distance value type.<br>
-
-  <b>Default:</b> <tt>std::plus&lt;D&gt;</tt> with
+<blockquote>该函数用于将距离相加,以计算一条路径的距离。类型 <tt>CombineFunction</tt> 必须符合 <a href="http://www.sgi.com/tech/stl/BinaryFunction.html";>二元谓词</a>。该二元 函数的第一个参数类型必须与 <tt>DistanceMap</tt> 属性映射的值类型相匹配,第二 个参数类型必须与 + <tt>WeightMap</tt> 属性映射的值类型相匹配。结果类型必须与距离值类型相同。 <br>
+
+  <b>缺省值:</b><tt>std::plus&lt;D&gt;</tt> 其中
    <tt>D=typename property_traits&lt;DistanceMap&gt;::value_type</tt><br>

-  <b>Python</b>: Unsupported parameter.
+  <b>Python</b>:&nbsp;不支持该参数。&nbsp;
 </blockquote>

 IN: <tt>distance_inf(D inf)</tt>
 <blockquote>
- The <tt>inf</tt> object must be the greatest value of any <tt>D</tt> object.
-  That is, <tt>compare(d, inf) == true</tt> for any <tt>d != inf</tt>.
-  The type <tt>D</tt> is the value type of the <tt>DistanceMap</tt>.<br>
-  <b>Default:</b> <tt>std::numeric_limits&lt;D&gt;::max()</tt><br>
-
-  <b>Python</b>: Unsupported parameter.
+ <tt>inf</tt> 对象必须是任意 <tt>D</tt> 对象中的最大值。 即,<tt>compare(d, inf) == true</tt> 对于任意 <tt>d != inf</tt> 成立。类型 <tt>D</tt> 为 <tt>DistanceMap</tt> 的值类型。<br>
+  <b>缺省值:</b><tt>std::numeric_limits&lt;D&gt;::max()</tt><br>
+
+  <b>Python</b>:&nbsp;不支持该参数。
 </blockquote>

 IN: <tt>distance_zero(D zero)</tt>
-<blockquote>
-  The <tt>zero</tt> value must be the identity element for the
-  <a href="./Monoid.html">Monoid</a> formed by the distance values
-  and the <tt>combine</tt> function object.
-  The type \code{D} is the value type of the \code{DistanceMap}
-  <b>Default:</b> <tt>D()</tt><br>
-
-  <b>Python</b>: Unsupported parameter.
+<blockquote>这个"零"值必须是
+ <a href="Monoid.html">Monoid</a> 的 identity 元素,<a href="Monoid.html">Monoid</a> 由距离值和组合函数对象形成。类型 <tt>D</tt> 为 <tt>DistanceMap</tt> 的值类型。<br>
+  <b>缺省值:</b><tt>D()</tt> 其中
+   <tt>D=typename property_traits&lt;DistanceMap&gt;::value_type</tt><br>
+
+  <b>Python</b>:&nbsp;不支持该参数。&nbsp;
 </blockquote>

 UTIL/OUT: <tt>color_map(ColorMap c_map)</tt>
-<blockquote>
-  This is used during the execution of the algorithm to mark the
-  vertices. The vertices start out white and become gray when they are
-  inserted in the queue. They then turn black when they are removed
-  from the queue. At the end of the algorithm, vertices reachable from
-  the source vertex will have been colored black. All other vertices
-  will still be white. The type <tt>ColorMap</tt> must be a model of
-  <a href="../../property_map/ReadWritePropertyMap.html">Read/Write
-  Property Map</a>. A vertex descriptor must be usable as the key type
-  of the map, and the value type of the map must be a model of
-  <a href="./ColorValue.html">Color Value</a>.<br>
-  <b>Default:</b> an <a
-  href="../../property_map/iterator_property_map.html">
-  <tt>iterator_property_map</tt></a> created from a <tt>std::vector</tt>
-  of <tt>default_color_type</tt> of size <tt>num_vertices(g)</tt> and
-  using the <tt>i_map</tt> for the index map.<br>
-
-  <b>Python</b>: The color map must be a <tt>vertex_color_map</tt> for
-  the graph.
+<blockquote>用于在算法的执行期间对顶点进行标记。各顶点在开始时为白色,当被 插入队列时变为灰色。当被从队列中移出时变为黑色。在算法结束时,可以从源顶点到 达的所有顶点均变为黑色。其它所有顶点仍为白色。类型 <tt>ColorMap</tt> 必须符 + <a href="../../property_map/ReadWritePropertyMap.html">读/写属性映射 </a>。顶点描述符必须可被用作该映射的键类型,且该映射的值类型必须符合
+  <a href="ColorValue.html">颜色值Color Value</a>。<br>
+ <b>缺省值:</b>一个 <a href="../../property_map/iterator_property_map.html"> + <tt>iterator_property_map</tt></a>,创建自一个大小为 <tt>num_vertices(g)</tt> 的 <tt>default_color_type</tt> 的 <tt>std::vector</tt>,且以 <tt>i_map</tt> 作为索引映射。<br>
+
+  <b>Python</b>: 颜色映射必须是该图的一个 <tt>vertex_color_map</tt>。

 </blockquote>

 OUT: <tt>visitor(DijkstraVisitor v)</tt>
-<blockquote>
-  Use this to specify actions that you would like to happen
-  during certain event points within the algorithm.
-  The type <tt>DijkstraVisitor</tt> must be a model of the
-  <a href="./DijkstraVisitor.html">Dijkstra Visitor</a> concept.
- The visitor object is passed by value <a
-  href="#1">[1]</a>.<br>
-  <b>Default:</b> <tt>dijkstra_visitor&lt;null_visitor&gt;</tt><br>
-
-  <b>Python</b>: The parameter should be an object that derives from
-  the <a
-  href="DijkstraVisitor.html#python"><tt>DijkstraVisitor</tt></a> type
-  of the graph.
+<blockquote>用于指定你想在算法内某些特定事件点上执行的动作。类型 <tt>DijkstraVisitor</tt> 必须符合 + <a href="DijkstraVisitor.html">Dijkstra 遍历器</a> 概念。该遍历器对象是以 值方式传递的<a href="dag_shortest_paths.html#1">[1]</a><a href="dijkstra_shortest_paths.html#2"></a>。<br>
+  <b>缺省值:</b><tt>dijkstra_visitor&lt;null_visitor&gt;</tt><br>
+
+ <b>Python</b>: 该参数应为派生自该图的&nbsp;<a href="DijkstraVisitor.html#python"><tt>DijkstraVisitor</tt></a> 类型的一个对 象。
 </blockquote>


-<H3>Complexity</H3>
-
-<P>
-The time complexity is <i>O(V + E)</i>.
-
-<h3>Visitor Event Points</h3>
+<h3>Complexity 复杂度</h3>
+
+<p>时间复杂度为 <i>O(V + E)</i>.
+
+</p><h3>Visitor Event Points 遍历器事件点</h3>

 <ul>
-<li><b><tt>vis.initialize_vertex(u, g)</tt></b>
-  is invoked on each vertex in the graph before the start of the
-  algorithm.
-<li><b><tt>vis.examine_vertex(u, g)</tt></b>
-  is invoked on a vertex as it is added to set <i>S</i>.
-  At this point we know that <i>(p[u],u)</i>
-  is a shortest-paths tree edge so
-  <i>d[u] = delta(s,u) = d[p[u]] + w(p[u],u)</i>. Also, the distances
-  of the examined vertices is monotonically increasing
-  <i>d[u<sub>1</sub>] <= d[u<sub>2</sub>] <= d[u<sub>n</sub>]</i>.
-<li><b><tt>vis.examine_edge(e, g)</tt></b>
-  is invoked on each out-edge of a vertex immediately after it has
-  been added to set <i>S</i>.
-<li><b><tt>vis.edge_relaxed(e, g)</tt></b>
-  is invoked on edge <i>(u,v)</i> if <i>d[u] + w(u,v) < d[v]</i>.
-  The edge <i>(u,v)</i> that participated in the last
-  relaxation for vertex <i>v</i> is an edge in the shortest paths tree.
-<li><b><tt>vis.discover_vertex(v, g)</tt></b>
-  is invoked on vertex <i>v</i> when the edge
-  <i>(u,v)</i> is examined and <i>v</i> is WHITE. Since
-  a vertex is colored GRAY when it is discovered,
-  each reacable vertex is discovered exactly once.
-<li><b><tt>vis.edge_not_relaxed(e, g)</tt></b>
-  is invoked if the edge is not relaxed (see above).
-<li><b><tt>vis.finish_vertex(u, g)</tt></b>
-   is invoked on a vertex after all of its out edges have
-  been examined.
-</ul>
-
-<H3>Example</H3>
-
-<P>
-See <a href="../example/dag_shortest_paths.cpp">
-<TT>example/dag_shortest_paths.cpp</TT></a> for an example of using this
-algorithm.
-
-<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="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</A>, Indiana University (<A HREF="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</A>)
-</TD></TR></TABLE>
-
-</BODY>
-</HTML>
-
+<li><b><tt>vis.initialize_vertex(</tt></b><b><tt>u</tt></b><b><tt>, g)</tt></b> 在算法开始前对图中每个顶点调用。
+
+</li><li><b><tt>vis.examine_vertex(u, g)</tt></b> 当各顶点被移出优先队列并 加入集合 <i>S</i> 时被调用。在此点上,我们知道 <i>(p[u],u)</i> + 是最短路径树的一条边,因此 <i>d[u] = delta(s,u) = d[p[u]] + w(p[u],u)</i>。另外,已被检查的顶点的距离是单调递增的,<i>d[u<sub>1</sub>] &lt;= d[u<sub>2</sub>] &lt;= d[u<sub>n</sub>]</i>.
+
+</li><li><b><tt>vis.examine_edge(e, g)</tt></b> 在某顶点被加入至集合 <i>S</i> 后,立即对其每条出边调用。</li><li><b><tt>vis.edge_relaxed(e, g)</tt></b> + 对满足 <i>d[u] + w(u,v) &lt; d[v]</i> 的边 <i>(u,v)</i> 调用。参与顶点 <i>v</i> 最后一次松驰的边 <i>(u,v)</i> 为最短路径树的一条边。 </li><li><b><tt>vis.discover_vertex(v, g)</tt></b> 当边 <i>(u,v)</i> 被检查 且 <i>v</i> 为 WHITE 时对顶点 <i>v</i> 调用。由于顶点在被发现时着色为 GRAY,所以每个可到达顶点只会被发现一次。 </li><li><b><tt>vis.edge_not_relaxed(e, g)</tt></b> + 当某条边未能被松驰时调用(见上)。</li><li><b><tt>vis.finish_vertex(u, g)</tt></b> 当某个顶点的所有出边都完成检查后调用。</li></ul>
+
+<h3>Example 示例</h3>
+
+<p>使用该算法的例子请见 <a href="../example/dag_shortest_paths.cpp">
+<tt>example/dag_shortest_paths.cpp</tt></a>。
+
+</p><h3>Notes 备注</h3>
+
+<p><a name="1">[1]</a>
+ 由于 visitor 参数是以值方式传递的,所以如果你的遍历器含有状态,则在算法中 对该状态的所有修改都是针对该遍历器对象的一个拷贝,而不对传入的遍历器对象进行 的。因此你应该让该遍历器以指针或引用的方式保存该状态。<br>
+</p><hr>
+<table>
+<tbody><tr valign="top">
+<td nowrap="nowrap">Copyright © 2000-2001</td><td>
+<a href="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</a>, Indiana University (<a href="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</a>)
+</td></tr></tbody></table>
+
+</body></html>
=======================================
--- /trunk/libs/graph/doc/depth_first_search.html       Mon Jun  1 21:27:33 2009
+++ /trunk/libs/graph/doc/depth_first_search.html       Sun Aug  2 22:26:22 2009
@@ -1,314 +1,190 @@
-<HTML>
-<!--
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><!--
   -- Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000
   --
   -- Distributed under the Boost Software License, Version 1.0.
   -- (See accompanying file LICENSE_1_0.txt or copy at
   -- http://www.boost.org/LICENSE_1_0.txt)
   -->
-<Head>
-<Title>Boost Graph Library: Depth-First Search</Title>
-<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
-        ALINK="#ff0000">
-<IMG SRC="../../../boost.png"
-     ALT="C++ Boost" width="277" height="86">
-
-<BR Clear>
-
-<H1><A NAME="sec:depth-first-search"></A><img src="figs/python.gif" alt="(Python)"/>
-<TT>depth_first_search</TT>
-</H1>
-
-<P>
-<PRE>
-<i>// named parameter version</i>
+<title>Boost Graph Library: Depth-First Search</title></head>
+<body alink="#ff0000" bgcolor="#ffffff" link="#0000ee" text="#000000" vlink="#551a8b">
+<img src="../../../boost.png" alt="C++ Boost" height="86" width="277">
+
+<br clear="">
+
+<h1><a name="sec:depth-first-search"></a><img src="figs/python.gif" alt="(Python)">
+<tt>depth_first_search</tt>
+</h1>
+
+<p>
+</p><pre><i>// named parameter version</i>
 template &lt;class Graph, class class P, class T, class R&gt;
 void depth_first_search(Graph&amp; G,
   const bgl_named_params&lt;P, T, R&gt;&amp; params);

 <i>// non-named parameter version</i>
-template &lt;class Graph, class <a href="DFSVisitor.html">DFSVisitor</a>, class ColorMap&gt;
-void depth_first_search(const Graph&amp; g, DFSVisitor vis, ColorMap color)
-
-template &lt;class Graph, class <a href="DFSVisitor.html">DFSVisitor</a>, class ColorMap&gt;
-void depth_first_search(const Graph&amp; g, DFSVisitor vis, ColorMap color,
- typename graph_traits&lt;Graph&gt;::vertex_descriptor start)
-
-</PRE>
+template &lt;class Graph, class <a href="DFSVisitor.html">DFSVisitor</a>, class ColorMap&gt;<br>void depth_first_search(const Graph&amp; g, DFSVisitor vis, ColorMap color)<br><br>template &lt;class Graph, class <a href="DFSVisitor.html">DFSVisitor</a>, class ColorMap&gt;<br>void depth_first_search(const Graph&amp; g, DFSVisitor vis, ColorMap color, <br> typename graph_traits&lt;Graph&gt;::vertex_descriptor start)<br><br></pre>

 <p>
-The <tt>depth_first_search()</tt> function performs a depth-first
-traversal of the vertices in a directed graph.  When
-possible, a depth-first traversal chooses a vertex adjacent to the
-current vertex to visit next. If all adjacent vertices have already
-been discovered, or there are no adjacent vertices, then the algorithm
-backtracks to the last vertex that had undiscovered neighbors. Once
-all reachable vertices have been visited, the algorithm selects from
-any remaining undiscovered vertices and continues the traversal. The
-algorithm finishes when all vertices have been visited. Depth-first
-search is useful for categorizing edges in a graph, and for imposing
-an ordering on the vertices. Section <a
-href="./graph_theory_review.html#sec:dfs-algorithm">Depth-First
-Search</a> describes the various properties of DFS and walks through
-an example.
+函数 <tt>depth_first_search()</tt>
+对一个有向图执行深度优先的遍历。在可能的时候,深度优先遍历选择邻接于当前顶 点的一个顶点来作为下一个顶点访问。如果所有邻接顶点均已被发现,或者没有 +邻接顶点,则该算法回溯至带有未被发现的邻接顶点的最后一个顶点。一旦所有可到 达顶点均被访问,该算法就选择剩下的任一个未发现顶点来继续遍历。当所有顶 +点都被访问,该算法结束。深度优先搜索可用于对图中的边进行分类,并对顶点施加 一个顺序。<a href="./graph_theory_review.html#sec:dfs-algorithm">深度优先搜 索</a> 一节描述了DFS的各种特性并举了一个例子。
 </p>

-<p>
-Similar to BFS, color markers are used to keep track of which vertices
-have been discovered. White marks vertices that have yet to be
-discovered, gray marks a vertex that is discovered but still has
-vertices adjacent to it that are undiscovered. A black vertex is
-discovered vertex that is not adjacent to any white vertices.
-<p>
-
-<p>
-The <tt>depth_first_search()</tt> function invokes user-defined
-actions at certain event-points within the algorithm. This provides a
-mechanism for adapting the generic DFS algorithm to the many
-situations in which it can be used.  In the pseudo-code below, the
-event points for DFS are the labels on
-the right. The user-defined actions must be provided in the form of a
-visitor object, that is, an object whose type meets the requirements
-for a <a href="./DFSVisitor.html">DFS Visitor</a>. In the pseudo-code
-we show the algorithm computing predecessors <i>p</i>, discover time
-<i>d</i> and finish time <i>t</i>.  By default, the
-<tt>depth_first_search()</tt> function does not compute these
-properties, however there are pre-defined visitors such as <a
-href="./predecessor_recorder.html"><tt>predecessor_recorder</tt></a>
-and <a href="./time_stamper.html"><tt>time_stamper</tt></a> that can
-be used to do this.
+<p>类似于 BFS,颜色着色器用于跟踪哪些顶点已被发现。白色表示顶点尚未被发 现,灰色表示顶点已被发现但有邻接顶点未被发现。黑色表示已被发现的顶点且没有白 色的邻接顶点。 +</p><p>函数 <tt>depth_first_search()</tt> 可以在算法内部的特定事件点调用用 户自定义的动作。这提供了一种机制,将普通的DFS算法适配至多种可以使用它的情 形。在以下伪代码中,DFS的事件点在右侧标出。用户自定义的动作必须以遍历器对象 的形式提供,即一个其类型符合 <a href="./DFSVisitor.html">DFS 遍历器</a> 要求 的对象。在以下伪代码中,我们示范了这个算法,计算出前趋 <i>p</i>, 发现时间
+<i>d</i> 和结束 时间 <i>t</i>。缺省情况下,函数
+<tt>depth_first_search()</tt> 不计算这三项属性,但是我们提供了预定义的遍历 器 <a href="./predecessor_recorder.html"><tt>predecessor_recorder</tt></a> 和 <a href="./time_stamper.html"><tt>time_stamper</tt></a>,它们可用于实现这 些功能。
 </p>

 <table>
-<tr>
+<tbody><tr>
 <td valign="top">
-<pre>
-DFS(<i>G</i>)
-  <b>for</b> each vertex <i>u in V</i>
-    <i>color[u] :=</i> WHITE
-    <i>p[u] = u</i>
-  <b>end for</b>
+<pre>DFS(<i>G</i>)<br> <b>for</b> each vertex <i>u in V</i> <br> <i>color[u] :=</i> WHITE<br> <i>p[u] = u</i> <br> <b>end for</b>
   <i>time := 0</i>
   <b>if</b> there is a starting vertex <i>s</i>
-    <b>call</b> DFS-VISIT(<i>G</i>, <i>s</i>)
-  <b>for</b> each vertex <i>u in V</i>
-    <b>if</b> <i>color[u] =</i> WHITE
-      <b>call</b> DFS-VISIT(<i>G</i>, <i>u</i>)
-  <b>end for</b>
+ <b>call</b> DFS-VISIT(<i>G</i>, <i>s</i>)<br> <b>for</b> each vertex <i>u in V</i> <br> <b>if</b> <i>color[u] =</i> WHITE<br> <b>call</b> DFS-VISIT(<i>G</i>, <i>u</i>)<br> <b>end for</b>
   return (<i>p</i>,<i>d_time</i>,<i>f_time</i>) <br>
-DFS-VISIT(<i>G</i>, <i>u</i>)
-  <i>color[u] :=</i> GRAY
-  <i>d_time[u] := time := time + 1</i>
-  <b>for</b> each <i>v in Adj[u]</i>
-    <b>if</b> (<i>color[v] =</i> WHITE)
-      <i>p[v] = u</i>
-      <b>call</b> DFS-VISIT(<i>G</i>, <i>v</i>)
-    <b>else if</b> (<i>color[v] =</i> GRAY)
-      <i>...</i>
-    <b>else if</b> (<i>color[v] =</i> BLACK)
-      <i>...</i>
+DFS-VISIT(<i>G</i>, <i>u</i>) <br> <i>color[u] :=</i> GRAY<br> <i>d_time[u] := time := time + 1</i> <br> <b>for</b> each <i>v in Adj[u]</i> <br> <b>if</b> (<i>color[v] =</i> WHITE)<br> <i>p[v] = u</i> <br> <b>call</b> DFS-VISIT(<i>G</i>, <i>v</i>)<br> <b>else if</b> (<i>color[v] =</i> GRAY) <br> <i>...</i>
+    <b>else if</b> (<i>color[v] =</i> BLACK) <br>      <i>...</i>
   <b>end for</b>
-  <i>color[u] :=</i> BLACK
-  <i>f_time[u] := time := time + 1</i>
-<pre>
-</td>
+ <i>color[u] :=</i> BLACK<br> <i>f_time[u] := time := time + 1</i> <br><pre></pre></pre></td>
 <td valign="top">
-<pre>
+<pre>-<br>-<br>初始化顶点 <i>u</i>
 -
 -
-initialize vertex <i>u</i>
 -
 -
+开始顶点 <i>s</i>
 -
 -
-start vertex <i>s</i>
+开始顶点 <i>u</i>
 -
 -
-start vertex <i>u</i>
 -
 -
+发现顶点 <i>u</i>
 -
+检查边 <i>(u,v)</i>
 -
-discover vertex <i>u</i>
--
-examine edge <i>(u,v)</i>
--
-<i>(u,v)</i> is a tree edge
--
--
-<i>(u,v)</i> is a back edge
--
-<i>(u,v)</i> is a cross or forward edge
--
-finish vertex <i>u</i>
+<i>(u,v)</i> 为树边<br>-<br>-<br><i>(u,v)</i> 为反向边 <br>-<br><i>(u,v)</i> 为交叉边或前向边<br>-<br>结束顶点 <i>u</i>
 -
 </pre>
 </td>
 </tr>
-</table>
+</tbody></table>



-<H3>Where Defined</H3>
-
-<P>
-<a href="../../../boost/graph/depth_first_search.hpp"><TT>boost/graph/depth_first_search.hpp</TT></a>
-
-<h3>Parameters</h3>
+<h3>Where Defined 定义于</h3>
+
+<p>
+<a href="../../../boost/graph/depth_first_search.hpp"><tt>boost/graph/depth_first_search.hpp</tt></a>
+
+</p><h3>Parameters 参数</h3>

 IN: <tt>Graph&amp; g</tt>
-<blockquote>
-  A directed graph. The graph type must
-  be a model of <a href="./IncidenceGraph.html">Incidence Graph</a>
-  and <a href="./VertexListGraph.html">Vertex List Graph</a>.<br>
-
-  <b>Python</b>: The parameter is named <tt>graph</tt>.
+<blockquote>一个有向图。图的类型必须符合 <a href="./IncidenceGraph.html">关 联图Incidence Graph</a> 和 <a href="./VertexListGraph.html">点列表图Vertex List Graph</a>。<br>
+
+  <b>Python</b>:&nbsp;该参数被命名为 <tt>graph</tt>.
 </blockquote>


-<h3>Named Parameters</h3>
+<h3>Named Parameters 命名参数</h3>

 IN: <tt>visitor(DFSVisitor vis)</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>. <br> <b>Default:</b>
-  <tt>dfs_visitor&lt;null_visitor&gt;</tt><br>
-
-  <b>Python</b>: The parameter should be an object that derives from
-  the <a href="DFSVisitor.html#python"><tt>DFSVisitor</tt></a> type of
-  the graph.
+<blockquote>一个遍历器对象,在算法内部某些由 <a href="DFSVisitor.html">DFS
+ 遍历器</a> 概念所指定的事件点被调用。这个遍历器对象是以值方式传递的<a href="#1">[1]</a>。<br> <b>缺省 值:</b><tt>dfs_visitor&lt;null_visitor&gt;</tt><br>
+
+ <b>Python</b>: 该参数应为派生自该图的&nbsp;<a href="DFSVisitor.html#python"><tt>DFSVisitor</tt></a> <a href="BFSVisitor.html#python"><tt></tt></a>类型的一个对象。
 </blockquote>

 UTIL/OUT: <tt>color_map(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 must model
-  <a href="./ColorValue.html">ColorValue</a>.<br>
-  <b>Default:</b> an <a
-  href="../../property_map/iterator_property_map.html">
-  </tt>iterator_property_map</tt></a> created from a
-  <tt>std::vector</tt> of <tt>default_color_type</tt> of size
-  <tt>num_vertices(g)</tt> and using the <tt>i_map</tt> for the index
-  map.<br>
-
-   <b>Python</b>: The color map must be a <tt>vertex_color_map</tt> for
-  the graph.
+<blockquote>被该算法用于跟踪对图的处理过程。类型 <tt>ColorMap</tt> 必须符 合 <a href="../../property_map/ReadWritePropertyMap.html">读/写属性映射</a> 并且其键类型必须为图的顶点描述符类型,值类型必须符合
+  <a href="ColorValue.html">颜色值ColorValue</a>。<br>
+
+ <b>缺省值:</b>一个 <a href="../../property_map/iterator_property_map.html">
+  iterator_property_map</a>,创建自一个大小为
+  <tt>num_vertices(g)</tt>,值为 <tt>default_color_type</tt> 的
+  <tt>std::vector</tt>,且使用 <tt>i_map</tt> 作为索引映射。<br>
+
+
+
+  <b>Python</b>: 这个颜色映射必须是图的一个 <tt>vertex_color_map</tt>。
 </blockquote>

 IN: <tt>root_vertex(typename
 graph_traits&lt;VertexListGraph&gt;::vertex_descriptor start)</tt>
-<blockquote>
-  This specifies the vertex that the depth-first search should
-  originate from. The type is the type of a vertex descriptor for the
-  given graph.<br>
-  <b>Default:</b> <tt>*vertices(g).first</tt><br>
+<blockquote>指定深度优先搜索开始的顶点。类型为给定图的顶点描述符类型。<br>
+  <b>缺省值:</b><tt>*vertices(g).first</tt><br>
 </blockquote>

 IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
-<blockquote>
-  This maps each vertex to an integer in the range <tt>[0,
-  num_vertices(g))</tt>. This parameter is only necessary when the
-  default color property map is used. The type <tt>VertexIndexMap</tt>
-  must be a model of <a
-  href="../../property_map/ReadablePropertyMap.html">Readable Property
-  Map</a>. The value type of the map must be an integer type. The
-  vertex descriptor type of the graph needs to be usable as the key
-  type of the map.<br>
-
-  <b>Default:</b> <tt>get(vertex_index, g)</tt>.
-    Note: if you use this default, make sure your graph has
-    an internal <tt>vertex_index</tt> property. For example,
-    <tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
-    not have an internal <tt>vertex_index</tt> property.<br>
-
-  <b>Python</b>: Unsupported parameter.
+<blockquote>它将每个顶点映射至位于区间 <tt>[0,
+ num_vertices(g))</tt> 中的一个整数。仅当缺省颜色属性映射被使用时,需要这 个参数。类型 <tt>VertexIndexMap</tt> + 必须符合 <a href="../../property_map/ReadablePropertyMap.html">可读属性映 射</a>。该映射的值类型必须是一个整数类型。图的顶点描述符类型需要可以被用作该 映射的键类型。<br>
+
+
+
+  <b>缺省值:</b><tt>get(vertex_index, g)</tt>.
+ 注意:如果你使用该缺省值,请确认你的图具有一个内部的 <tt>vertex_index</tt> 属性。例如,带 <tt>VertexList=listS</tt> 的
+    <tt>adjacenty_list</tt> 并不具有内部的 <tt>vertex_index</tt> 属性。<br>
+
+
+
+  <b>Python</b>: 不支持该参数。&nbsp;
 </blockquote>

-<P>
-
-<H3><A NAME="SECTION001340300000000000000">
-Complexity</A>
-</H3>
-
-<P>
-The time complexity is <i>O(E + V)</i>.
-
-<P>
-
-<h3>Visitor Event Points</h3>
+<p>
+
+</p><h3><a name="SECTION001340300000000000000">
+Complexity 复杂度</a>
+</h3>
+
+<p>时间复杂度为 <i>O(E + V)</i>。
+
+</p><p>
+
+</p><h3>Visitor Event Points 遍历器事件点</h3>

 <ul>

-<li><b><tt>vis.initialize_vertex(s, g)</tt></b> is invoked on every
-  vertex of the graph before the start of the graph search.
-
-<li><b><tt>vis.start_vertex(s, g)</tt></b> is invoked on the source
-  vertex once before the start of the search.
-
-<li><b><tt>vis.discover_vertex(u, g)</tt></b> is invoked when a vertex
-  is encountered for the first time.
-
-<li><b><tt>vis.examine_edge(e, g)</tt></b> is invoked on every out-edge
-  of each vertex after it is discovered.
-
-<li><b><tt>vis.tree_edge(e, g)</tt></b> is invoked on each edge as it
-  becomes a member of the edges that form the search tree. If you
-  wish to record predecessors, do so at this event point.
-
-<li><b><tt>vis.back_edge(e, g)</tt></b> is invoked on the back edges in
-  the graph.
-
-<li><b><tt>vis.forward_or_cross_edge(e, g)</tt></b> is invoked on
-  forward or cross edges in the graph. In an undirected graph this
-  method is never called.
-
-<li><b><tt>vis.finish_vertex(u, g)</tt></b> is invoked on a vertex after
-  all of its out edges have been added to the search tree and all of
-  the adjacent vertices have been discovered (but before their
-  out-edges have been examined).
-
-</ul>
-
-
-<H3>Example</H3>
-
-<P>
-The example in <a href="../example/dfs-example.cpp">
-<TT>examples/dfs-example.cpp</TT></a> shows DFS applied to the graph in
-<A HREF="./graph_theory_review.html#fig:dfs-example">Figure 1</A>.
-
-<h3>See Also</h3>
+<li><b><tt>vis.initialize_vertex(</tt></b><b><tt>s</tt></b><b><tt>, g)</tt></b> 在图搜索开始前对每个顶点调用。
+
+</li><li><b><tt>vis.start_vertex(s, g)</tt></b> 在开始搜索前对源顶点调用一 次。
+
+</li><li><b><tt>vis.discover_vertex(u, g)</tt></b> 在某个顶点第一次被遇到时 调用。</li><li><b><tt>vis.examine_edge(e, g)</tt></b> 在某顶点被发现后,对其 每条出边调用。
+
+</li><li><b><tt>vis.tree_edge(e, g)</tt></b> 当某边成为形成搜索树的一条树边 时被调用。如果你想记录前趋,在此事件点上进行。
+
+</li><li><b><tt>vis.back_edge(e, g)</tt></b> 对图中的反向边调用。
+
+</li><li><b><tt>vis.forward_or_cross_edge(e, g)</tt></b> 对图中的前向边或交 叉边调用。在无向图中,该方法不会被调用。 </li><li><b><tt>vis.finish_vertex(u, g)</tt></b> 当某个顶点的所有出边都被增 加至搜索树中且所有邻接顶点都被发现后(但在它们的出边被检查之前),对该顶点调 用。</li></ul>
+
+
+<h3>Example 示例</h3>
+
+<p><a href="../example/dfs-example.cpp"><tt>examples/dfs-example.cpp</tt></a> 中的 例子示范了将DFS应用于 <a href="./graph_theory_review.html#fig:dfs-example">图 1</a> 中的图。
+
+</p><h3>See Also 参见</h3>

 <a href="./depth_first_visit.html"><tt>depth_first_visit</tt></a>
 <a href="./undirected_dfs.html"><tt>undirected_dfs</tt></a>

-<h3>Notes</h3>
+<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="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</A>,
-Indiana University (<A
-HREF="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</A>)<br>
-<A HREF="http://www.boost.org/people/liequan_lee.htm";>Lie-Quan Lee</A>, Indiana University (<A HREF="mailto:llee@xxxxxxxxxxxxxx";>llee@xxxxxxxxxxxxxx</A>)<br>
-<A HREF="http://www.osl.iu.edu/~lums";>Andrew Lumsdaine</A>,
-Indiana University (<A
-HREF="mailto:lums@xxxxxxxxxx";>lums@xxxxxxxxxx</A>)
-</TD></TR></TABLE>
-
-</BODY>
-</HTML>
+ 由于 visitor 参数是以值方式传递的,所以如果你的遍历器含有状态,则在算法中 对该状态的所有修改都是针对该遍历器对象的一个拷贝,而不对传入的遍历器对象进行 的。因此你应该让该遍历器以指针或引用的方式保存该状态。<br>
+</p><hr>
+<table>
+<tbody><tr valign="top">
+<td nowrap="nowrap">Copyright © 2000-2001</td><td>
+<a href="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</a>,
+Indiana University (<a href="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</a>)<br> +<a href="http://www.boost.org/people/liequan_lee.htm";>Lie-Quan Lee</a>, Indiana University (<a href="mailto:llee@xxxxxxxxxxxxxx";>llee@xxxxxxxxxxxxxx</a>)<br>
+<a href="http://www.osl.iu.edu/%7Elums";>Andrew Lumsdaine</a>,
+Indiana University (<a href="mailto:lums@xxxxxxxxxx";>lums@xxxxxxxxxx</a>)
+</td></tr></tbody></table>
+
+</body></html>
=======================================
--- /trunk/libs/graph/doc/depth_first_visit.html        Mon Mar 30 07:58:04 2009
+++ /trunk/libs/graph/doc/depth_first_visit.html        Sun Aug  2 22:26:22 2009
@@ -1,144 +1,98 @@
-<HTML>
-<!--
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><!--
   -- Copyright (c) Jeremy Siek 2000
   --
   -- Distributed under the Boost Software License, Version 1.0.
   -- (See accompanying file LICENSE_1_0.txt or copy at
   -- http://www.boost.org/LICENSE_1_0.txt)
   -->
-<Head>
-<Title>Boost Graph Library: Depth-First Visit</Title>
-<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
-        ALINK="#ff0000">
-<IMG SRC="../../../boost.png"
-     ALT="C++ Boost" width="277" height="86">
-
-<BR Clear>
-
-<H2><A NAME="sec:dfs"></A>
-<img src="figs/python.gif" alt="(Python)"/>
-<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 ColorMap&gt;
-void depth_first_visit(IncidenceGraph& g,
-  typename graph_traits&lt;IncidenceGraph&gt;::vertex_descriptor s,
-  DFSVisitor&amp; vis, ColorMap color)
-
-template &lt;class <a href="./IncidenceGraph.html">IncidenceGraph</a>, class <a href="./DFSVisitor.html">DFSVisitor</a>, class ColorMap,
-          class TerminatorFunc&gt;
-void depth_first_visit(IncidenceGraph& g,
-  typename graph_traits&lt;IncidenceGraph&gt;::vertex_descriptor s,
- DFSVisitor&amp; vis, ColorMap color, TerminatorFunc func = TerminatorFunc())
-</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>The second variant can be used, for example, to find all marked vertices
-reachable from a start vertex by a path which does not contain any another
-marked vertices.
+<title>Boost Graph Library: Depth-First Visit</title></head>
+
+<body alink="#ff0000" bgcolor="#ffffff" link="#0000ee" text="#000000" vlink="#551a8b">
+<img src="../../../boost.png" alt="C++ Boost" height="86" width="277">
+
+<br clear="">
+
+<h2><a name="sec:dfs"></a>
+<img src="figs/python.gif" alt="(Python)">
+<tt>depth_first_visit</tt>
+</h2>
+
+
+<p>
+</p><pre>template &lt;class <a href="./IncidenceGraph.html">IncidenceGraph</a>, class <a href="./DFSVisitor.html">DFSVisitor</a>, class ColorMap&gt;<br>void depth_first_visit(IncidenceGraph&amp; g,<br> typename graph_traits&lt;IncidenceGraph&gt;::vertex_descriptor s, <br> DFSVisitor&amp; vis, ColorMap color)<br><br>template &lt;class <a href="./IncidenceGraph.html">IncidenceGraph</a>, class <a href="./DFSVisitor.html">DFSVisitor</a>, class ColorMap, <br> class TerminatorFunc&gt;<br>void depth_first_visit(IncidenceGraph&amp; g,<br> typename graph_traits&lt;IncidenceGraph&gt;::vertex_descriptor s, <br> DFSVisitor&amp; vis, ColorMap color, TerminatorFunc func = TerminatorFunc())<br></pre>
+
+<p>该函数使用 <a href="./graph_theory_review.html#sec:dfs-algorithm">深度优 先模式</a> 访问与源顶点 <tt>s</tt> 位于同一个连通分支的所有顶点。该函数的主 要目的是为了实现 <tt>depth_first_search()</tt>,虽然有时候它本身也会被单独使 用。
+
+</p><p>由用户提供的 <tt>DFSVisitor</tt> 决定了在算法内部的各个事件点上执行 什么动作。
+
+</p><p><tt>ColorMap</tt> 由算法用于跟踪哪些顶点已被访问。
+
+</p><p>也可以用第二种变体,例如,从一个开始顶点找出所有可到达的已标记顶 点,从开始顶点到这些顶点有一条不包含任何其它已标记顶点的路径。


-<P>
-
-<h3>Where Defined:</h3>
-
-<a href="../../../boost/graph/depth_first_search.hpp"><TT>boost/graph/depth_first_search.hpp</TT></a>
+</p><p>
+
+</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>
+<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>.<br>
-
-<b>Python</b>: The parameter is named <tt>graph</tt>.
+<blockquote>一个有向图或无向图。图类型必须符合 <a href="IncidenceGraph.html">关联图Incidence Graph</a>.<br>
+
+
+
+  <b>Python</b>:&nbsp;该参数被命名为 <tt>graph</tt>.&nbsp;
 </blockquote>

 IN: <tt>vertex_descriptor s</tt>
-<blockquote>
-  The source vertex from which to start the search.<br>
-
-  <b>Python</b>: The parameter is named <tt>root_vertex</tt>.
+<blockquote>开始搜索的源顶点。<br>
+
+
+
+  <b>Python</b>:&nbsp;该参数被命名为 <tt>root_vertex</tt>.&nbsp;
 </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>.<br>
-
-  <b>Python</b>: The parameter should be an object that derives from
-  the <a href="DFSVisitor.html#python"><tt>DFSVisitor</tt></a> type of
-  the graph.
+<blockquote>一个遍历器对象,在算法内部某些由&nbsp;<a href="DFSVisitor.html">DFS 遍历器</a>&nbsp;概念所指定的事件点被调用。这个遍 历器对象是以值方式传递的<a href="#1">[1]</a>。<br>
+
+
+
+ <b>Python</b>: 该参数应为派生自该图的 <a href="DFSVisitor.html#python"><tt>DFSVisitor</tt></a><a href="BFSVisitor.html#python"><tt></tt></a>&nbsp;类型的一个对象。
 </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>.<br>
-
-  <b>Python</b>: The color map must be a <tt>vertex_color_map</tt> for
-  the graph.
+<blockquote>被该算法用于跟踪对图的处理过程。类型 <tt>ColorMap</tt> 必须符 合 <a href="../../property_map/ReadWritePropertyMap.html">读/写属性映射 Read/Write
+  Property Map</a> 并且其键类型必须为图的顶点描述符类型,值类型必须符合
+  <a href="ColorValue.html">ColorValue</a>。<br>
+
+
+
+ <b>Python</b>: 这个颜色映射必须是图的一个 <tt>vertex_color_map</tt>。 &nbsp;
 </blockquote>

 IN: <tt>TerminatorFunc func</tt>
-<blockquote>
-A function object callable with two parameters - the descriptor of
-vertex and the graph instance - and returning bool. The call is made
-immediately after call to 'discover_vertex' visitor
-event. If <tt>true</tt> is returned, the out edges of the vertex are
-not examined, as if they don't exist.<br>
-
-  <b>Python</b>: Unsupported parameter.
+<blockquote>一个带两个参数 - 顶点描述符和图实例 - 并返回 bool 的可调用函数 对象。该函数对象在调用 'discover_vertex' 遍历器事件后立即被调用。如果返回 <tt>true</tt>,则该顶点的出边不被检查,就象它们不存在一样。<br>
+
+  <b>Python</b>: 不支持该参数。
 </blockquote>
-<P>
-
-<h3>Complexity</h3>
-
-Time complexity is <i>O(E)</i>.
-
-
-<h3>Notes</h3>
+<p>
+
+</p><h3>Complexity 复杂度</h3>时间复杂度为 <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="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</A>, Indiana University (<A HREF="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</A>)
-</TD></TR></TABLE>
-
-</BODY>
-</HTML>
+ 由于 visitor 参数是以值方式传递的,所以如果你的遍历器含有状态,则在算法中 对该状态的所有修改都是针对该遍历器对象的一个拷贝,而不对传入的遍历器对象进行 的。因此你应该让该遍历器以指针或引用的方式保存该状态。<br>
+</p><hr>
+<table>
+<tbody><tr valign="top">
+<td nowrap="nowrap">Copyright © 2000-2001</td><td>
+<a href="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</a>, Indiana University (<a href="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</a>)
+</td></tr></tbody></table>
+
+</body></html>
=======================================
--- /trunk/libs/graph/doc/dijkstra_shortest_paths.html Mon Mar 30 07:58:04 2009 +++ /trunk/libs/graph/doc/dijkstra_shortest_paths.html Sun Aug 2 22:26:22 2009
@@ -1,443 +1,247 @@
-<HTML>
-<!--
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><!--
   -- Copyright (c) Jeremy Siek 2000
   --
   -- Distributed under the Boost Software License, Version 1.0.
   -- (See accompanying file LICENSE_1_0.txt or copy at
   -- http://www.boost.org/LICENSE_1_0.txt)
   -->
-<Head>
-<Title>Boost Graph Library: Dijkstra's Shortest Paths</Title>
-<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
-        ALINK="#ff0000">
-<IMG SRC="../../../boost.png"
-     ALT="C++ Boost" width="277" height="86">
-
-<BR Clear>
-
-<H1><A NAME="sec:dijkstra"></A><img src="figs/python.gif" alt="(Python)"/>
-<TT>dijkstra_shortest_paths</TT>
-</H1>
-
-
-<P>
-<PRE>
-<i>// named parameter version</i>
+<title>Boost Graph Library: Dijkstra's Shortest Paths</title></head>
+
+<body alink="#ff0000" bgcolor="#ffffff" link="#0000ee" text="#000000" vlink="#551a8b">
+<img src="../../../boost.png" alt="C++ Boost" height="86" width="277">
+
+<br clear="">
+
+<h1><a name="sec:dijkstra"></a><img src="figs/python.gif" alt="(Python)">
+<tt>dijkstra_shortest_paths</tt>
+</h1>
+
+
+<p>
+</p><pre><i>// 命名参数版本</i>
 template &lt;typename Graph, typename P, typename T, typename R&gt;
 void
 dijkstra_shortest_paths(Graph&amp; g,
   typename graph_traits&lt;Graph&gt;::vertex_descriptor s,
   const bgl_named_params&lt;P, T, R&gt;&amp; params);

-<i>// non-named parameter version</i>
-template &lt;typename Graph, typename <a href="DijkstraVisitor.html">DijkstraVisitor</a>,
-         typename PredecessorMap, typename DistanceMap,
- typename WeightMap, typename VertexIndexMap, typename <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html";>CompareFunction</a>, typename <a href="http://www.sgi.com/tech/stl/BinaryFunction.html";>CombineFunction</a>, - typename DistInf, typename DistZero, typename ColorMap = <i>default</i>&gt;
-void dijkstra_shortest_paths
-  (const Graph&amp; g,
-   typename graph_traits&lt;Graph&gt;::vertex_descriptor s,
-   PredecessorMap predecessor, DistanceMap distance, WeightMap weight,
-   VertexIndexMap index_map,
- CompareFunction compare, CombineFunction combine, DistInf inf, DistZero zero,
-   DijkstraVisitor vis, ColorMap color = <i>default</i>)
-</PRE>
-
-<P>
-This algorithm&nbsp;[<A HREF="bibliography.html#dijkstra59">10</A>,<A
-HREF="bibliography.html#clr90">8</A>] solves the single-source
-shortest-paths problem on a weighted, directed or undirected graph for
-the case where all edge weights are nonnegative.  Use the Bellman-Ford
-algorithm for the case when some edge weights are negative.  Use
-breadth-first search instead of Dijkstra's algorithm when all edge
-weights are equal to one.  For the definition of the shortest-path
-problem see Section <A
-HREF="graph_theory_review.html#sec:shortest-paths-algorithms">Shortest-Paths
-Algorithms</A> for some background to the shortest-path problem.
-</P>
-
-<P>
-There are two main options for obtaining output from the
-<tt>dijkstra_shortest_paths()</tt> function. If you provide a
-distance property map through the <tt>distance_map()</tt> parameter
-then the shortest distance from the source vertex to every other
-vertex in the graph will be recorded in the distance map. Also you can
-record the shortest paths tree in a predecessor map: for each vertex
-<i>u in V</i>, <i>p[u]</i> will be the predecessor of <i>u</i> in
-the shortest paths tree (unless <i>p[u] = u</i>, in which case <i>u</i> is
-either the source or a vertex unreachable from the source).  In
-addition to these two options, the user can provide there own
-custom-made visitor that can takes actions during any of the
-algorithm's event points.</P>
-
-<P>
-Dijkstra's algorithm finds all the shortest paths from the source
-vertex to every other vertex by iteratively ``growing'' the set of
-vertices <i>S</i> to which it knows the shortest path. At each step of
-the algorithm, the next vertex added to <i>S</i> is determined by a
-priority queue.  The queue contains the vertices in <i>V - S</i><a
-href="#1">[1]</a> prioritized by their distance label, which is the
-length of the shortest path seen so far for each vertex. The vertex
-<i>u</i> at the top of the priority queue is then added to <i>S</i>,
-and each of its out-edges is relaxed: if the distance to <i>u</i> plus
-the weight of the out-edge <i>(u,v)</i> is less than the distance
-label for <i>v</i> then the estimated distance for vertex <i>v</i> is
-reduced.  The algorithm then loops back, processing the next vertex at
-the top of the priority queue. The algorithm finishes when the
-priority queue is empty.
-</P>
-<P>
-The algorithm uses color markers (white, gray, and black) to keep
-track of which set each vertex is in. Vertices colored black are in
-<i>S</i>. Vertices colored white or gray are in <i>V-S</i>. White vertices have
-not yet been discovered and gray vertices are in the priority queue.
-By default, the algorithm will allocate an array to store a color
-marker for each vertex in the graph. You can provide you own storage
-and access for colors with the <tt>color_map()</tt> parameter.
-</P>
+<i>// 非命名参数版本</i>
+template &lt;typename Graph, typename <a href="DijkstraVisitor.html">DijkstraVisitor</a>, <br> typename PredecessorMap, typename DistanceMap,<br> typename WeightMap, typename VertexIndexMap, typename <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html";>CompareFunction</a>, typename <a href="http://www.sgi.com/tech/stl/BinaryFunction.html";>CombineFunction</a>, <br> typename DistInf, typename DistZero, typename ColorMap = <i>default</i>&gt;<br>void dijkstra_shortest_paths<br> (const Graph&amp; g,<br> typename graph_traits&lt;Graph&gt;::vertex_descriptor s, <br> PredecessorMap predecessor, DistanceMap distance, WeightMap weight, <br> VertexIndexMap index_map,<br> CompareFunction compare, CombineFunction combine, DistInf inf, DistZero zero,<br> DijkstraVisitor vis, ColorMap color = <i>default</i>)<br></pre>
+
+<p>该算法[<a href="bibliography.html#dijkstra59">10</a>,<a href="bibliography.html#clr90">8</a>]用于解决非负权重的有向或无向图上的单源 最短路径问题。如果含有负权重,则需要使用 Bellman-Ford 算法。如果所有的边权重 都等于一,可以使用广度优先搜索代替 Dijkstra 算法。有关最短路径问题的定义及其 背景,请见 <a href="graph_theory_review.html#sec:shortest-paths-algorithms">最短路径算法 </a> 一节。
+</p>
+
+<p>从
+<tt>dijkstra_shortest_paths()</tt> 函数获得输出,有两个主要选项。如果你通 过 <tt>distance_map()</tt> 参数提供一个距离属性映射,则从源顶点到图中每个顶 点的最短距离将被记录在这个距离映射中。你也可以将最短路径树记录在一个前趋映射 中:对于<i> V</i> 中的每个顶点 +<i>u</i>,<i>p[u]</i> 为顶点 <i>u</i> 在最短路径树中的前趋(除非 <i>p[u] = u</i>,此时 <i>u</i> 为源顶点或某个不能从源顶点到达的顶点)。除了这两个选 项,用户还可以提供他们自己定制的遍历器,在算法中的某些事件点上执行动作。</p>
+
 <p>
-The following is the pseudo-code for Dijkstra's single-source shortest
-paths algorithm. <i>w</i> is the edge weight, <i>d</i> is the distance label,
-and <i>p</i> is the predecessor of each vertex which is used to encode
-the shortest paths tree. <i>Q</i> is a priority queue that supports the
-DECREASE-KEY operation.  The visitor event points for the algorithm are
-indicated by the labels on the right.
+Dijkstra 算法找出从源顶点到其它各个顶点的最短路径,其方法是重复"增长"已得知 最短路径的顶点集合<i>S</i>。在算法的每一步中,下一个被增加至 <i>S</i> 中的顶 点是由一个优先队列来决定的。这个队列包含了 <i>V - S</i><a href="#1">[1]</a> 中的所有顶点,并以它们的距离标号来排列成优先队列,距离标号即是每个顶点当前可 以估到的最短路径长度。位于优先队列顶部的顶点 +<i>u</i> 被增加至 <i>S</i>,且它的每条出边被松驰:如果到 <i>u</i> 的距离加 上出边 <i>(u,v)</i> 的权重的和,小于 <i>v</i> 的距离标号,则对顶点 <i>v</i> 的距离估算被减小。然后该算法循环,处理优先队列顶点的下一个顶点。当优先队列为 空时,算法结束。
 </p>
+<p>该算法使用颜色标记(白色、灰色和黑色)来跟踪每个顶点属于哪个集合。黑色顶点 属于<i>S</i>。白色和灰色顶点属于<i>V-S</i>。白色顶点尚未被发现,而灰色顶点则 位于优先队列中。缺省情况下,该算法会分配一个数组来保存图中每个顶点的颜色。你 可以提供你自己的存储,并用 <tt>color_map()</tt> 参数来访问颜色。
+</p>
+<p>以下是 Dijkstra 单源最短路径算法的伪代码。<i>w</i> 为边权重,<i>d</i> 为 距离标号,<i>p</i> 为每个顶点的前趋,用于编码最短路径树。<i>Q</i> 是一个优先 队列,支持
+DECREASE-KEY 操作。该算法的遍历器事件点由右侧的标号列出。
+</p>

 <table>
-<tr>
+<tbody><tr>
 <td valign="top">
-<pre>
-DIJKSTRA(<i>G</i>, <i>s</i>, <i>w</i>)
-  <b>for</b> each vertex <i>u in V</i>
-    <i>d[u] := infinity</i>
-    <i>p[u] := u</i>
-    <i>color[u] :=</i> WHITE
-  <b>end for</b>
-  <i>color[s] := </i>GRAY
-  <i>d[s] := 0</i>
-  INSERT(<i>Q</i>, <i>s</i>)
-  <b>while</b> (<i>Q != &Oslash;</i>)
-    <i>u :=</i> EXTRACT-MIN(<i>Q</i>)
-    <i>S := S U { u }</i>
+<pre>DIJKSTRA(<i>G</i>, <i>s</i>, <i>w</i>)<br> <b>for</b> each vertex <i>u in V</i> + <i>d[u] := infinity</i> <br> <i>p[u] := u</i> <br> <i>color[u] :=</i> WHITE<br> <b>end for</b> + <i>color[s] := </i>GRAY <br> <i>d[s] := 0</i> <br> INSERT(<i>Q</i>, <i>s</i>)<br> <b>while</b> (<i>Q != Ø</i>)<br> <i>u :=</i> EXTRACT-MIN(<i>Q</i>)<br> <i>S := S U { u }</i>
     <b>for</b> each vertex <i>v in Adj[u]</i>
-      <b>if</b> (<i>w(u,v) + d[u] < d[v]</i>)
-        <i>d[v] := w(u,v) + d[u]</i>
-        <i>p[v] := u</i>
-        <b>if</b> (<i>color[v] =</i> WHITE)
-          <i>color[v] :=</i> GRAY
-          INSERT(<i>Q</i>, <i>v</i>)
-        <b>else if</b> (<i>color[v] =</i> GRAY)
-          DECREASE-KEY(<i>Q</i>, <i>v</i>)
-      <b>else</b>
+ <b>if</b> (<i>w(u,v) + d[u] &lt; d[v]</i>)<br> <i>d[v] := w(u,v) + d[u]</i> + <i>p[v] := u</i> <br> <b>if</b> (<i>color[v] =</i> WHITE) <br> <i>color[v] :=</i> GRAY<br> INSERT(<i>Q</i>, <i>v</i>) <br> <b>else if</b> (<i>color[v] =</i> GRAY)<br> DECREASE-KEY(<i>Q</i>, <i>v</i>)<br> <b>else</b>
         <i>...</i>
     <b>end for</b>
-    <i>color[u] :=</i> BLACK
-  <b>end while</b>
-  return (<i>d</i>, <i>p</i>)
-</pre>
+    <i>color[u] :=</i> BLACK<br>  <b>end while</b>
+  return (<i>d</i>, <i>p</i>)<br></pre>
 </td>
 <td valign="top">
 <pre>
-
-initialize vertex <i>u</i>
+初始化顶点 <i>u</i>
+





-
-discover vertex <i>s</i>
-
-examine vertex <i>u</i>
-
-examine edge <i>(u,v)</i>
-
-edge <i>(u,v)</i> relaxed
+发现顶点 <i>s</i>
+
+检查顶点 <i>u</i>
+
+检查边 <i>(u,v)</i>
+
+边 <i>(u,v)</i> 被松驰<br><br><br><br>发现顶点 <i>v</i>
+


-
-discover vertex <i>v</i>
-
-
-
-edge <i>(u,v)</i> not relaxed
-
-finish vertex <i>u</i>
+边 <i>(u,v)</i> 未被松驰<br><br>结束顶点 <i>u</i>
 </pre>
 </td>
 </tr>
-</table>
-
-<h3>Where Defined</h3>
+</tbody></table>
+
+<h3>Where Defined 定义于</h3>

<a href="../../../boost/graph/dijkstra_shortest_paths.hpp"><tt>boost/graph/dijkstra_shortest_paths.hpp</tt></a>

-<h3>Parameters</h3>
+<h3>Parameters 参数</h3>

 IN: <tt>const Graph&amp; g</tt>
-<blockquote>
-  The graph object on which the algorithm will be applied.
-  The type <tt>Graph</tt> must be a model of
-  <a href="./VertexListGraph.html">Vertex List Graph</a>
-  and <a href="./IncidenceGraph.html">Incidence Graph</a>.<br>
-
-  <b>Python</b>: The parameter is named <tt>graph</tt>.
+<blockquote>应用该算法的图对象。类型 <tt>Graph</tt> 必须符合
+ <a href="./VertexListGraph.html">点列表图Vertex List Graph</a> 和 <a href="./IncidenceGraph.html">关联图Incidence Graph</a>。<br>
+
+
+
+  <b>Python</b>: 该参数被命名为 <tt>graph</tt>.&nbsp;
 </blockquote>

 IN: <tt>vertex_descriptor s</tt>
-<blockquote>
-  The source vertex. All distance will be calculated from this vertex,
-  and the shortest paths tree will be rooted at this vertex.<br>
-
-  <b>Python</b>: The parameter is named <tt>root_vertex</tt>.
+<blockquote>源顶点。所有距离都是从这个顶点开始计算,且最短路径树以此点为 根。<br>
+
+
+
+  <b>Python</b>: 该参数被命名为 <tt>root_vertex</tt>.
+
 </blockquote>

-<h3>Named Parameters</h3>
+<h3>Named Parameters 命名参数</h3>

 IN: <tt>weight_map(WeightMap w_map)</tt>
-<blockquote>
-  The weight or ``length'' of each edge in the graph. The weights
-  must all be non-negative, and the algorithm will throw a
-  <a href="./exception.html#negative_edge"><tt>negative_edge</tt></a>
-  exception is one of the edges is negative.
-  The type <tt>WeightMap</tt> must be a model of
- <a href="../../property_map/ReadablePropertyMap.html">Readable Property Map</a>. The edge descriptor type of
-  the graph needs to be usable as the key type for the weight
-  map. The value type for this map must be
-  the same as the value type of the distance map.<br>
-  <b>Default:</b>  <tt>get(edge_weight, g)</tt><br>
-
-  <b>Python</b>: Must be an <tt>edge_double_map</tt> for the graph.<br>
-  <b>Python default</b>: <tt>graph.get_edge_double_map("weight")</tt>
+<blockquote>图中每条边的权重或"长度"。这些权重必须为非负的,如果有某条边的 权重为负,该算法将抛出一个 <a href="./exception.html#negative_edge"><tt>negative_edge</tt></a>
+  异常。类型 <tt>WeightMap</tt> 必须符合
+ <a href="../../property_map/ReadablePropertyMap.html">可读属性映射</a>。 图的边描述符类型必须可用作这个权重映射的键类型。该映射的值类型必须与距离映射 的值类型相同。<br>
+  <b>缺省值:</b><tt>get(edge_weight, g)</tt><br>
+
+  <b>Python</b>: 必须为该图的一个 <tt>edge_double_map</tt>。<br>
+  <b>Python 缺省值:</b><tt>graph.get_edge_double_map("weight")</tt>
 </blockquote>

 IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
-<blockquote>
-  This maps each vertex to an integer in the range <tt>[0,
-    num_vertices(g))</tt>. This is necessary for efficient updates of the
-  heap data structure&nbsp;[<A
-  HREF="bibliography.html#driscoll88">61</A>] when an edge is relaxed.
-  The type
-  <tt>VertexIndexMap</tt> must be a model of
- <a href="../../property_map/ReadablePropertyMap.html">Readable Property Map</a>. The value type of the map must be an
-  integer type. The vertex descriptor type of the graph needs to be
-  usable as the key type of the map.<br>
-  <b>Default:</b> <tt>get(vertex_index, g)</tt>.
-    Note: if you use this default, make sure your graph has
-    an internal <tt>vertex_index</tt> property. For example,
-    <tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
-    not have an internal <tt>vertex_index</tt> property.
-   <br>
-
-  <b>Python</b>: Unsupported parameter.
+<blockquote>它将每个顶点映射至位于区间 <tt>[0,
+ num_vertices(g))</tt> 中的一个整数。当某条边被松驰时,堆数据结构[<a href="bibliography.html#driscoll88">61</a>]必须可以高效地更新。类型 <tt>VertexIndexMap</tt> + 必须符合 <a href="../../property_map/ReadablePropertyMap.html">可读属性映 射</a>。该映射的值类型必须是一个整数类型。图的顶点描述符类型需要可以被用作该 映射的键类型。<br>
+
+
+  <b>缺省值:</b><tt>get(vertex_index, g)</tt>.
+ 注意:如果你使用该缺省值,请确认你的图具有一个内部的 <tt>vertex_index</tt> 属性。例如,带 <tt>VertexList=listS</tt> 的
+    <tt>adjacenty_list</tt> 并不具有内部的 <tt>vertex_index</tt> 属性。<br>
+
+  <b>Python</b>: 不支持该参数。&nbsp;
 </blockquote>

 OUT: <tt>predecessor_map(PredecessorMap p_map)</tt>
-<blockquote>
-  The predecessor map records the edges in the minimum spanning
-  tree. Upon completion of the algorithm, the edges <i>(p[u],u)</i>
-  for all <i>u in V</i> are in the minimum spanning tree. If <i>p[u] =
-  u</i> then <i>u</i> is either the source vertex or a vertex that is
-  not reachable from the source.  The <tt>PredecessorMap</tt> type
-  must be a <a
-  href="../../property_map/ReadWritePropertyMap.html">Read/Write
-  Property Map</a> whose key and value types are the same as the vertex
-  descriptor type of the graph.<br>
-  <b>Default:</b> <tt>dummy_property_map</tt><br>
-
-  <b>Python</b>: Must be a <tt>vertex_vertex_map</tt> for the graph.<br>
+<blockquote>这个前趋映射用于记录最小生成树中的边。当该算法结束后,对于<i> V</i> 中的所有 <i>u</i>,边 <i>(p[u],u)</i>&nbsp;<span style="font-style: italic;"></span><i></i>均属于最小生成树。如果 <i>p[u] = + u</i> 则 <i>u</i> 为源顶点或某个不能从源顶点到达的顶点。类型 <tt>PredecessorMap</tt> 必须符合 <a href="../../property_map/ReadWritePropertyMap.html">读/写属性映射</a>,且其 键类型和值类型均与图的顶点描述符类型相同。<br>
+  <b>缺省值:</b><tt>dummy_property_map</tt><br>
+
+  <b>Python</b>: 必须为该图的一个 <tt>vertex_vertex_map</tt>。<br>
 </blockquote>

 UTIL/OUT: <tt>distance_map(DistanceMap d_map)</tt>
-<blockquote>
-  The shortest path weight from the source vertex <tt>s</tt> to each
-  vertex in the graph <tt>g</tt> is recorded in this property map. The
-  shortest path weight is the sum of the edge weights along the
-  shortest path.  The type <tt>DistanceMap</tt> must be a model of <a
-  href="../../property_map/ReadWritePropertyMap.html">Read/Write
-  Property Map</a>. The vertex descriptor type of the graph needs to
-  be usable as the key type of the distance map.
-
-  The value type of the distance map is the element type of a <a
-  href="./Monoid.html">Monoid</a> formed with the <tt>combine</tt>
-  function object and the <tt>zero</tt> object for the identity
-  element. Also the distance value type must have a <a
-  href="http://www.sgi.com/tech/stl/StrictWeakOrdering.html";>
-  StrictWeakOrdering</a> provided by the <tt>compare</tt> function
-  object.<br>
-  <b>Default:</b> <a
-  href="../../property_map/iterator_property_map.html">
-  <tt>iterator_property_map</tt></a> created from a
-  <tt>std::vector</tt> of the <tt>WeightMap</tt>'s value type of size
-  <tt>num_vertices(g)</tt> and using the <tt>i_map</tt> for the index
-  map.<br>
-
-  <b>Python</b>: Must be a <tt>vertex_double_map</tt> for the graph.<br>
+<blockquote>从源顶点 <tt>s</tt> 到图 <tt>g</tt> 中每个顶点的最短路径权重被 记录在这个属性映射中。最短路径权重为最短路径上各边权重之和。类型 <tt>DistanceMap</tt> 必须符合 <a href="../../property_map/ReadWritePropertyMap.html">读/写属性映射</a>。图的 顶点描述符类型必须可被用作这个距离映射的键类型。距离映射的值类型是一个 <a href="./Monoid.html">Monoid</a> 的元素类型,它是由组合函数对象和 identity 元 素的"零"对象形成的。此外,距离值类型还必须具有由 <tt>compare</tt> 函数对象提 供的一个 <a href="http://www.sgi.com/tech/stl/StrictWeakOrdering.html";>
+  严格弱序</a>。<br>
+ <b>缺省值:</b><a href="../../property_map/iterator_property_map.html"><tt>iterator_property_map</tt></a> 创建自一个值类型为 <tt>WeightMap</tt>,大小为
+  <tt>num_vertices(g)</tt> 的
+ <tt>std::vector</tt><span style="font-family: monospace;">,</span>且以 <tt>i_map</tt> 作为索引映射。<br>
+
+  <b>Python</b>: 必须为该图的一个 <tt>vertex_double_map</tt>。<br>
 </blockquote>

 IN: <tt>distance_compare(CompareFunction cmp)</tt>
-<blockquote>
-  This function is use to compare distances to determine which vertex
-  is closer to the source vertex.  The <tt>CompareFunction</tt> type
-  must be a model of <a
-  href="http://www.sgi.com/tech/stl/BinaryPredicate.html";>Binary
-  Predicate</a> and have argument types that match the value type of
-  the <tt>DistanceMap</tt> property map.<br>
-
-  <b>Default:</b>
-  <tt>std::less&lt;D&gt;</tt> with <tt>D=typename
+<blockquote>该函数用于比较距离,以决定哪个顶点更接近于源顶点。类型 <tt>CompareFunction</tt> 必须符合 <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html";>二元谓词</a> 且其参 数类型要与 <tt>DistanceMap</tt> 属性映射的值类型相匹配。<br>
+
+  <b>缺省值:</b><tt>std::less&lt;D&gt;</tt> 其中 <tt>D=typename
   property_traits&lt;DistanceMap&gt;::value_type</tt><br>

-  <b>Python</b>: Unsupported parameter.
+  <b>Python</b>:&nbsp;不支持该参数。
 </blockquote>

 IN: <tt>distance_combine(CombineFunction cmb)</tt>
-<blockquote>
-  This function is used to combine distances to compute the distance
-  of a path. The <tt>CombineFunction</tt> type must be a model of <a
-  href="http://www.sgi.com/tech/stl/BinaryFunction.html";>Binary
-  Function</a>. The first argument type of the binary function must
-  match the value type of the <tt>DistanceMap</tt> property map and
-  the second argument type must match the value type of the
-  <tt>WeightMap</tt> property map.  The result type must be the same
-  type as the distance value type.<br>
-
-  <b>Default:</b> <tt>std::plus&lt;D&gt;</tt> with
+<blockquote>该函数用于将距离相加,以计算一条路径的距离。类型 <tt>CombineFunction</tt> 必须符合 <a href="http://www.sgi.com/tech/stl/BinaryFunction.html";>二元谓词</a>。该二元 函数的第一个参数类型必须与 <tt>DistanceMap</tt> 属性映射的值类型相匹配,第二 个参数类型必须与 + <tt>WeightMap</tt> 属性映射的值类型相匹配。结果类型必须与距离值类型相同。 <br>
+
+  <b>缺省值:</b><tt>std::plus&lt;D&gt;</tt> 其中
    <tt>D=typename property_traits&lt;DistanceMap&gt;::value_type</tt><br>

-  <b>Python</b>: Unsupported parameter.
+  <b>Python</b>:&nbsp;不支持该参数。
 </blockquote>

 IN: <tt>distance_inf(D inf)</tt>
 <blockquote>
- The <tt>inf</tt> object must be the greatest value of any <tt>D</tt> object.
-  That is, <tt>compare(d, inf) == true</tt> for any <tt>d != inf</tt>.
-  The type <tt>D</tt> is the value type of the <tt>DistanceMap</tt>.<br>
-  <b>Default:</b> <tt>std::numeric_limits&lt;D&gt;::max()</tt><br>
-
-  <b>Python</b>: Unsupported parameter.
+ <tt>inf</tt> 对象必须是任意 <tt>D</tt> 对象中的最大值。 即,<tt>compare(d, inf) == true</tt> 对于任意 <tt>d != inf</tt> 成立。类型 <tt>D</tt> 为 <tt>DistanceMap</tt> 的值类型。<br>
+  <b>缺省值:</b><tt>std::numeric_limits&lt;D&gt;::max()</tt><br>
+
+  <b>Python</b>:&nbsp;不支持该参数。
 </blockquote>

 IN: <tt>distance_zero(D zero)</tt>
-<blockquote>
-  The <tt>zero</tt> value must be the identity element for the
-  <a href="./Monoid.html">Monoid</a> formed by the distance values
-  and the <tt>combine</tt> function object.
-  The type <tt>D</tt> is the value type of the <tt>DistanceMap</tt>.<br>
-  <b>Default:</b> <tt>D()</tt>with
+<blockquote>这个"零"值必须是
+ <a href="Monoid.html">Monoid</a> 的 identity 元素,<a href="./Monoid.html">Monoid</a> 由距离值和组合函数对象形成。类型 <tt>D</tt> 为 <tt>DistanceMap</tt> 的值类型。<br>
+  <b>缺省值:</b><tt>D()</tt> 其中
    <tt>D=typename property_traits&lt;DistanceMap&gt;::value_type</tt><br>

-  <b>Python</b>: Unsupported parameter.
+  <b>Python</b>:&nbsp;不支持该参数。
 </blockquote>

 UTIL/OUT: <tt>color_map(ColorMap c_map)</tt>
-<blockquote>
-  This is used during the execution of the algorithm to mark the
-  vertices. The vertices start out white and become gray when they are
-  inserted in the queue. They then turn black when they are removed
-  from the queue. At the end of the algorithm, vertices reachable from
-  the source vertex will have been colored black. All other vertices
-  will still be white. The type <tt>ColorMap</tt> must be a model of
-  <a href="../../property_map/ReadWritePropertyMap.html">Read/Write
-  Property Map</a>. A vertex descriptor must be usable as the key type
-  of the map, and the value type of the map must be a model of
-  <a href="./ColorValue.html">Color Value</a>.<br>
-  <b>Default:</b> an <a
-  href="../../property_map/iterator_property_map.html">
-  <tt>iterator_property_map</tt></a> created from a <tt>std::vector</tt>
-  of <tt>default_color_type</tt> of size <tt>num_vertices(g)</tt> and
-  using the <tt>i_map</tt> for the index map.<br>
-
-  <b>Python</b>: The color map must be a <tt>vertex_color_map</tt> for
-  the graph.
+<blockquote>用于在算法的执行期间对顶点进行标记。各顶点在开始时为白色,当被 插入队列时变为灰色。当被从队列中移出时变为黑色。在算法结束时,可以从源顶点到 达的所有顶点均变为黑色。其它所有顶点仍为白色。类型 <tt>ColorMap</tt> 必须符 + <a href="../../property_map/ReadWritePropertyMap.html">读/写属性映射 </a>。顶点描述符必须可被用作该映射的键类型,且该映射的值类型必须符合
+  <a href="./ColorValue.html">颜色值Color Value</a>。<br>
+ <b>缺省值:</b>一个 <a href="../../property_map/iterator_property_map.html"> + <tt>iterator_property_map</tt></a>,创建自一个大小为 <tt>num_vertices(g)</tt> 的 <tt>default_color_type</tt> 的 <tt>std::vector</tt>,且以 <tt>i_map</tt> 作为索引映射。<br>
+
+  <b>Python</b>: 颜色映射必须是该图的一个 <tt>vertex_color_map</tt>。
 </blockquote>

 OUT: <tt>visitor(DijkstraVisitor v)</tt>
-<blockquote>
-  Use this to specify actions that you would like to happen
-  during certain event points within the algorithm.
-  The type <tt>DijkstraVisitor</tt> must be a model of the
-  <a href="./DijkstraVisitor.html">Dijkstra Visitor</a> concept.
- The visitor object is passed by value <a
-  href="#2">[2]</a>.<br>
-  <b>Default:</b> <tt>dijkstra_visitor&lt;null_visitor&gt;</tt><br>
-
-  <b>Python</b>: The parameter should be an object that derives from
-  the <a
-  href="DijkstraVisitor.html#python"><tt>DijkstraVisitor</tt></a> type
-  of the graph.
+<blockquote>用于指定你想在算法内某些特定事件点上执行的动作。类型 <tt>DijkstraVisitor</tt> 必须符合 + <a href="./DijkstraVisitor.html">Dijkstra 遍历器</a> 概念。该遍历器对象是 以值方式传递的<a href="#2">[2]</a>。<br>
+  <b>缺省值:</b><tt>dijkstra_visitor&lt;null_visitor&gt;</tt><br>
+
+ <b>Python</b>: 该参数应为派生自该图的&nbsp;<a href="DijkstraVisitor.html#python"><tt>DijkstraVisitor</tt></a> 类型的一个对 象。
 </blockquote>


-<H3>Complexity</H3>
-
-<P>
-The time complexity is <i>O(V log V)</i>.
+<h3>Complexity 复杂度</h3>
+
+<p>时间复杂度为 <i>O(V log V)</i>。


-<h3>Visitor Event Points</h3>
+</p><h3>Visitor Event Points 遍历器事件点</h3>

 <ul>
-<li><b><tt>vis.initialize_vertex(u, g)</tt></b>
-  is invoked on each vertex in the graph before the start of the
-  algorithm.
-<li><b><tt>vis.examine_vertex(u, g)</tt></b>
-  is invoked on a vertex as it is removed from the priority queue
-  and added to set <i>S</i>. At this point we know that <i>(p[u],u)</i>
-  is a shortest-paths tree edge so
-  <i>d[u] = delta(s,u) = d[p[u]] + w(p[u],u)</i>. Also, the distances
-  of the examined vertices is monotonically increasing
-  <i>d[u<sub>1</sub>] <= d[u<sub>2</sub>] <= d[u<sub>n</sub>]</i>.
-<li><b><tt>vis.examine_edge(e, g)</tt></b>
-  is invoked on each out-edge of a vertex immediately after it has
-  been added to set <i>S</i>.
-<li><b><tt>vis.edge_relaxed(e, g)</tt></b>
-  is invoked on edge <i>(u,v)</i> if <i>d[u] + w(u,v) < d[v]</i>.
-  The edge <i>(u,v)</i> that participated in the last
-  relaxation for vertex <i>v</i> is an edge in the shortest paths tree.
-<li><b><tt>vis.discover_vertex(v, g)</tt></b>
-  is invoked on vertex <i>v</i> when the edge
-  <i>(u,v)</i> is examined and <i>v</i> is WHITE. Since
-  a vertex is colored GRAY when it is discovered,
-  each reacable vertex is discovered exactly once. This
-  is also when the vertex is inserted into the priority queue.
-<li><b><tt>vis.edge_not_relaxed(e, g)</tt></b>
-  is invoked if the edge is not relaxed (see above).
-<li><b><tt>vis.finish_vertex(u, g)</tt></b>
-   is invoked on a vertex after all of its out edges have
-  been examined.
-</ul>
-
-<H3>Example</H3>
-
-<P>
-See <a href="../example/dijkstra-example.cpp">
-<TT>example/dijkstra-example.cpp</TT></a> for an example of using Dijkstra's
-algorithm.
-
-<H3>Notes</H3>
+<li><b><tt>vis.initialize_vertex(</tt></b><b><tt>u</tt></b><b><tt>, g)</tt></b> 在算法开始前对图中每个顶点调用。
+
+</li><li><b><tt>vis.examine_vertex(u, g)</tt></b> 当各顶点被移出优先队列并 加入集合 <i>S</i> 时被调用。在此点上,我们知道 <i>(p[u],u)</i> + 是最短路径树的一条边,因此 <i>d[u] = delta(s,u) = d[p[u]] + w(p[u],u)</i>。另外,已被检查的顶点的距离是单调递增的,<i>d[u<sub>1</sub>] &lt;= d[u<sub>2</sub>] &lt;= d[u<sub>n</sub>]</i>.
+
+</li><li><b><tt>vis.examine_edge(e, g)</tt></b> 在某顶点被加入至集合 <i>S</i> 后,立即对其每条出边调用。</li><li><b><tt>vis.edge_relaxed(e, g)</tt></b> + 对满足 <i>d[u] + w(u,v) &lt; d[v]</i> 的边 <i>(u,v)</i> 调用。参与顶点 <i>v</i> 最后一次松驰的边 <i>(u,v)</i> 为最短路径树的一条边。 </li><li><b><tt>vis.discover_vertex(v, g)</tt></b> 当边 <i>(u,v)</i> 被检查 且 <i>v</i> 为 WHITE 时对顶点 <i>v</i> 调用。由于顶点在被发现时着色为 GRAY,所以每个可到达顶点只会被发现一次。亦即在顶点被插入优先队列时。 </li><li><b><tt>vis.edge_not_relaxed(e, g)</tt></b> + 当某条边未能被松驰时调用(见上)。</li><li><b><tt>vis.finish_vertex(u, g)</tt></b> 当某个顶点的所有出边都完成检查后调用。</li></ul>
+
+<h3>Example 示例</h3>
+
+<p> Dijkstra 算法的用例请见 <a href="../example/dijkstra-example.cpp">
+<tt>example/dijkstra-example.cpp</tt></a>。
+
+</p><h3>Notes 备注</h3>

 <a name="1">[1]</a>
-The algorithm used here saves a little space by not putting all <i>V -
-S</i> vertices in the priority queue at once, but instead only those
-vertices in <i>V - S</i> that are discovered and therefore have a
-distance less than infinity.
+以前本算法为了节省一点空间,并不一次性将所有 <i>V -
+S</i> 个顶点放入优先队列,而是只将 <i>V - S</i> 中已被发现的、距离小于无限 远的顶点放入队列。

 <p><a name="2">[2]</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="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</A>, Indiana University (<A HREF="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</A>)
-</TD></TR></TABLE>
-
-</BODY>
-</HTML>
+ 由于 visitor 参数是以值方式传递的,所以如果你的遍历器含有状态,则在算法中 对该状态的所有修改都是针对该遍历器对象的一个拷贝,而不对传入的遍历器对象进行 的。因此你应该让该遍历器以指针或引用的方式保存该状态。<br>
+</p><hr>
+<table>
+<tbody><tr valign="top">
+<td nowrap="nowrap">Copyright © 2000-2001</td><td>
+<a href="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</a>, Indiana University (<a href="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</a>)
+</td></tr></tbody></table>
+
+</body></html>
=======================================
--- /trunk/libs/graph/doc/floyd_warshall_shortest.html Mon Mar 30 07:58:04 2009 +++ /trunk/libs/graph/doc/floyd_warshall_shortest.html Sun Aug 2 22:26:22 2009
@@ -1,25 +1,23 @@
-<HTML>
-<!--
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><!--
      Copyright (c) 2002 Rensselaer Polytechnic Institute

      Distributed under the Boost Software License, Version 1.0.
      (See accompanying file LICENSE_1_0.txt or copy at
      http://www.boost.org/LICENSE_1_0.txt)
   -->
-<Head>
-<Title>Floyd-Warshall All Pairs Shortest Paths</Title>
-<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
-        ALINK="#ff0000">
-<IMG SRC="../../../boost.png"
-     ALT="C++ Boost" width="277" height="86">
-
-<BR Clear>
-
-<H1><A NAME="sec:floyd-warshall">
-<TT>floyd_warshall_all_pairs_shortest_paths</TT>
-</H1>
-
-<PRE><em>// Named parameters version</em>
+<title>Floyd-Warshall All Pairs Shortest Paths</title></head>
+
+<body alink="#ff0000" bgcolor="#ffffff" link="#0000ee" text="#000000" vlink="#551a8b">
+<img src="../../../boost.png" alt="C++ Boost" height="86" width="277">
+
+<br clear="">
+
+<h1><a name="sec:floyd-warshall">
+<tt>floyd_warshall_all_pairs_shortest_paths</tt>
+</a></h1>
+
+<pre><a name="sec:floyd-warshall"><em>// 命名参数版本</em>
 template &lt;class VertexListGraph, class DistanceMatrix,
     class P, class T, class R&gt;
 bool floyd_warshall_initialized_all_pairs_shortest_paths(
@@ -32,7 +30,7 @@
     const VertexAndEdgeListGraph&amp; g, DistanceMatrix&amp; d,
     const bgl_named_params&lt;P, T, R&gt;&amp; params)

-<em>// Positional parameter versions</em>
+<em>// 位置参数版本</em>
 \begin{verbatim}
 template &lt;typename VertexListGraph, typename DistanceMatrix,
     typename BinaryPredicate, typename BinaryFunction,
@@ -49,119 +47,76 @@
     const VertexAndEdgeListGraph&amp; g, DistanceMatrix&amp; d,
     const WeightMap&amp; w, const BinaryPredicate&amp; compare,
     const BinaryFunction&amp; combine,
-    const Infinity&amp; inf, const Zero&amp; zero)</PRE>
-
-<P>
-These algorithms find the shortest distance between every pair of
-vertices in the graph.  The algorithms return false if there is a
-negative weight cycle in the graph, true otherwise.  The shortest
-distance between each pair of vertices is stored in the distance
-matrix <code>d</code>.  The difference between the two algorithms is in
-whether the distance matrix is assumed to be initialized or not, as
-discussed below under the OUT parameter description.
-
-<P>This algorithm should be used to compute shortest paths between
-every pair of vertices for dense graphs. For sparse graphs, use <a
-href="johnson_all_pairs_shortest.html"><code>johnson_all_pairs_shortest_paths</code></a>.
-
-<H3>Where Defined</H3>
-
-<P>
-<a href="../../../boost/graph/floyd_warshall_shortest.hpp"><TT>boost/graph/floyd_warshall_shortest.hpp</TT></a>
-
-<h3>Parameters</h3>
+    const Infinity&amp; inf, const Zero&amp; zero)</a></pre>
+
+<p>
+<a name="sec:floyd-warshall">这些算法找出图中每对顶点间的最短距离。如果图中 存在负权回路,则该算法返回 false,否则返回 true。每对顶点间的最短距离被保存 在距离矩阵 <code>d</code> 中。这两个算法的差别在于,距离矩阵是否被假定已初始 化,如下文对 OUT 参数描述中的讨论。
+
+</a></p><p><a name="sec:floyd-warshall">该算法应被用于对稠密图计算每对顶点 间的最短路径。对于稀疏图,请用 </a><a href="johnson_all_pairs_shortest.html"><code>johnson_all_pairs_shortest_paths</code></a>。
+
+</p><h3>Where Defined 定义于</h3>
+
+<p>
+<a href="../../../boost/graph/floyd_warshall_shortest.hpp"><tt>boost/graph/floyd_warshall_shortest.hpp</tt></a>
+
+</p><h3>Parameters 参数</h3>
 IN: <code>Graph&amp; g</code>
-<blockquote>
-A directed or undirected graph. The graph must be a model of <a href="VertexListGraph.html">Vertex List Graph</a> for calls to
-<code>floyd_warshall_initialized_all_pairs_shortest_paths</code>, and
-<a href="VertexAndEdgeListGraph.html">Vertex And Edge List Graph</a> for calls to
-<code>floyd_warshall_all_pairs_shortest_paths</code>.<br>
+<blockquote>一个有向图或无向图。调用 &nbsp;<code>floyd_warshall_initialized_all_pairs_shortest_paths</code> 时,该图必须符合 <a href="VertexListGraph.html">点列表图Vertex List Graph</a>,调用 +<code>floyd_warshall_all_pairs_shortest_paths</code> 时须符合 <a href="VertexAndEdgeListGraph.html">点边列表图Vertex And Edge List Graph</a>。<br>
 </blockquote>

 OUT: <code>DistanceMatrix&amp; d</code>
-<blockquote>
-The length of the shortest path between each pair of vertices
-<code>u</code>,<code>v</code> are
-stored in the matrix at location <code>D[u][v]</code>.  The
-DistanceMatrix must be
-of type <code>{M, I, V}</code> where <code>I</code> is of type
-<code>vertex_descriptor</code> and <code>V</code> is the
-type of the <code>weight_map</code>.  The set of types must be a model of
-<a href="BasicMatrix.html">BasicMatrix</a>, with the exceptions that
-it isn't required to
-run in constant time, and it must be mutable.  The matrix must be
-properly initialized when it is passed to the function
-<code>floyd_warshall_initialized_all_pairs_shortest_paths</code>.  If the
-function <code>floyd_warshall_all_pairs_shortest_paths</code> is used then the
-matrix will be initialized for the user.
+<blockquote>图中每对顶点
+<code>u</code>,<code>v</code><i></i> 的最短路径长度被保存在 <tt>D[u][v]</tt>。DistanceMatrix 必须为类型 <code>{M, I, V}</code>,其中 <code>I</code> 为类型 +<code>vertex_descriptor</code> 而 <code>V</code> 为 <code>weight_map</code> 的类型。这个类型集必须符合 +<a href="BasicMatrix.html">基础矩阵BasicMatrix</a>,但不要求在常量时间内运 行,且必须是可变的。该矩阵在被传递给函数 +<code>floyd_warshall_initialized_all_pairs_shortest_paths</code> 时,必须是 已正确初始化的。如果是使用函数 <code>floyd_warshall_all_pairs_shortest_paths</code>,则将会为用户初始化该矩 阵。
 </blockquote>

-<h3>Named Parameters</h3>
+<h3>Named Parameters 命名参数</h3>

 IN: <code>weight_map(WeightMap w)</code>
-<blockquote>
-The weight of length of each edge in the graph.  The <code>WeightMap</code>
-must be a model of <a href="../../property_map/ReadablePropertyMap.html">Readable Property
-Map</a>.  The edge descriptor
-type of the graph needs to be usable as the key type for the weight
-map.  The <code>value_type</code> of the weight map must be the type of the
-<code>DistanceMatrix</code>, and must always either be part of the
-graph passed to the function, or passed in as a parameter.<br>
-<b>Default:</b> <code>get(edge_weight, g)</code>
+<blockquote>图中每条边的权重或长度。类型 <tt>WeightMap</tt> 必须符合
+ <a href="../../property_map/ReadablePropertyMap.html">可读属性映射</a>。 图的边描述符类型必须可用作这个权重映射的键类型。该映射的 <code>value_type</code> 必须是 +<code>DistanceMatrix</code> 类型,且必须要么是传给该函数的图的一部分,要么 作为一个参数传入。<br>
+  <b>缺省值:</b><tt>get(edge_weight, g)</tt><code></code>
 </blockquote>

 IN: <code>distance_compare(CompareFunction cmp)</code>
-<blockquote>
-The function used to compare distances to determine which target
-vertex is closer to the source vertex.  The CompareFunction must be a
-model of <code>BinaryPredicate</code>.  The argument types must match the
-value type of the <code>WeightMap</code>.<br>
-
-<b>Default:</b> <code>std::less&lt;WM&gt;</code>with <code>WM = typename property_traits&lt;WeightMap&gt;::value_type</code> +<blockquote>该函数用于比较距离,以决定哪个顶点更接近于源顶点。类型 <tt>CompareFunction</tt> 必须为二元谓词。其参数类型要与 &nbsp;<tt>WeightMap</tt> 属性映射的值类型相匹配。<br>
+
+ <b>缺省值:</b><tt>std::less&lt;WM&gt;</tt> 其中 <span style="font-family: monospace;">WM </span><tt>= typename + property_traits&lt;</tt><tt>WeightMap</tt><tt>&gt;::value_type</tt><code></code>
 </blockquote>

 IN: <code>distance_combine(CombineFunction cmb)</code>
-<blockquote>
-The function used to combine distance to compute the distance of a
-path.  The CombineFunction must be a model of <code>BinaryFunction</code>.
-The argument types must match the value type of the <code>WeightMap</code>.
-The result type must be the same as the distance value type.<br>
-
-<b>Default:</b> <code>boost::closed_plus&lt;WM&gt;</code> with <code>WM = typename property_traits&lt;WeightMap&gt;::value_type</code> +<blockquote>该函数用于将距离相加,以计算一条路径的距离。类型 <tt>CombineFunction</tt> 必须为二元谓词<a href="http://www.sgi.com/tech/stl/BinaryFunction.html";></a>。其参数类型要与 &nbsp;<tt>WeightMap</tt> 属性映射的值类型相匹配。<br>
+
+<b>缺省值:</b><code>boost::closed_plus&lt;WM&gt;</code> 其中 <code>WM = typename property_traits&lt;WeightMap&gt;::value_type</code>
 </blockquote>

 IN: <code>distance_inf(WM inf)</code>
 <blockquote>
-The value used to initialize the distance for each vertex before
-starting the algorithm, and to represent the distance between vertices
-for which there is not path.  Should be larger than any possible valid
-path length.  The argument type must match the value type of the <code>
-WeightMap</code>.<br>
-
-<b>Default:</b> <code>std::numeric_limits&lt;WM&gt;::max()</code> with <code>WM = typename property_traits&lt;WeightMap&gt;::value_type</code> + <span style="font-family: monospace;">该值被用于在算法开始之前对各个顶点 的距离进行初始化,也用于表示之间没有路径的两个顶点间的距离。它应该大于任何可 能的有效路径长度。参数</span>类型必须与&nbsp;<tt>WeigthMap</tt> 的值类型相匹 配。<br>
+
+<b>缺省值:</b><code>std::numeric_limits&lt;WM&gt;::max()</code> 其中 <code>WM = typename property_traits&lt;WeightMap&gt;::value_type</code>
 </blockquote>

 IN: <code>distance_zero(WM zero)</code>
-<blockquote>
-The value used to represent the distance from a vertex to itself, and
-to determine if a value is negative.  The argument type must match the
-value type of the <code>WeightMap</code>.<br>
-<b>Default:</b> <code>0</code>
+<blockquote>该值用于表示一个顶点与其自身的距离,并用于判断某个值是否为负。 <span style="font-family: monospace;">参数</span>类型必须与 &nbsp;<tt>WeigthMap</tt> 的值类型相匹配。<br>
+<b>缺省值:</b><code>0</code>
 </blockquote>

-<h3>Complexity</h3>
-
-The time complexity is <i>O(V<sup>3</sup>)</i>.
+<h3>Complexity 复杂度</h3>时间复杂度为 <i>O(V<sup>3</sup>)</i>.

 <br>
-<HR>
-<TABLE>
-<TR valign=top>
-<TD nowrap>Copyright &copy 2002-2004</TD><TD>
+<hr>
+<table>
+<tbody><tr valign="top">
+<td nowrap="nowrap">Copyright © 2002-2004</td><td>
   Lauren Foutz, Rensselaer Polytechnic Institute</td>
   </tr><tr valign="top"><td></td>
   <td>Scott Hill, Rensselaer Polytechnic Institute
-</TD></TR></TABLE>
-
-</BODY>
-</HTML>
+</td></tr></tbody></table>
+
+</body></html>
=======================================
--- /trunk/libs/graph/doc/johnson_all_pairs_shortest.html Mon Mar 30 07:58:04 2009 +++ /trunk/libs/graph/doc/johnson_all_pairs_shortest.html Sun Aug 2 22:26:22 2009
@@ -1,31 +1,27 @@
-<HTML>
-<!--
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><!--
   -- Copyright (c) Jeremy Siek 2000
   --
   -- Distributed under the Boost Software License, Version 1.0.
   -- (See accompanying file LICENSE_1_0.txt or copy at
   -- http://www.boost.org/LICENSE_1_0.txt)
   -->
-<Head>
-<Title>Johnson All Pairs Shortest Paths</Title>
-<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
-        ALINK="#ff0000">
-<IMG SRC="../../../boost.png"
-     ALT="C++ Boost" width="277" height="86">
-
-<BR Clear>
-
-<H1><A NAME="sec:johnson">
-<TT>johnson_all_pairs_shortest_paths</TT>
-</H1>
-
-<PRE>
-<i>// named parameter version</i>
+<title>Johnson All Pairs Shortest Paths</title></head>
+<body alink="#ff0000" bgcolor="#ffffff" link="#0000ee" text="#000000" vlink="#551a8b">
+<img src="../../../boost.png" alt="C++ Boost" height="86" width="277">
+
+<br clear="">
+
+<h1><a name="sec:johnson">
+<tt>johnson_all_pairs_shortest_paths</tt>
+</a></h1>
+
+<pre><a name="sec:johnson"><i>// 命名参数版本</i>
   template &lt;class VertexAndEdgeListGraph, class DistanceMatrix,
             class VertexID, class Weight, class BinaryPredicate,
             class BinaryFunction, class Infinity, class DistanceZero&gt;
   bool
-  johnson_all_pairs_shortest_paths(VertexAndEdgeListGraph& g1,
+  johnson_all_pairs_shortest_paths(VertexAndEdgeListGraph&amp; g1,
                DistanceMatrix&amp; D,
                VertexID id1, Weight w1, const BinaryPredicate&amp; compare,
                const BinaryFunction&amp; combine, const Infinity&amp; inf,
@@ -33,180 +29,118 @@

template &lt;typename Graph, typename DistanceMatrix, typename P, typename T, typename R&gt;
 bool johnson_all_pairs_shortest_paths(Graph&amp; g, DistanceMatrix&amp; D,
-  const bgl_named_params&lt;P, T, R&gt;&amp; params = <i>all defaults</i>)
-
-<i>// non-named parameter version</i>
+ const bgl_named_params&lt;P, T, R&gt;&amp; params = <i>all defaults</i>)<br><br><i>// 非命名参数版本</i>
 template &lt;typename Graph, typename DistanceMatrix,
           typename VertexIndex, typename WeightMap, typename DT&gt;
 bool
 johnson_all_pairs_shortest_paths(VertexAndEdgeListGraph&amp; g1,
   DistanceMatrix&amp; D,
   VertexIndex i_map, WeightMap w_map, DT zero)
-</PRE>
-
-<P>
-This algorithm finds the shortest distance between every pair of
-vertices in the graph. The algorithm returns false if there is a
-negative weight cycle in the graph and true otherwise. The distance
-between each pair of vertices is stored in the distance matrix
-<TT>D</TT>. This is one of the more time intensive graph algorithms,
-having a time complexity of <i>O(V E log V)</i>.
-
-<P>This algorithm should be used to compute shortest paths between
-every pair of vertices for sparse graphs. For dense graphs, use <a
-href="floyd_warshall_shortest.html"><code>floyd_warshall_all_pairs_shortest_paths</code></a>.
-
-<H3>Where Defined</H3>
-
-<P>
-<a href="../../../boost/graph/johnson_all_pairs_shortest.hpp"><TT>boost/graph/johnson_all_pairs_shortest.hpp</TT></a>
+</a></pre>
+
+<p>
+<a name="sec:johnson">该算法找出图中每对顶点间的最短距离。如果图中存在负权 回路,本算法将返回 false,否则返回 true。每对顶点间的距离被保存在距离矩阵 +<tt>D</tt> 中。这是一个时间密集型的图算法,时间复杂度为 <i>O(V E log V)</i>。
+
+</a></p><p><a name="sec:johnson">该算法通常被用于计算稀疏图的每对顶点间的最 短路径。对于稠密图,请使用 </a><a href="floyd_warshall_shortest.html"><code>floyd_warshall_all_pairs_shortest_paths</code></a>。
+
+</p><h3>Where Defined 定义于</h3>
+
+<p>
+<a href="../../../boost/graph/johnson_all_pairs_shortest.hpp"><tt>boost/graph/johnson_all_pairs_shortest.hpp</tt></a>


-<h3>Parameters</h3>
+</p><h3>Parameters 参数</h3>

 IN: <tt>Graph&amp; g</tt>
-<blockquote>
-A directed or undirected graph. The graph type must be a model of
-<a href="VertexListGraph.html">Vertex List Graph</a>,
-<a href="EdgeListGraph.html">Edge List Graph</a>,
-and <a href="IncidenceGraph.html">Incidence Graph</a>.
+<blockquote>一个有向图或无向图。图的类型必须符合
+<a href="VertexListGraph.html">点列表图Vertex List Graph</a>,
+<a href="EdgeListGraph.html">边列表图Edge List Graph</a>, 和 <a href="IncidenceGraph.html">关联图Incidence Graph</a>。
 </blockquote>

 OUT: <tt>DistanceMatrix&amp; D</tt>
-<blockquote>
-The length of the shortest path between each pair of vertices
-<i>u,v</i> in the graph is stored in <tt>D[u][v]</tt>. The set of
-types {<tt>DistanceMatrix, vertices_size_type, D</tt>} must be a model
-of <a href="BasicMatrix.html">BasicMatrix</a> where <tt>D</tt> is the
-value type of the <tt>DistanceMap</tt>.
+<blockquote>图中每对顶点
+<i>u,v</i> 的最短路径长度被保存在 <tt>D[u][v]</tt>。类型集 {<tt>DistanceMatrix, vertices_size_type, D</tt>} 必须为 <a href="BasicMatrix.html">基础矩阵BasicMatrix</a>,其中 <tt>D</tt> 为 <tt>DistanceMap</tt> 的值类型。
 </blockquote>


-<h3>Named Parameters</h3>
+<h3>Named Parameters 命名参数</h3>

 IN: <tt>weight_map(WeightMap w_map)</tt>
-<blockquote>
-  The weight or ``length'' of each edge in the graph.
-  The type <tt>WeightMap</tt> must be a model of
- <a href="../../property_map/ReadablePropertyMap.html">Readable Property Map</a>. The edge descriptor type of
-  the graph needs to be usable as the key type for the weight
-  map. The value type for the map must be
-  <i>Addable</i> with the value type of the distance map.<br>
-  <b>Default:</b>  <tt>get(edge_weight, g)</tt>
+<blockquote>图中每条边的权重或"长度"。类型 <tt>WeightMap</tt> 必须符合
+ <a href="../../property_map/ReadablePropertyMap.html">可读属性映射</a>。 图的边描述符类型必须可用作这个权重映射的键类型。该映射的值类型必须可以与距离 映射的值类型相加。<br>
+  <b>缺省值:</b><tt>get(edge_weight, g)</tt>
 </blockquote>

 UTIL: <tt>weight_map2(WeightMap2 w2_map)</tt>
-<blockquote>
-  This parameter is no longer needed, and will be ignored.
+<blockquote>该参数不再需要,即将被忽略。
 </blockquote>

 IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
-<blockquote>
-  This maps each vertex to an integer in the range <tt>[0,
-    num_vertices(g))</tt>. This is necessary for efficient updates of the
- heap data structure in the internal call to Dijkstra's algorithm. The type
-  <tt>VertexIndexMap</tt> must be a model of
- <a href="../../property_map/ReadablePropertyMap.html">Readable Property Map</a>. The value type of the map must be an
-  integer type. The vertex descriptor type of the graph needs to be
-  usable as the key type of the map.<br>
-  <b>Default:</b> <tt>get(vertex_index, g)</tt>
-    Note: if you use this default, make sure your graph has
-    an internal <tt>vertex_index</tt> property. For example,
-    <tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
-    not have an internal <tt>vertex_index</tt> property.
-   <br>
+<blockquote>它将每个顶点映射至位于区间 <tt>[0,
+ num_vertices(g))</tt> 中的一个整数。在内部调用 Dijkstra 算法时,堆数据结 构必须可以高效地更新。类型 <tt>VertexIndexMap</tt> + 必须符合 <a href="../../property_map/ReadablePropertyMap.html">可读属性映 射</a>。该映射的值类型必须是一个整数类型。图的顶点描述符类型需要可以被用作该 映射的键类型。<br>
+
+
+  <b>缺省值:</b><tt>get(vertex_index, g)</tt>.
+ 注意:如果你使用该缺省值,请确认你的图具有一个内部的 <tt>vertex_index</tt> 属性。例如,带 <tt>VertexList=listS</tt> 的
+    <tt>adjacenty_list</tt> 并不具有内部的 <tt>vertex_index</tt> 属性。<br>
 </blockquote>


 UTIL: <tt>distance_map(DistanceMap d_map)</tt>
-<blockquote>
-  This parameter is no longer needed, and will be ignored.
+<blockquote>该参数不再需要,即将被忽略。
 </blockquote>

 IN: <tt>distance_compare(CompareFunction cmp)</tt>
-<blockquote>
-  This function is use to compare distances to determine
-  which vertex is closer to the source vertex.
-  The <tt>CompareFunction</tt> type must be a model of
-  \stlconcept{BinaryPredicate} and have argument types that
-  match the value type of the <tt>WeightMap</tt> property map.<br>
-  <b>Default:</b> <tt>std::less&lt;DT&gt;</tt> with
-  <tt>DT=typename&nbsp;property_traits&lt;WeightMap&gt;::value_type</tt>
+<blockquote>该函数用于比较距离,以决定哪个顶点更接近于源顶点。类型 <tt>CompareFunction</tt> 必须符合 <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html";>二元谓词</a> 且其参 数类型要与&nbsp;<tt>WeightMap</tt> 属性映射的值类型相匹配。<br>
+
+  <b>缺省值:</b><tt>std::less&lt;DT&gt;</tt> 其中 <tt>DT=typename
+  property_traits&lt;</tt><tt>WeightMap</tt><tt>&gt;::value_type</tt>
 </blockquote>

 IN: <tt>distance_combine(CombineFunction cmb)</tt>
-<blockquote>
-  This function is used to combine distances to compute the distance
-  of a path. The <tt>CombineFunction</tt> type must be a model of <a
-  href="http://www.sgi.com/tech/stl/BinaryFunction.html";>Binary
-  Function</a>. The first argument type of the binary function must
-  match the value type of the <tt>DistanceMap</tt> property map and
-  the second argument type must match the value type of the
-  <tt>WeightMap</tt> property map.  The result type must be the same
-  type as the distance value type.<br>
-  <b>Default:</b> <tt>std::plus&lt;DT&gt;</tt> with
-   <tt>DT=typename&nbsp;property_traits&lt;WeightMap&gt;::value_type</tt>
+<blockquote>该函数用于将距离相加,以计算一条路径的距离。类型 <tt>CombineFunction</tt> 必须符合 <a href="http://www.sgi.com/tech/stl/BinaryFunction.html";>二元谓词</a>。该二元 函数的第一个参数类型必须与 <tt>DistanceMap</tt> 属性映射的值类型相匹配,第二 个参数类型必须与 + <tt>WeightMap</tt> 属性映射的值类型相匹配。结果类型必须与距离值类型相同。 <br>
+
+  <b>缺省值:</b><tt>std::plus&lt;DT&gt;</tt> 其中
+   <tt>DT=typename property_traits&lt;DistanceMap&gt;::value_type</tt>
 </blockquote>

 IN: <tt>distance_inf(DT inf)</tt>
 <blockquote>
-  This value is used to initialize the distance for each
-  vertex before the start of the algorithm.
- The type <tt>DT</tt> must be the value type of the <tt>WeigthMap</tt>.<br>
-  <b>Default:</b> <tt>std::numeric_limits::max()</tt>
+ <span style="font-family: monospace;">该值被用于在算法开始之前对各个顶点 的距离进行初始化。</span>类型 <tt>DT</tt> 必须是&nbsp;<tt>WeigthMap</tt> 的 值类型。<br>
+  <b>缺省值:</b><tt>std::numeric_limits::max()</tt>
 </blockquote>

 IN: <tt>distance_zero(DT zero)</tt>
-<blockquote>
-  This value is used to initialize the distance for the source
-  vertex before the start of the algorithm.  The type <tt>DT</tt>
-  must be the value type of the <tt>WeigthMap</tt>.<br>
-  <b>Default:</b> <tt>0</tt>
+<blockquote>该值被用于在算法开始之前对源顶点的距离进行初始化。类型 <tt>DT</tt>
+  必须是 <tt>WeigthMap</tt> 的值类型。<br>
+  <b>缺省值:</b><tt>0</tt>
 </blockquote>

 UTIL/OUT: <tt>color_map(ColorMap c_map)</tt>
-<blockquote>
-  This is used during the execution of the algorithm to mark the
-  vertices. The vertices start out white and become gray when they are
-  inserted in the queue. They then turn black when they are removed
-  from the queue. At the end of the algorithm, vertices reachable from
-  the source vertex will have been colored black. All other vertices
-  will still be white. The type <tt>ColorMap</tt> must be a model of
-  <a href="../../property_map/ReadWritePropertyMap.html">Read/Write
-  Property Map</a>. A vertex descriptor must be usable as the key type
-  of the map, and the value type of the map must be a model of
-  <a href="./ColorValue.html">Color Value</a>.<br>
-  <b>Default:</b> an <a
-  href="../../property_map/iterator_property_map.html">
-  <tt>iterator_property_map</tt></a> created from a <tt>std::vector</tt>
-  of <tt>default_color_type</tt> of size <tt>num_vertices(g)</tt> and
-  using the <tt>i_map</tt> for the index map.
+<blockquote>用于在算法的执行期间对顶点进行标记。各顶点在开始时为白色,当被 插入队列时变为灰色。当被从队列中移出时变为黑色。在算法结束时,可以从源顶点到 达的所有顶点均变为黑色。其它所有顶点仍为白色。类型 <tt>ColorMap</tt> 必须符 + <a href="../../property_map/ReadWritePropertyMap.html">读/写属性映射 </a>。顶点描述符必须可被用作该映射的键类型,且该映射的值类型必须符合
+  <a href="ColorValue.html">颜色值Color Value</a>。<br>
+ <b>缺省值:</b>一个 <a href="../../property_map/iterator_property_map.html"> + <tt>iterator_property_map</tt></a>,创建自一个大小为 <tt>num_vertices(g)</tt> 的 <tt>default_color_type</tt> 的 <tt>std::vector</tt>,且以 <tt>i_map</tt> 作为索引映射。
 </blockquote>


-<h3>Complexity</h3>
-
-The time complexity is <i>O(V E log V)</i>.
+<h3>Complexity 复杂度</h3>时间复杂度为 <i>O(V E log V)</i>.
+


-
-<H3>Example</H3>
-
-<P>
-The file <a
-href="../example/johnson-eg.cpp"><tt>example/johnson-eg.cpp</tt></a> applies
-Johnson's algorithm for all-pairs shortest paths to the example graph
-from page 568 of the CLR&nbsp;[<A
-HREF="bibliography.html#clr90">8</A>].
-
-
-<br>
-<HR>
-<TABLE>
-<TR valign=top>
-<TD nowrap>Copyright &copy 2000-2001</TD><TD>
-<A HREF="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</A>, Indiana University (<A HREF="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</A>)
-</TD></TR></TABLE>
-
-</BODY>
-</HTML>
+<h3>Example 示例</h3>
+
+<p>文件 <a href="../example/johnson-eg.cpp"><tt>example/johnson-eg.cpp</tt></a> 将 +Johnson 算法应用于 CLR&nbsp;[<a href="bibliography.html#clr90">8</a>] 第 568页的示例图,计算所有顶点对的最短路径。<br>
+</p><hr>
+<table>
+<tbody><tr valign="top">
+<td nowrap="nowrap">Copyright © 2000-2001</td><td>
+<a href="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</a>, Indiana University (<a href="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</a>)
+</td></tr></tbody></table>
+
+</body></html>
=======================================
--- /trunk/libs/graph/doc/r_c_shortest_paths.html       Mon Mar 30 07:58:04 2009
+++ /trunk/libs/graph/doc/r_c_shortest_paths.html       Sun Aug  2 22:26:22 2009
@@ -1,5 +1,5 @@
-<html>
-<!--
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><!--
   -- Copyright (c) Michael Drexl 2006
   --
   -- Permission to use, copy, modify, and distribute this software
@@ -10,328 +10,204 @@
   -- 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: Resource-Constrained Shortest Paths</title>
-<body bgcolor="#ffffff" link="#0000ee" text="#000000" vlink="#551a8b"
-        alink="#ff0000">
-<img src="../../../boost.png"
-     alt="C++ Boost" width="277" height="86">
-
-<br Clear>
+<title>Boost Graph Library: Resource-Constrained Shortest Paths</title></head> +<body alink="#ff0000" bgcolor="#ffffff" link="#0000ee" text="#000000" vlink="#551a8b">
+<img src="../../../boost.png" alt="C++ Boost" height="86" width="277">
+
+<br clear="">

 <h1><a name="sec:espprc"></a>
 <tt>r_c_shortest_paths</tt>
 </h1>

 <p>
-<pre>
-
-template&lt;class Graph,
-         class VertexIndexMap,
-         class EdgeIndexMap,
-         class Resource_Container,
-         class Resource_Extension_Function,
-         class Dominance_Function,
-         class Label_Allocator,
-         class Visitor&gt;
-void r_c_shortest_paths( const Graph&amp; g,
-                         const VertexIndexMap&amp; vertex_index_map,
-                         const EdgeIndexMap&amp; edge_index_map,
- typename graph_traits&lt;Graph&gt;::vertex_descriptor s, - typename graph_traits&lt;Graph&gt;::vertex_descriptor t, - std::vector&lt;std::vector&lt;typename graph_traits&lt;Graph&gt;::edge_descriptor&gt; &gt;&amp; pareto_optimal_solutions, - std::vector&lt;Resource_Container&gt;&amp; pareto_optimal_resource_containers,
-                         const Resource_Container&amp; rc,
-                         const Resource_Extension_Function&amp; ref,
-                         const Dominance_Function&amp; dominance,
-                         Label_Allocator la,
-                         Visitor vis )
-
-template&lt;class Graph,
-         class VertexIndexMap,
-         class EdgeIndexMap,
-         class Resource_Container,
-         class Resource_Extension_Function,
-         class Dominance_Function,
-         class Label_Allocator,
-         class Visitor&gt;
-void r_c_shortest_paths( const Graph&amp; g,
-                         const VertexIndexMap&amp; vertex_index_map,
-                         const EdgeIndexMap&amp; edge_index_map,
- typename graph_traits&lt;Graph&gt;::vertex_descriptor s, - typename graph_traits&lt;Graph&gt;::vertex_descriptor t, - std::vector&lt;typename graph_traits&lt;Graph&gt;::edge_descriptor&gt;&amp; pareto_optimal_solution, - Resource_Container&gt;&amp; pareto_optimal_resource_container,
-                         const Resource_Container&amp; rc,
-                         const Resource_Extension_Function&amp; ref,
-                         const Dominance_Function&amp; dominance,
-                         Label_Allocator la,
-                         Visitor vis )
-
-template&lt;class Graph,
-         class VertexIndexMap,
-         class EdgeIndexMap,
-         class Resource_Container,
-         class Resource_Extension_Function,
-         class Dominance_Function&gt;
-void r_c_shortest_paths( const Graph&amp; g,
-                         const VertexIndexMap&amp; vertex_index_map,
-                         const EdgeIndexMap&amp; edge_index_map,
- typename graph_traits&lt;Graph&gt;::vertex_descriptor s, - typename graph_traits&lt;Graph&gt;::vertex_descriptor t, - std::vector&lt;std::vector&lt;typename graph_traits&lt;Graph&gt;::edge_descriptor&gt; &gt;&amp; pareto_optimal_solutions, - std::vector&lt;Resource_Container&gt;&amp; pareto_optimal_resource_containers,
-                         const Resource_Container&amp; rc,
-                         const Resource_Extension_Function&amp; ref,
-                         const Dominance_Function&amp; dominance )
-
-template&lt;class Graph,
-         class VertexIndexMap,
-         class EdgeIndexMap,
-         class Resource_Container,
-         class Resource_Extension_Function,
-         class Dominance_Function&gt;
-void r_c_shortest_paths( const Graph&amp; g,
-                         const VertexIndexMap&amp; vertex_index_map,
-                         const EdgeIndexMap&amp; edge_index_map,
- typename graph_traits&lt;Graph&gt;::vertex_descriptor s, - typename graph_traits&lt;Graph&gt;::vertex_descriptor t, - std::vector&lt;typename graph_traits&lt;Graph&gt;::edge_descriptor&gt;&amp; pareto_optimal_solution, - Resource_Container&gt;&amp; pareto_optimal_resource_container,
-                         const Resource_Container&amp; rc,
-                         const Resource_Extension_Function&amp; ref,
-                         const Dominance_Function&amp; dominance )
-
-</pre>
-
-<h3>Introduction and Problem Description</h3>
-
-The shortest path problem with resource constraints (SPPRC) seeks a shortest (cheapest, fastest) path in a directed graph with arbitrary arc lengths (travel times, costs) from an origin node to a destination node subject to one or more resource constraints. For example, one might seek a path of minimum length from <i>s</i> to <i>t</i> subject to the constraints that +</p><pre>template&lt;class Graph,<br> class VertexIndexMap,<br> class EdgeIndexMap,<br> class Resource_Container,<br> class Resource_Extension_Function,<br> class Dominance_Function,<br> class Label_Allocator,<br> class Visitor&gt;<br>void r_c_shortest_paths( const Graph&amp; g,<br> const VertexIndexMap&amp; vertex_index_map,<br> const EdgeIndexMap&amp; edge_index_map,<br> typename graph_traits&lt;Graph&gt;::vertex_descriptor s,<br> typename graph_traits&lt;Graph&gt;::vertex_descriptor t,<br> std::vector&lt;std::vector&lt;typename graph_traits&lt;Graph&gt;::edge_descriptor&gt; &gt;&amp; pareto_optimal_solutions,<br> std::vector&lt;Resource_Container&gt;&amp; pareto_optimal_resource_containers,<br> const Resource_Container&amp; rc,<br> const Resource_Extension_Function&amp; ref,<br> const Dominance_Function&amp; dominance,<br> Label_Allocator la,<br> Visitor vis )<br><br>template&lt;class Graph,<br> class VertexIndexMap,<br> class EdgeIndexMap,<br> class Resource_Container,<br> class Resource_Extension_Function,<br> class Dominance_Function,<br> class Label_Allocator,<br> class Visitor&gt;<br>void r_c_shortest_paths( const Graph&amp; g,<br> const VertexIndexMap&amp; vertex_index_map,<br> const EdgeIndexMap&amp; edge_index_map,<br> typename graph_traits&lt;Graph&gt;::vertex_descriptor s,<br> typename graph_traits&lt;Graph&gt;::vertex_descriptor t,<br> std::vector&lt;typename graph_traits&lt;Graph&gt;::edge_descriptor&gt;&amp; pareto_optimal_solution,<br> Resource_Container&gt;&amp; pareto_optimal_resource_container,<br> const Resource_Container&amp; rc,<br> const Resource_Extension_Function&amp; ref,<br> const Dominance_Function&amp; dominance,<br> Label_Allocator la,<br> Visitor vis )<br><br>template&lt;class Graph,<br> class VertexIndexMap,<br> class EdgeIndexMap,<br> class Resource_Container,<br> class Resource_Extension_Function,<br> class Dominance_Function&gt;<br>void r_c_shortest_paths( const Graph&amp; g,<br> const VertexIndexMap&amp; vertex_index_map,<br> const EdgeIndexMap&amp; edge_index_map,<br> typename graph_traits&lt;Graph&gt;::vertex_descriptor s,<br> typename graph_traits&lt;Graph&gt;::vertex_descriptor t,<br> std::vector&lt;std::vector&lt;typename graph_traits&lt;Graph&gt;::edge_descriptor&gt; &gt;&amp; pareto_optimal_solutions,<br> std::vector&lt;Resource_Container&gt;&amp; pareto_optimal_resource_containers,<br> const Resource_Container&amp; rc,<br> const Resource_Extension_Function&amp; ref,<br> const Dominance_Function&amp; dominance )<br><br>template&lt;class Graph,<br> class VertexIndexMap,<br> class EdgeIndexMap,<br> class Resource_Container,<br> class Resource_Extension_Function,<br> class Dominance_Function&gt;<br>void r_c_shortest_paths( const Graph&amp; g,<br> const VertexIndexMap&amp; vertex_index_map,<br> const EdgeIndexMap&amp; edge_index_map,<br> typename graph_traits&lt;Graph&gt;::vertex_descriptor s,<br> typename graph_traits&lt;Graph&gt;::vertex_descriptor t,<br> std::vector&lt;typename graph_traits&lt;Graph&gt;::edge_descriptor&gt;&amp; pareto_optimal_solution,<br> Resource_Container&gt;&amp; pareto_optimal_resource_container,<br> const Resource_Container&amp; rc,<br> const Resource_Extension_Function&amp; ref,<br> const Dominance_Function&amp; dominance )<br><br></pre>
+
+<h3>Introduction and Problem Description 简介与问题描述</h3>带资源限制的最 短路径问题(SPPRC)是指,在一个带有边长度(旅行时间、花费)的有向图中,在一个或 多个资源限制下,找出从源顶点到目标顶点间的最短(最便宜、最快)路径。例如,你可 能想在以下限制下,找出从 <i>s</i> 到 <i>t</i> 的一条最短长度的路径。
 <ul>
-<li>
-the total travel time must not exceed some upper bound and/or
-<li>
-the total amount of some good that has to be picked up at the vertices along the path be less than or equal to some capacity limit and/or
-<li>
-if two vertices <i>i</i> and <i>j</i> are visited on a path, then <i>i</i> must be visited before <i>j</i>
-<li>
-etc.
-</ul>
-
-<p>
-The problem is NP-hard in the strong sense. If the path need not be elementary, i.e., if it is allowed that vertices are visited more than once, the problem can be solved in pseudopolynomial time. A central aspect is that two (partial) paths in an SPPRC can be incomparable, contrary to the SPP without resource constraints. This makes the SPPRC similar to a multi-criteria decision problem.<br>
-A recent survey on the problem is:<br>
+<li>总的旅行时间不得超过某个上界,且/或
+</li><li>沿着路径在各个顶点必须携带的货品总数小于或等于某个容量限制,且/或
+</li><li>如果在路径上有 <i>i</i> 和 <i>j</i> 两个顶点,则 <i>i</i> 必须在 <i>j</i> 之前
+</li><li>等等
+</li></ul>
+
+<p>严格说来,这个问题是NP难度的。如果不要求路径是基本的,即如果允许有顶点被 多次访问,则该问题可以在伪多项式时间内解决。核心内容是,一个SPPRC中的两条(部 分)路径是不可比较的,这与不带资源限制的SPP不同。这使得SPPRC类似于多准则决策 问题。<br>对该问题的最近一项研究是:<br>
 Irnich, S.; Desaulniers, G. (2005):<br>
 Shortest Path Problems with Resource Constraints<br>
 in:<br>
 Desaulniers, G.; Desrosiers, J.; Solomon, M. (eds.) (2005):<br>
 Column Generation<br>
-Springer, New York, pp. 33&ndash;65<br>
-(available online <a href="http://www.dpor.rwth-aachen.de/de/publikationen/pdf/or_2004-01.pdf";>
-here</a>)
-<p>
-
-<p>
-The present document cannot give a complete introduction to SPPRCs. To get a thorough understanding of the problem, the reader is referred to the above paper. However, to understand the algorithm and its implementation, it is necessary to explain some fundamental ideas and point out the differences to a labelling algorithm for the shortest path problem without resource constraints (SPP).
+Springer, New York, pp. 33–65<br>
+(<a href="http://www.dpor.rwth-aachen.de/de/publikationen/pdf/or_2004-01.pdf";>在 此</a>可在线访问) +</p><p>本文档并不能给出对SPPRC的完整介绍。读者如何想要完整地了解该问题,请 参考以上论文。不过,要理解本算法及其实现,需要解释一些基本的思想,并指出与无 资源限制最短路径问题(SPP)的标签算法间的差别。
 </p>

-<p>
-The standard solution technique for SPPRCs is a labelling algorithm based on dynamic programming. This approach uses the concepts of <i>resources</i> and <i>resource extension functions</i>. A resource is an arbitrarily scaled one-dimensional piece of information that can be determined or measured at the vertices of a directed walk in a graph. Examples are cost, time, load, or the information &lsquo;Is a vertex <i>i</i> visited on the current path?&rsquo;. A resource is <i>constrained</i> if there is at least one vertex in the graph where the resource must not take all possible values. The <i>resource window</i> of a resource at a vertex is the set of allowed values for the resource at this vertex. +<p>SPPRC的标准解法是基于动态规划的标签算法。该方法使用了 <i>资源 resources</i> 和 <i>资源扩展函数resource extension functions</i> 的概念。资 源是可以在图的某个有向路径中各顶点上被确定或测量的某种一维扩展的信息片。例如 费用、时间、负载,或是类似"在当前路径上是否已访问了顶点<i>i</i>"的信息。如果 图中有至少一个顶点,其资源不能取为所有可能的值,则称该资源是<i>受约束的 </i>。资源在某个顶点处的 <i>资源窗口resource window</i> 是指,该资源在该顶点 处可允许的值集。
 </p>

-<p>
-A resource extension function is defined on each arc in a graph for each resource considered. A resource extension function for a resource maps the set of all possible vectors (in a mathematical sense, not to be confused with a <tt>std::vector</tt>) of resource values at the source of an arc to the set of possible values of the resource at the target of the arc. This means that the value of a resource at a vertex may depend on the values of one or more other resources at the preceding vertex. +<p>对于每个要考虑的资源,图中的每条边都定义有一个资源扩展函数。某个资源的资 源扩展函数将一条边的源顶点处的资源值的所有可能的向量(数学意义上的,不要与 <tt>std::vector</tt> 混淆)集合映射至该边的目标顶点处的资源可能值的集合。这意 味着某个顶点处的资源值可能依赖于其前趋顶点处的一个或多个其它资源的值。
 </p>

 <p>
-<i>Labels</i> are used to store the information on the resource values for partial paths. A label in an SPPRC labelling algorithm is not a mere triple of resident vertex, current cost and predecessor vertex, as it is the case in labelling algorithms for the SPP. A label for an SPPRC labelling algorithm stores its resident vertex, its predecessor <i>arc</i> over which it has been extended, its predecessor label, and its current vector of resource values. The criterion to be minimized (cost, travel time, travel distance, whatsoever) is also treated as a (possibly unconstrained) resource. It is necessary to store the predecessor arc instead of the predecessor vertex, because, due to the resource constraints, one can not assume that the underlying graph is simple. Labels reside at vertices, and they are propagated via resource extension functions when they are extended along an arc. An <i>extension</i> of a label along an arc (<i>i</i>, <i>j</i>) is <i>feasible</i> if the resulting label <i>l</i> at <i>j</i> is feasible, which is the case if and only if all resource values of <i>l</i> are within their resource windows.
+<i>标签Labels</i>
+用于为部分路径保存资源的信息。一个SPPRC标签算法中的标签不象SPP标签算法中的 标签那样,仅仅是常驻顶点、当前费用以及前趋顶点这三 +个的组合。SPPRC标签算法中的标签保存了它的常驻顶点、它被扩展的前趋边、它的前 趋标签,以及它当前的资源值向量。被最小化的标准(费 +用、旅行时间、旅行距离或其它)也被视为一个(可能是不受限的)资源。之所以要保存 前趋边而不是前趋顶点,是因为,由于资源受到约束,你不能假定底层的图 +是简单的。标签被记录在顶点上,当它们沿着某条边扩展时,会通过资源扩展函数被 传播。标签沿着某条边 (<i>i</i>, <i>j</i>) 的 <i>扩展extension</i> 是 <i>可行 的feasible</i>,如果在&nbsp;<i>j</i> 所得的标签 <i>l</i> 是可行的,即 <i>l</i> 的所有资源值都位于其资源窗口中。
 </p>

-<p>
-To keep the number of labels as small as possible, it is decisive to perform a <i>dominance step</i> for eliminating unnecessary labels. A label <i>l</i><sub>1</sub> <i>dominates</i> a label <i>l</i><sub>2</sub> if both reside at the same vertex and if, for each feasible extension of <i>l</i><sub>2</sub>, there is also a feasible extension of <i>l</i><sub>1</sub> where the value of each cardinally scaled resource is less than or equal to the value of the resource in the extension of <i>l</i><sub>2</sub>, and where the value of each nominally scaled resource is equal to the value of the resource in the extension of <i>l</i><sub>2</sub>. Dominated labels need not be extended. A label which is not dominated by any other label is called undominated or Pareto-optimal. The application of the dominance principle is optional&mdash;at least from a theoretical perspective. +<p>为了令标签的数量尽可能少,很重要的一点是执行一个 <i>优化步骤</i> 以消除 不需要的标签。标签 <i>l</i><sub>1</sub> <i>优于</i> 另一个标签 <i>l</i><sub>2</sub>,如果它们都位于同一个顶点且,对于 <i>l</i><sub>2</sub> 的每一个可行的扩展,也有 <i>l</i><sub>1</sub> 的一个可行扩展,其每个主要标度 资源的值都小于或等于 <i>l</i><sub>2</sub> 扩展中的资源值,且每个名义标度资源 的值都等于 <i>l</i><sub>2</sub> 扩展中的资源值。被优化掉的标签无需扩展。未被 其它标签优化掉的标签称为 未被优化掉 或 较优的。优化原理的应用是可选的—至少理 论上如此。
 </p>

-<p>
-The implementation is a label-setting algorithm. This means that there must be one or more resources whose cumulated consumption(s) after extension is/are always at least as high as before. This is similar to the Dijkstra algorithm for the SPP without resource constraints where the distance measure must be non-negative. It is sufficient if there is one resource with a non-negative resource consumption along all arcs (for example, non-negative arc lengths or non-negative arc traversal times). +<p>本实现是一个 标签-设定 算法。这意味着必须有一个或多个资源,其累计量在扩 展后总是要至少与之前一样高。这类似于无资源限制的SPP所用的 +Dijkstra 算法,其距离量必须是非负的。如果有一个资源对于所有边都具有非负的资 源量(例如,非负的边长度或非负的边旅行时间),即可满足。
 </p>

-<h3>Concepts</h3>
-
-<h4>ResourceContainer</h4>
-
-<p>
-A type modelling the ResourceContainer concept is used to store the current resource consumptions of a label.
+<h3>Concepts 概念</h3>
+
+<h4>ResourceContainer 资源容器</h4>
+
+<p>一个符合 ResourceContainer 概念的类型用于保存某个标签的当前资源消耗量。
 </p>

 <p>
-<b>Refinement of</b><br>
-<a href="http://www.sgi.com/tech/stl/DefaultConstructible.html";>DefaultConstructible</a>, <a href="../../utility/CopyConstructible.html">CopyConstructible</a>, <a href="http://www.sgi.com/tech/stl/Assignable.html";>Assignable</a>, <a href="http://www.sgi.com/tech/stl/LessThanComparable.html";>LessThanComparable</a>, <a href="http://www.sgi.com/tech/stl/EqualityComparable.html";>EqualityComparable</a>
+<b>Refinement of 精化自</b><br>
+<a href="http://www.sgi.com/tech/stl/DefaultConstructible.html";>可缺省构造 DefaultConstructible</a>, <a href="../../utility/CopyConstructible.html">可 复制构造CopyConstructible</a>, <a href="http://www.sgi.com/tech/stl/Assignable.html";>可赋值Assignable</a>, <a href="http://www.sgi.com/tech/stl/LessThanComparable.html";>可小于比较 LessThanComparable</a>, <a href="http://www.sgi.com/tech/stl/EqualityComparable.html";>可等价比较 EqualityComparable</a>
 </p>

 <p>
-<b>Valid Expressions</b><br>
-See <a href="#ResourceExtensionFunction">ResourceExtensionFunction</a> concept.
+<b>Valid Expressions 有效表达式</b><br>
+参见 <a href="#ResourceExtensionFunction">ResourceExtensionFunction</a> 概 念。
 </p>

-<a name="Label"><h4>Label</h4></a>
-
-<p>
-This concept defines the interface for a label in the <tt>r_c_shortest_paths</tt> functions. It is a design decision not to parameterize the functions on the type of label. The type <tt>template&lt;class Graph, class Resource_Container&gt struct r_c_shortest_paths_label</tt> is used to model this concept.
+<a name="Label"><h4>Label 标签</h4></a>
+
+<p>这个概念为 <tt>r_c_shortest_paths</tt> 函数中的标签定义了接口。这里有一 个设计决策,不按标签的类型对这些函数参数化。类型 <tt>template&lt;class Graph, class Resource_Container&gt; struct r_c_shortest_paths_label</tt> 即 符合该概念。
 </p>

 <p>
-<b>Valid Expressions</b><br>
-If <tt>label</tt> is an object of type <tt>r_c_shortest_paths_label</tt>, the following expressions are valid:<br>
-<table border>
-<tr>
+<b>Valid Expressions 有效表达式</b><br>如果 <tt>label</tt> 是类型为 <tt>r_c_shortest_paths_label</tt> 的一个对象,则以下表达式有效:<br>
+<table border="1">
+<tbody><tr>
 <td>
 <tt>label.num</tt>
 </td>
-<td>
-Returns an unsigned integer value specifying the number of the label. Labels are numbered consecutively in order of their creation.
+<td>返回一个无符号整数值,指定标签的数量。标签按它们的创建顺序连续编号。
 </td>
 </tr>
 <tr>
 <td>
 <tt>label.cumulated_resource_consumption</tt>
 </td>
-<td>
-Returns the object associated with <tt>label</tt> modelling the ResourceContainer concept.
+<td>返回与 <tt>label</tt> 相关联的,以 ResourceContainer 概念为模型的对象。
 </td>
 </tr>
 <tr>
 <td>
 <tt>label.p_pred_label</tt>
 </td>
-<td>
-Returns a <tt>const</tt> pointer to the predecessor label, i.e., to the label whose extension along <tt>label.pred_edge</tt> yielded the <tt>label} object</tt>. +<td>返回指向前趋标签的常量指针,即指向沿着 <tt>label.pred_edge</tt> 扩展得 到 <tt>label 对象的那个标签。</tt>
 </td>
 </tr>
 <tr>
 <td>
 <tt>label.pred_edge</tt>
 </td>
-<td>
-Returns an edge descriptor for the arc along which <tt>label.p_pred_label</tt> was extended to yield the <tt>label</tt> object. +<td>返回一个边描述符,令 <tt>label.p_pred_label</tt> 沿着该边扩展得到 <tt>label</tt> 对象。
 </td>
 </tr>
 <tr>
 <td>
 <tt>label.resident_vertex</tt>
 </td>
-<td>
-Returns a vertex descriptor for the vertex at which the <tt>label</tt> object resides.
+<td>返回 <tt>label</tt> 对象所处的顶点的顶点描述符。
 </td>
 </tr>
 <tr>
 <td>
 <tt>label.b_is_dominated</tt>
 </td>
-<td>
-Returns a boolean value indicating whether the <tt>label</tt> object is dominated by some other label residing at the vertex <tt>label.resident_vertex</tt>. Is useful only after dominance checking has been performed, i.e. only in the visitor functions <tt>on_label_dominated</tt> and <tt>on_label_not_dominated</tt> (see <a href="#ResourceConstrainedShortestPathsVisitor">below</a>). +<td>返回一个布尔值,表明该 <tt>label</tt> 对象是否被处于 <tt>label.resident_vertex</tt> 顶点的其它标签优化掉。仅当执行了优化检查后有 用,即仅在遍历器函数 <tt>on_label_dominated</tt> 和 <tt>on_label_not_dominated</tt> (见 <a href="#ResourceConstrainedShortestPathsVisitor">下文</a>)中有用。
 </td>
 </tr>
-</table>
-
-<p>
-<b>Invariants</b><br>
-Every <tt>r_c_shortest_paths_label</tt> object, except for the first label, has a valid (not null) <tt>p_pred_label</tt> pointer and a valid <tt>pred_edge</tt> member. The <tt>p_pred_label</tt> pointer of the label with <tt>num</tt> member equal to zero is a null pointer, and the <tt>pred_edge</tt> member of this label is a default-constructed edge descriptor.
+</tbody></table>
+
+</p><p>
+<b>Invariants 不变式</b><br>每一个 <tt>r_c_shortest_paths_label</tt> 对 象,除了第一个标签,都有一个有效(非空)的 <tt>p_pred_label</tt> 指针和一个有 效的 <tt>pred_edge</tt> 成员。<tt>num</tt> 成员等于零的标签的 <tt>p_pred_label</tt> 指针为空指针,而该标签的 <tt>pred_edge</tt> 成员是缺省 构造的边描述符。
 </p>

-<a name="ResourceExtensionFunction"><h4>ResourceExtensionFunction</h4></a>
+<a name="ResourceExtensionFunction"><h4>ResourceExtensionFunction 资源扩展 函数</h4></a>

 <p>
-A model of the ResourceExtensionFunction concept is used to specify how a label is to be extended along an arc.
+ResourceExtensionFunction 概念的模型用于指定一个标签如何沿着一条边扩展。
 </p>

 <p>
-<b>Valid Expressions</b><br>
-If <tt>ref</tt> models the ResourceExtensionFunction concept, and if the type <tt>Resource_Container</tt> models the ResourceContainer concept, the following expression is valid:<br>
-<table border>
-<tr>
+<b>Valid Expressions 有效表达式</b><br>如果 <tt>ref</tt> 符合 ResourceExtensionFunction 概念,且类型 <tt>Resource_Container</tt> 符合 ResourceContainer 概念,则以下表达式有效:<br>
+<table border="1">
+<tbody><tr>
 <td>
-<pre>
-bool b = ref( const Graph&amp; g,
-              Resource_Container&amp; new_cont,
-              const Resource_Container&amp; old_cont,
-              graph_traits&lt;Graph&gt;::edge_descriptor ed )
-</pre>
+<pre>bool b = ref( const Graph&amp; g,<br> Resource_Container&amp; new_cont,<br> const Resource_Container&amp; old_cont,<br> graph_traits&lt;Graph&gt;::edge_descriptor ed )<br></pre>
 </td>
 <td>
-<tt>ref</tt> must return <tt>true</tt> if and only if the extension is feasible, i.e., if <tt>new_cont</tt> fulfills all resource constraints at the target vertex of <tt>ed</tt>. +<tt>ref</tt> 必须当且仅当该扩展可行,即如果 <tt>new_cont</tt> 满足在 <tt>ed</tt> 的目标顶点处的所有资源约束时返回 <tt>true</tt>。
 </td>
 </tr>
-</table>
-Moreover, a reference to a type modelling the ResourceExtensionFunction concept can be passed as a parameter to <tt>r_c_shortest_paths</tt>, see above.<br> +</tbody></table>此外,以 ResourceExtensionFunction 概念为模的类型的引用可以 作为 <tt>r_c_shortest_paths</tt> 的参数被传递,见上。<tt></tt><br>
 </p>

-<p>
-Hence, a type modelling the ResourceExtensionFunction concept is likely to be a function or a <a href="http://www.sgi.com/tech/stl/functors.html";>function object</a>. +<p>因此,以 ResourceExtensionFunction 概念为模的类型通常是一个函数或 <a href="http://www.sgi.com/tech/stl/functors.html";>函数对象</a>。
 </p>

 <p>
-<b>Invariants</b><br>
-If <tt>ref</tt> models the ResourceExtensionFunction concept, and if the type <tt>Resource_Container</tt> models the ResourceContainer concept, after the call
-<pre>
-ref( const Graph&amp; g,
-     Resource_Container&amp; new_cont,
-     const Resource_Container&amp; old_cont,
-     graph_traits&lt;Graph&gt;::edge_descriptor )
-</pre>
-the expression <tt>old_cont &lt;= new_cont</tt> evaluates to <tt>true</tt>.<br> -This is because, as stated above, the implementation is a label-setting algorithm. Therefore, the Less-Than operator for ResourceContainer must compare one or more resource(s) whose resource consumption(s) along any arc is/are non-decreasing in order for the algorithm to work properly.
-</p>
+<b>Invariants 不变式</b><br>
+如果 <tt>ref</tt> 符合 ResourceExtensionFunction 概念,且类型 <tt>Resource_Container</tt> 符合 ResourceContainer 概念,则在调用 +</p><pre>ref( const Graph&amp; g,<br> Resource_Container&amp; new_cont,<br> const Resource_Container&amp; old_cont,<br> graph_traits&lt;Graph&gt;::edge_descriptor )<br></pre>之后,表达式 <tt>old_cont &lt;= new_cont</tt> 为 <tt>true</tt>.<br>如上所述,这是因为本实 现是一个标签-设定算法。因此,ResourceContainer 的小于操作符必须比较一个或多 个资源,这些资源沿任意边的消耗量都是非递减的,这样算法才可以正确工作。
+<p></p>

 <h4>DominanceFunction</h4>

-<p>
-A model of DominanceFunction is used to specify a dominance relation between two labels.
+<p>DominanceFunction 的模型用于指定两个标签间的优势关系。
 </p>

 <p>
-<b>Refinement of</b><br>
-<a href="http://www.sgi.com/tech/stl/BinaryPredicate.html";>BinaryPredicate</a>
+<b>Refinement of 精化自</b><br>
+<a href="http://www.sgi.com/tech/stl/BinaryPredicate.html";>二元谓词 BinaryPredicate</a>
 </p>

 <p>
-<b>Valid Expressions</b><br>
-If <tt>dominance</tt> models the DominanceFunction concept, and if the type <tt>Resource_Container</tt> models the ResourceContainer concept, the following expression is valid:
-<table border>
-<tr>
+<b>Valid Expressions 有效表达式</b><br>如果 <tt>dominance</tt> 符合 DominanceFunction 概念,且类型 <tt>Resource_Container</tt> 符合 ResourceContainer 概念,则以下表达式有效:
+<table border="1">
+<tbody><tr>
 <td>
-<pre>
-bool b = dominance(const Resource_Container&amp; rc1, const Resource_Container&amp; rc2)
-</pre>
+<pre>bool b = dominance(const Resource_Container&amp; rc1, const Resource_Container&amp; rc2)<br></pre>
 </td>
 <td>
-<tt>dominance</tt> must return <tt>true</tt> if and only if <tt>rc1</tt> dominates <tt>rc2</tt>. +<tt>dominance</tt> 必须当且仅当<tt></tt> <tt>rc1</tt> 优于 <tt>rc2</tt> 时 返回 <tt>true</tt>
 </td>
 </tr>
-</table>
-Moreover, a reference to a type modelling the DominanceFunction concept can be passed as a parameter to <tt>r_c_shortest_paths</tt>, see above.
+</tbody></table>
+此外,以&nbsp;DominanceFunction 概念为模的类型的引用可以作为 <tt>r_c_shortest_paths</tt> 的参数被传递,见上。
 </p>

 <p>
-<b>Invariants</b><br>
-A type modelling the DominanceFunction concept must return <tt>true</tt> if and only if <tt>rc1<=rc2</tt>. It must <i>not</i> return <tt>false</tt> if <tt>rc1==rc2</tt>. Then, it is guaranteed that no two labels with identical resource consumption dominate each other and are both considered as dominated by the <tt>r_c_shortest_paths</tt> functions. +<b>Invariants 不变式</b><br>一个符合 DominanceFunction 概念的类型必须当且仅 当<tt></tt> <tt>rc1&lt;=rc2</tt> 返回 <tt>true</tt>。当 <tt>rc1==rc2</tt> 时 它必须不返回 <tt>false</tt>。然后,它保证没有两个带有同一个资源消耗量的标签 相互比对方优势,也都不会被 <tt>r_c_shortest_paths</tt> 函数视为被优化掉的。
 </p>

-<a name="ResourceConstrainedShortestPathsVisitor"><h4>ResourceConstrainedShortestPathsVisitor</h4></a>
-
-<p>
-This concept defines the visitor interface for <tt>r_c_shortest_paths</tt>. A user can define a type with this interface and pass an object of this type to <tt>r_c_shortest_paths</tt> to perform user-defined actions at the event points of the algorithm. Note that the object is passed by value. +<a name="ResourceConstrainedShortestPathsVisitor"><h4>ResourceConstrainedShortestPathsVisitor 资源受限的最短路径遍历器</h4></a>
+
+<p>这个概念定义了用于 <tt>r_c_shortest_paths</tt> 的遍历器接口。用户可以定 义一个具有此接口的类型,并将该类型的一个对象传递给 <tt>r_c_shortest_paths</tt>,以实现在算法内的某些事件点执行用户自定义的动 作。注意,该对象是以值方式传递的。
 </p>

 <p>
-<b>Refinement of</b><br>
-<a href="http://www.sgi.com/tech/stl/DefaultConstructible.html";>DefaultConstructible</a>, <a href="../../utility/CopyConstructible.html">CopyConstructible</a>
+<b>Refinement of 精化自</b><br>
+<a href="http://www.sgi.com/tech/stl/DefaultConstructible.html";>可缺省构造 DefaultConstructible</a>, <a href="../../utility/CopyConstructible.html">可 复制构造CopyConstructible</a>
 </p>

 <p>
-<b>Valid Expressions</b><br>
-If <tt>vis</tt> is an object of a type modelling the ResourceConstrainedShortestPathsVisitor concept, and if <tt>g</tt> is an object of a type <tt>Graph</tt> modelling the IncidenceGraph and the PropertyGraph concepts, and if it is a directed graph, and if <tt>l</tt> is an object of a type <tt>Label</tt> modelling the Label concept, the following expressions are valid:<br>
-<table border>
-<tr>
+<b>Valid Expressions 有效表达式</b><br>如果 <tt>vis</tt> 是符合 ResourceConstrainedShortestPathsVisitor 概念的类型的对象,且 <tt>g</tt> 是符 合 关联图IncidenceGraph 和 属性图PropertyGraph 概念的类型 <tt>Graph</tt> 的 一个对象,且该图为有向图,且 <tt>l</tt> 是符合&nbsp;Label 概念的类型 <tt>Label</tt> 的一个对象,则以下表达式有效:<br>
+<table border="1">
+<tbody><tr>
 <td>
 <tt>vis.on_label_popped( const Label&amp; l, const Graph&amp; g )</tt>
 </td>
@@ -356,221 +232,144 @@
<tt>vis.on_label_not_dominated( const Label&amp; l, const Graph&amp; g )</tt>
 </td>
 </tr>
-</table>
-See the <a href="#Label">description of the Label concept</a> for the interface of a Label. See the <a href="#FunctionsDescription">algorithm description</a> for information on when these functions are called.
-<p>
-
-<a name="FunctionsDescription"><h3>Functions Description</h3></a>
-
-<p>
-The functions are an implementation of a priority-queue-based label-setting algorithm. At each iteration, the algorithm picks a label <i>l</i> from a priority queue (the set of unprocessed labels) and checks it for dominance against the current set of labels at the vertex <i>i</i> where <i>l</i> resides. If <i>l</i> is dominated by some other label residing at <i>i</i>, <i>l</i> is deleted from the set of labels residing at <i>i</i>. If <i>l</i> is undominated, it is extended along all out-edges of <i>i</i>. Each resulting new label is checked for feasibility, and if it is feasible, it is added to the set of unprocessed labels and to the set of labels residing at the respective successor vertex of <i>i</i>. If a new label is not feasible, it is discarded. The algorithm stops when there are no more unprocessed labels. It then checks whether the destination vertex could be reached (which may not be the case even for a strongly connected graph because of the resource constraints), constructs one or all Pareto-optimal (i.e., undominated) <i>s</i>-<i>t</i>-path(s) and returns. A pseudo-code of the algorithm follows. +</tbody></table>有关 Label 的接口请见 <a href="#Label">Label 概念说明</a>。 有关这些函数被调用时的信息,请见 <a href="#FunctionsDescription">算法说明 </a>。
+</p><p>
+
+<a name="FunctionsDescription"><h3>Functions Description 函数说明</h3></a>
+
+</p><p>这些函数是基于优先队列的标签-设定算法的一个实现。在每一次迭代中,该 算法从优先队列(未处理标签的集合)中取出一个标签 +<i>l</i>,检查它与 <i>l</i> 所驻的顶点 <i>i</i> 的当前标签集的比较优势。如 果 <i>l</i> 被其它常驻在 <i>i</i> 的标签所优化,则 <i>l</i> 被从常驻于 <i>i</i> 中的标签集中删除。如果 <i>l</i> 未被优化掉,则它将被沿着 <i>i</i> 的所有出边扩展。由此所得到的每个新标签,都要检查其可行性,如果是可行的,则被 加入至未处理标签集合中,同时也加入至顶点 <i>i</i> 的对应各后续标点的常驻标签 集中。<i></i>如果某个新标签不是可行的,则被忽略。当没有未处理标签时,该算法 结束。然后,它检查目标顶点是否已可到达(由于资源受限,所以即使是强连接图,也 可能不能到达目标顶点),构造一个或所有较优的(即未被优化掉的) <i>s</i>-<i>t</i>-路径并返回。该算法的伪代码如下。
 </p>

-<pre>
-r_c_shortest_paths( g,
-                    vertex_index_map,
-                    edge_index_map,
-                    s,
-                    t,
-                    pareto_optimal_solutions,
-                    pareto_optimal_resource_containers,
-                    rc,
-                    ref,
-                    dominance,
-                    la,
-                    vis )
-{
-  Label first_label, cur_label, new_label
-  Set of Labels unprocessed_labels, labels_cur_vertex
-  initialize first_label with rc
-  INSERT(unprocessed_labels, first_label)
-  <b>while</b>(unprocessed_labels != &Oslash;)
- cur_label := EXTRACTMIN(unprocessed_labels) &#9665; vis.on_label_popped(cur_label)
-    <b>if</b>(cur_label is not dominated)
-      vertex i = ResidentVertex(cur_label)
-      perform pairwise dominance check over labels resident at i
-      mark all dominated labels as dominated
-      DELETE all labels which are dominated AND processed
- <b>if</b>(cur_label is not dominated) &#9665; vis.on_label_not_dominated(cur_label)
-      mark cur_label as processed
-      <b>for each</b> arc (i, j) in the forward star of i
-        new_label := ref(cur_label)
- <b>if</b>(new_label is not feasible) &#9665; vis.on_label_not_feasible(new_label)
-          DELETE(new_label)
- <b>else</b> &#9665; vis.on_label_feasible(new_label)
-          INSERT(unprocessed_labels, new_label)
-          INSERT(set of labels resident at j,new_label)
- <b>else</b> &#9665; vis.on_label_dominated(cur_label)
-      DELETE(cur_label)
-  <b>if</b>(t could be reached from s)
-    <b>for each</b> label resident at t
-      INSERT(pareto_optimal_resource_containers, label.resource_container)
-      recursively construct pareto_optimal_path
-      INSERT(pareto_optimal_solutions, pareto_optimal_path)
-      <b>if</b>(only one Pareto-optimal solution is sought)
-        BREAK
-}
-</pre>
-
-<h3>Where Defined</h3>
+<pre>r_c_shortest_paths( g,<br> vertex_index_map,<br> edge_index_map,<br> s,<br> t,<br> pareto_optimal_solutions,<br> pareto_optimal_resource_containers,<br> rc,<br> ref,<br> dominance,<br> la,<br> vis )<br>{<br> Label first_label, cur_label, new_label<br> Set of Labels unprocessed_labels, labels_cur_vertex<br> initialize first_label with rc<br> INSERT(unprocessed_labels, first_label)<br> <b>while</b>(unprocessed_labels != Ø)<br> cur_label := EXTRACTMIN(unprocessed_labels) ◁ vis.on_label_popped(cur_label)<br> <b>if</b>(cur_label is not dominated)<br> vertex i = ResidentVertex(cur_label)<br> perform pairwise dominance check over labels resident at i<br> mark all dominated labels as dominated<br> DELETE all labels which are dominated AND processed<br> <b>if</b>(cur_label is not dominated) ◁ vis.on_label_not_dominated(cur_label)<br> mark cur_label as processed<br> <b>for each</b> arc (i, j) in the forward star of i<br> new_label := ref(cur_label)<br> <b>if</b>(new_label is not feasible) ◁ vis.on_label_not_feasible(new_label)<br> DELETE(new_label)<br> <b>else</b> ◁ vis.on_label_feasible(new_label)<br> INSERT(unprocessed_labels, new_label)<br> INSERT(set of labels resident at j,new_label)<br> <b>else</b> ◁ vis.on_label_dominated(cur_label)<br> DELETE(cur_label)<br> <b>if</b>(t could be reached from s)<br> <b>for each</b> label resident at t<br> INSERT(pareto_optimal_resource_containers, label.resource_container)<br> recursively construct pareto_optimal_path<br> INSERT(pareto_optimal_solutions, pareto_optimal_path)<br> <b>if</b>(only one Pareto-optimal solution is sought)<br> BREAK<br>}<br></pre>
+
+<h3>Where Defined 定义于</h3>

<a href="../../../boost/graph/r_c_shortest_paths.hpp"><tt>boost/graph/r_c_shortest_paths.hpp</tt></a>

-<h3>Parameters</h3>
+<h3>Parameters 参数</h3>

 IN: <tt>const Graph&amp; g</tt>
-<blockquote>
-The graph object on which the algorithm is applied. The type <tt>Graph</tt> must be directed and must be a model of <a href="./IncidenceGraph.html">Incidence Graph</a> and <a href="./PropertyGraph.html">PropertyGraph</a>. +<blockquote>应用该算法的图对象。类型 <tt>Graph</tt> 必须是有向的,且必须符 合 <a href="./IncidenceGraph.html">关联图Incidence Graph</a> 和 <a href="./PropertyGraph.html">属性图PropertyGraph</a>。
 </blockquote>
 IN: <tt>const VertexIndexMap&amp; vertex_index_map</tt>
-<blockquote>
-A <a href="../../property_map/ReadablePropertyMap.html">ReadablePropertyMap</a> mapping vertex descriptors to integers in [0, <tt>num_vertices(g)</tt>). +<blockquote>一个 <a href="../../property_map/ReadablePropertyMap.html">可读 属性映射</a>,将顶点描述符映射至 [0, <tt>num_vertices(g)</tt>) 间的整数。
 </blockquote>
 IN: <tt>const EdgeIndexMap&amp; edge_index_map</tt>
-<blockquote>
-A <a href="../../property_map/ReadablePropertyMap.html">ReadablePropertyMap</a> mapping edge descriptors to integers in [0, <tt>num_edges(g)</tt>). +<blockquote>一个 <a href="../../property_map/ReadablePropertyMap.html">可读 属性映射</a>,将边描述符映射至 [0, <tt>num_edges(g)</tt>) 间的整数。
 </blockquote>
 IN: <tt>typename graph_traits&lt;Graph&gt;::vertex_descriptor s</tt>
-<blockquote>
-A vertex descriptor describing the start vertex of the path.
+<blockquote>表示该路径开始顶点的顶点描述符。
 </blockquote>
 IN: <tt>typename graph_traits&lt;Graph&gt;::vertex_descriptor t</tt>
-<blockquote>
-A vertex descriptor describing the end vertex of the path.
+<blockquote>表示该路径结束顶点的顶点描述符。
 </blockquote>
OUT: <tt>std::vector&lt;std::vector&lt;typename graph_traits&lt;Graph&gt;::edge_descriptor&gt; &gt;&amp;
 pareto_optimal_solutions</tt>
-<blockquote>
-A container for storing the Pareto-optimal (undominated) solutions (<i>s</i>-<i>t</i>-paths) in the overloads where all Pareto-optimal solutions are returned. The paths are returned as sequences of edge descriptors in reverse order (from <tt>t</tt> to <tt>s</tt>). +<blockquote>在要返回所有近似最优解的重载函数中,用于保存近似最优的(未被优化 掉的)解(<i>s</i>-<i>t</i>-路径)的容器。该路径以相反顺序(从 <tt>t</tt> 到 <tt>s</tt>)的边描述符序列返回。
 </blockquote>
OUT: <tt>std::vector&lt;Resource_Container&gt;&amp; pareto_optimal_resource_containers</tt>
-<blockquote>
-A container for storing the Pareto-optimal resource containers in the overloads where all Pareto-optimal solutions are returned. +<blockquote>在要返回所有近似最优解的重载函数中,用于保存近似最优的资源的容 器。
 </blockquote>
OUT: <tt>std::vector&lt;typename graph_traits&lt;Graph&gt;::edge_descriptor&gt;&amp;
 pareto_optimal_solution</tt>
-<blockquote>
-A container for storing the first Pareto-optimal (undominated) solution (<i>s</i>-<i>t</i>-path) in the overloads where only one Pareto-optimal solution is returned. The path is returned as a sequence of edge descriptors in reverse order (from <tt>t</tt> to <tt>s</tt>). +<blockquote>在只返回一个近似最优解的重载函数中,用于保存第一个近似最优的(未 被优化掉的)解(<i>s</i>-<i>t</i>-路径)的容器。该路径以相反顺序(从 <tt>t</tt> 到 <tt>s</tt>)的边描述符序列返回。
 </blockquote>
 OUT: <tt>Resource_Container&amp; pareto_optimal_resource_container</tt>
-<blockquote>
-A <tt>Resource_Container</tt> object for storing the Pareto-optimal resource container corresponding to the first Pareto-optimal path in the overloads where only one Pareto-optimal solution is returned. +<blockquote>在只返回一个近似最优解的重载函数中,用于保存对应于第一个近似最 优解的资源的容器。
 </blockquote>
 IN: <tt>const Resource_Container&amp; rc</tt>
-<blockquote>
-An object specifying the initial resource consumptions at vertex <tt>s</tt>. The type <tt>Resource_Container</tt> must be a model of the ResourceContainer concept. +<blockquote>给定在顶点 <tt>s</tt> 处的初始资源消耗量的对象。类型 <tt>Resource_Container</tt> 必须符合 ResourceContainer 概念。
 </blockquote>
 IN: <tt>Resource_Extension_Function&amp; ref</tt>
-<blockquote>
-A <a href="http://www.sgi.com/tech/stl/functors.html";>function object</a> or function pointer or function specifying how a label is to be extended along an arc. The type <tt>Resource_Extension_Function</tt> must be a model of the ResourceExtensionFunction concept. +<blockquote>一个 <a href="http://www.sgi.com/tech/stl/functors.html";>函数对 象</a> 或函数指针或函数,指定某个标签如何沿着边被扩展。类型 <tt>Resource_Extension_Function</tt> 必须符合 ResourceExtensionFunction 概 念。
 </blockquote>
 IN: <tt>Dominance_Function&amp; dominance</tt>
-<blockquote>
-A <a href="http://www.sgi.com/tech/stl/functors.html";>function object</a> or function pointer or function specifying a dominance relation between two labels. The type <tt>Dominance_Function</tt> must be a model of the DominanceFunction concept. +<blockquote>一个 <a href="http://www.sgi.com/tech/stl/functors.html";>函数对 象</a> 或函数指针或函数,指定两个标签间的优势关系。类型 <tt>Dominance_Function</tt> 必须符合 DominanceFunction 概念。
 </blockquote>
 IN: <tt>Label_Allocator la</tt>
-<blockquote>
-An object of type <tt>Label_Allocator</tt> specifying a strategy for the memory management of the labels. It must offer the same interface as <tt>std::allocator<lt;r_c_shortest_paths_label&lt;Graph, Resource_Container&gt; &gt;</tt>. There is a default type <tt>default_r_c_shortest_paths_allocator</tt> for this parameter using the STL standard allocator. If the third or the fourth overload of the function is used, an object of this type is used as <tt>Label_Allocator</tt> parameter. If the first or the second overload is used, one must specify both a <tt>Label_Allocator</tt> and a <tt>Visitor</tt> parameter. If one wants to develop a user-defined type only for <tt>Visitor</tt>, one can use <tt>default_r_c_shortest_paths_allocator</tt> as <tt>Label_Allocator</tt> parameter. If one wants to use a specialized allocator, one can specify an arbitrary type as template parameter for the value type to the allocator; it is rebound to the correct type. +<blockquote>一个类型为 <tt>Label_Allocator</tt> 的对象,指定标签的内存管理 策略。它必须提供和 <tt>std::allocator<lt ;r_c_shortest_paths_label&lt;graph="" resource_container&gt="" &gt=""></lt></tt> 一样的接口。这个参数有一个缺省类 型 <tt>default_r_c_shortest_paths_allocator</tt>,它使用STL标准分配器。如果 使用的是这个函数的第三个或第四个重载,则该类型的一个对象被用作 <tt>Label_Allocator</tt> 参数。如果使用的是这个函数的第一个或第二个重载,则 你必须给定一个 <tt>Label_Allocator</tt> 和一个 <tt>Visitor</tt> 参数。如果你 仅想为 <tt>Visitor</tt> 开发一个用户自定义类型,那么你可以使用 <tt>default_r_c_shortest_paths_allocator</tt> 作为 <tt>Label_Allocator</tt> +参数。如果你想使用特殊的分配器,可以指定任意一个类型作为该分配器的值类型模 板参数;分配器的值类型会被绑定为正确的类型。
 </blockquote>
 IN: <tt>Visitor vis</tt>
-<blockquote>
-A visitor object specifying what operations are to be performed at the event points in the algorithm. The type <tt>Visitor</tt> must be a model of the ResourceConstrainedShortestPathsVisitor concept. There is a default type <tt>default_r_c_shortest_paths_visitor</tt> for this parameter with empty function bodies. If the third or the fourth overload of the function is used, an object of this type is used as <tt>Visitor</tt> parameter. If the first or the second overload is used, one must specify both a <tt>Label_Allocator</tt> and a <tt>Visitor</tt> parameter. If one wants to use only a specialized allocator, one can use <tt>default_r_c_shortest_paths_visitor</tt> as <tt>Visitor</tt> parameter. +<blockquote>一个遍历器对象,指定在算法内部的某些事件点执行哪些操作。类型 <tt>Visitor</tt> 必须符合 ResourceConstrainedShortestPathsVisitor 概念。该参 数有一个缺省类型 <tt>default_r_c_shortest_paths_visitor</tt>,它带有空的函数 体。如果使用的是这个函数的第三个或第四个重载,则该类型的一个对象被用作 &nbsp;<tt>Visitor</tt> 参数。如果使用的是这个函数的第一个或第二个重载,则你 必须给定一个 <tt>Label_Allocator</tt> 和一个 <tt>Visitor</tt> 参数。如果你只 想使用一个特化的分配器,那么你可以使用 <tt>default_r_c_shortest_paths_</tt><tt>visitor</tt> 作为 &nbsp;<tt>Visitor</tt>
+参数。
 </blockquote>

-<h4>Preconditions</h4>
+<h4>Preconditions 先验条件</h4>

 <ul>
 <li>
-<tt>s</tt> and <tt>t</tt> are valid vertex descriptors for <tt>g</tt>.
-<li>
-<tt>rc</tt> is within the resource windows at <tt>s</tt>, i.e., it constitutes a feasible <tt>Resource_Container</tt> object at <tt>s</tt> (see <a href="#Discussion">discussion</a>).
-</ul>
-
-<h4>Throws</h4>
-
-<p>
-The function itself does not throw any exceptions. However, depending on the template parameters, exceptions may be thrown from within the function.
+<tt>s</tt> 和 <tt>t</tt> 是 <tt>g</tt> 的有效顶点描述符。
+</li><li>
+<tt>rc</tt> 位于 <tt>s</tt> 处的资源窗口范围内,即它在 <tt>s</tt> 处组成一 个可行的 <tt>Resource_Container</tt> 对象<tt></tt>(见 <a href="#Discussion">讨论</a>)。
+</li></ul>
+
+<h4>Throws 抛出</h4>
+
+<p>该函数本身不会抛出任何异常。不过,取决于模板参数,可能有异常从函数内部抛 出。
 </p>

-<h4>Complexity</h4>
-
-<p>
-The time complexity is problem-dependent. For a non-elementary problem or for a problem on a graph without negative cycles, the complexity is polynomial in the number of vertices and edges and a term dependent on the resources and resource extension functions used. For the elementary problem on a graph with negative cycles, the complexity is exponential in the number of vertices and edges and a term dependent on the resources and resource extension functions used.
+<h4>Complexity 复杂度</h4>
+
+<p>时间复杂度与问题有关。对于一个非简单的问题或一个无负权回路的图之上的问 题,复杂度为顶点数和边数的多项式,并依赖于所用的资源和资源扩展函数。对于带有 负权回路的图之上的简单问题,复杂度为顶点数和边数的指数式,并依赖于所用的资源 和资源扩展函数。
 </p>

-<a name="Discussion"><h3>Discussion</h3></a>
-
-<p>
-The function leaves a lot of work to the user. It is almost like a small framework for SPPRCs. This, however, is a property inherent to the problem. It is entirely up to the user to make sure that he stores the &lsquo;right&rsquo; resources in his resource container object, that the resource extension function extends a label in the desired way, and that the dominance function declares the &lsquo;right&rsquo; labels as dominated and not dominated. In particular, the precondition that the initial ResourceContainer object supplied to the function must be feasible is as important as it is unpleasant. The implementation does not check this and, hence, sacrifices comfort for genericity here. It was a design decision not to make any assumptions with respect to the relationship between the type modelling ResourceContainer and the vertex properties of the graph type.
+<a name="Discussion"><h3>Discussion 讨论</h3></a>
+
+<p>这个函数留下了一大堆工作给用户。它几乎就象是SPPRC的一个小型框架。但是这 是这个问题固有的特性。它完全取决于用户,用户要确保在其资源容器 +对象中保存了'正确'的资源,资源扩展函数以正确的方式对标签进行扩展,且优势函 数可以将'正确'标签分为被优化掉的和非被优化掉的。特别是,提供给该函
+数的初始
+ResourceContainer 对象必须是可行的,这一先验条件与它是 unpleasant 的同样重 要。本实现不会检查这些,因此,这里为了泛型性而牺牲了舒适性。这是一个设计决 策,即不根据类型 ResourceContainer 和图类型的顶点属性之间的关系作任何假设。
 </p>

-<p>
-In case the underlying graph does not contain negative cycles (cycles with overall negative resource consumption for the unconstrained resource whose consumption is to be minimized, such as cost or distance), the resulting paths will always be elementary, i.e., without repetitions of vertices. In the presence of negative cycles, the algorithm is finite if there is at least one strictly increasing resource, i.e., one resource with strictly positive resource consumption on all arcs (this is a sufficient condition). Otherwise, one must provide a customized type for the ResourceContainer concept to ensure finiteness. See, for example<br> +<p>在底层图不含有负权回路(即对于那些要最小化的非受限资源,如费用或距离,而 言,具有负权资源消耗量的回路)的情况下,所得的路径总是简单的,即不 +含重复顶点。当存在负权回路时,如果至少存在一个严格递增的资源,即存在某个资 源,其在所有边上都有严格为正的消耗,则本算法是有限的(这是一个充分条 +件)。否则,你必须为 ResourceContainer 概念提供一个定制的类型,以保证有限 性。相关例子,请见<br>
 Feillet, D.; Dejax, P.; Gendreau, M.; Gueguen, C. (2004):<br>
-An Exact Algorithm for the Elementary Shortest Path Problem with Resource Constraints: Application to Some Vehicle Routing Problems<br>
-Networks, vol. 44, pp. 216&ndash;229.
+An Exact Algorithm for the Elementary Shortest Path Problem with
+Resource Constraints: Application to Some Vehicle Routing Problems<br>
+Networks, vol. 44, pp. 216–229.
 </p>

-<p>
-Experience shows that for &lsquo;small&rsquo; resource containers, it may be useful to try a specialized small object allocator, e.g., from the Boost Pool library. For larger resource containers (i.e., for a large number of resources), the default allocator is the right choice. +<p>经验表明,对于'小的'资源容器,尝试某个特化的小对象分配器,如来自 Boost Pool 库,可能是有益的。对于较大的资源容器(即用于大量资源的),缺省的分配器是 正确的选择。
 </p>

-<p>
-There is a utility function called <tt>check_path</tt> that can be used for debugging purposes, if <tt>r_c_shortest_paths</tt> returns a path as feasible and Pareto-optimal and the user is of the opinion that the path is either infeasible or not optimal:
-<pre>
-template&lt;class Graph,
-         class Resource_Container,
-         class Resource_Extension_Function&gt;
-void check_r_c_path( const Graph&amp; g,
- const std::vector&lt;typename graph_traits&lt;Graph&gt;::edge_descriptor&gt;&amp; ed_vec_path,
-                     const Resource_Container&amp; initial_resource_levels,
- bool b_result_must_be_equal_to_desired_final_resource_levels, - const Resource_Container&amp; desired_final_resource_levels,
-                     Resource_Container&amp; actual_final_resource_levels,
-                     const Resource_Extension_Function&amp; ref,
-                     bool&amp; b_is_a_path_at_all,
-                     bool&amp; b_feasible,
-                     bool&amp; b_correctly_extended,
- typename graph_traits&lt;Graph&gt;::edge_descriptor&amp;
-                     ed_last_extended_arc )
-</pre>
-</p>
-
-The boolean parameters have the following meaning:
+<p>有一个名为 <tt>check_path</tt> 的工具函数可以用于调试,如果 <tt>r_c_shortest_paths</tt> 返回一个可行且近似最优的路径,而用户怀疑它不是可 行的或不是最优的: +</p><pre>template&lt;class Graph,<br> class Resource_Container,<br> class Resource_Extension_Function&gt;<br>void check_r_c_path( const Graph&amp; g,<br> const std::vector&lt;typename graph_traits&lt;Graph&gt;::edge_descriptor&gt;&amp; ed_vec_path,<br> const Resource_Container&amp; initial_resource_levels,<br> bool b_result_must_be_equal_to_desired_final_resource_levels,<br> const Resource_Container&amp; desired_final_resource_levels,<br> Resource_Container&amp; actual_final_resource_levels,<br> const Resource_Extension_Function&amp; ref,<br> bool&amp; b_is_a_path_at_all,<br> bool&amp; b_feasible,<br> bool&amp; b_correctly_extended,<br> typename graph_traits&lt;Graph&gt;::edge_descriptor&amp;<br> ed_last_extended_arc )<br></pre>
+<p></p>其中的布尔参数具有以下意义:
 <ul>
 <li>
-If <tt>b_result_must_be_equal_to_desired_final_resource_levels==true</tt>, computed accumulated final resource levels must be equal to <tt>desired_final_resource_levels</tt>.
-<li>
-If <tt>b_result_must_be_equal_to_desired_final_resource_levels==false</tt>, computed accumulated final resource levels must be less than or equal to <tt>desired_final_resource_levels</tt>.
-<li>
-<tt>b_is_a_path_at_all==true</tt> if and only if <tt>ed_vec_path</tt> specifies a walk in a graph-theoretical sense, i.e., a sequence of arcs where the target of an arc is the source of the next arc, or a reverse walk, where the source of one arc is the target of the next arc. Note that in the world of resource-constrained shortest paths, a path need not be elementary: Repetitions of vertices or arcs are allowed. When the graph does not have any cycles of negative cost (traversal cost, travel time etc.), the paths returned by <tt>r_c_shortest_paths</tt> will be elementary. Otherwise, one must use appropriate resource containers and resource extension and dominance functions (see the abovementioned references).
-<li>
-<tt>b_feasible==true</tt> if and only if <tt>b_is_a_path_at_all==true</tt> and all resource windows at all vertices along the path are maintained.
-<li>
-When <tt>b_result_must_be_equal_to_desired_final_resource_levels==true</tt> (<tt>false</tt>), <tt>b_correctly_extended==true</tt> if and only if <tt>b_feasible==true</tt> and the computed resource levels at the end of the path are equal to (less than or equal to) the desired final resource levels as specified in <tt>desired_final_resource_levels</tt>.
-</ul>
+如果 <tt>b_result_must_be_equal_to_desired_final_resource_levels==true</tt>,则被 计算的累积最终资源级别必须等于 <tt>desired_final_resource_levels</tt>. +</li><li>如果 <tt>b_result_must_be_equal_to_desired_final_resource_levels==false</tt>,则 被计算的累积最终资源级别必须小于等于 <tt>desired_final_resource_levels</tt>.
+</li><li>
+<tt>b_is_a_path_at_all==true</tt> 当且仅当 <tt>ed_vec_path</tt>
+指定了在图论意义上的一次步行,即一系列的边,其中每条边的目标为下一条边的 源,或是一次反向步行,其中每条边的源为下一条边的目标。注意,在资源受限最 +短路径的世界中,路径不必是简单的:顶点或边的重复是允许的。当图中没有任一回 路具有负的成本(旅行成本、旅行时间等),则 <tt>r_c_shortest_paths</tt> 所返回 的路径将是简单的。否则,你必须使用适当的资源容器、资源扩展函数和优势函数(参 见前文所述)。
+</li><li>
+<tt>b_feasible==true</tt> 当且仅当 <tt>b_is_a_path_at_all==true</tt> 且沿着 该路径的所有顶点的所有资源窗口得以维持。 +</li><li>当 <tt>b_result_must_be_equal_to_desired_final_resource_levels==true</tt> (或 <tt>false</tt>)时,<tt>b_correctly_extended==true</tt> 当且仅当 <tt>b_feasible==true</tt> +且位于路径末端的被计算资源级别等于(或小于等于)由 <tt>desired_final_resource_levels</tt> 所给定的最终资源级别期望值。
+</li></ul>

 <p>
-<tt>ed_last_extended_arc</tt> stores the edge descriptor of the last extended arc. If <tt>ed_vec_path</tt> is a path of positive length and <tt>b_feasible==false</tt>, <tt>ed_last_extended_arc</tt> is the edge descriptor of the arc at whose target vertex the first violation of a resource window occured. +<tt>ed_last_extended_arc</tt> 保存了最后一条被扩展边的边描述符。如果 <tt>ed_vec_path</tt> 是长度为正值的路径,且 <tt>b_feasible==false</tt>,则 <tt>ed_last_extended_arc</tt> 是一个边描述符,该边的目标顶点是第一个违反资源 窗口的顶点。
 </p>

-<h3>Examples</h3>
-
-<p>
-The file <a href="../example/r_c_shortest_paths_example.cpp">
-<rr>example/r_c_shortest_paths_example.cpp</tt></a> provides examples for how SPPRCs can be solved with the <tt>r_c_shortest_paths</tt> functions. There is an example for an SPP without resource constraints and an example for a shortest path problem with time windows.<br> -It is obvious that one would not use the algorithm for SPPs without resource constraints, because there are faster algorithms for this problem, but one would expect a code for the SPP with resource constraints to be able to handle such a case.
+<h3>Examples 示例</h3>
+
+<p>文件 <a href="../example/r_c_shortest_paths_example.cpp">
+<rr>example/r_c_shortest_paths_example.cpp</rr></a> 提供了多个例子,示范如 何用 <tt>r_c_shortest_paths</tt> +函数解答SPPRC。其中还有一个示例是关于不带资源受限的SPP的,有一个示例则是关 于带时间窗口的最短路径问题。<br>很显然,你不会用这个算法来解不带资源受限的 SPP,因为有更快的算法,但是,你可能希望带资源受限的SPP的代码可以处理这种情 况。
 </p>

 <br>
 <hr>
 <table>
-<tr valign=top>
-<td
-nowrap>Copyright &copy 2006</td>
+<tbody><tr valign="top">
+<td nowrap="nowrap">Copyright © 2006</td>
 <td>
 Michael Drexl (michaeldrexl at web dot de)
-</td></tr></table>
-
-</body>
-</html>
+</td></tr></tbody></table>
+
+</body></html>
=======================================
--- /trunk/libs/graph/doc/undirected_dfs.html   Mon Jun  1 21:27:33 2009
+++ /trunk/libs/graph/doc/undirected_dfs.html   Sun Aug  2 22:26:22 2009
@@ -1,336 +1,202 @@
-<HTML>
-<!--
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><!--
   -- Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2002
   --
   -- Distributed under the Boost Software License, Version 1.0.
   -- (See accompanying file LICENSE_1_0.txt or copy at
   -- http://www.boost.org/LICENSE_1_0.txt)
   -->
-<Head>
-<Title>Boost Graph Library: Depth-First Search</Title>
-<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
-        ALINK="#ff0000">
-<IMG SRC="../../../boost.png"
-     ALT="C++ Boost" width="277" height="86">
-
-<BR Clear>
-
-<H1><A NAME="sec:depth-first-search"></A>
-<img src="figs/python.gif" alt="(Python)"/>
-<TT>undirected_dfs</TT>
-</H1>
-
-<P>
-<PRE>
-<i>// named parameter version</i>
+<title>Boost Graph Library: Depth-First Search</title></head>
+<body alink="#ff0000" bgcolor="#ffffff" link="#0000ee" text="#000000" vlink="#551a8b">
+<img src="../../../boost.png" alt="C++ Boost" height="86" width="277">
+
+<br clear="">
+
+<h1><a name="sec:depth-first-search"></a>
+<img src="figs/python.gif" alt="(Python)">
+<tt>undirected_dfs</tt>
+</h1>
+
+<p>
+</p><pre><i>// named parameter version</i>
 template &lt;typename Graph, typename P, typename T, typename R&gt;
void undirected_dfs(Graph&amp; G, const bgl_named_params&lt;P, T, R&gt;&amp; params);

 <i>// non-named parameter version</i>
-template &lt;typename Graph, typename <a href="DFSVisitor.html">DFSVisitor</a>, typename VertexColorMap, typename EdgeColorMap&gt; -void undirected_dfs(const Graph&amp; g, DFSVisitor vis, VertexColorMap vertex_color, EdgeColorMap edge_color)
-
-template &lt;typename Graph, typename <a href="DFSVisitor.html">DFSVisitor</a>, typename VertexColorMap, typename EdgeColorMap&gt;
-void undirected_dfs(const Graph&amp; g, DFSVisitor vis,
-                    VertexColorMap vertex_color, EdgeColorMap edge_color,
- typename graph_traits&lt;Graph&gt;::vertex_descriptor start)
-
-</PRE>
-
-<p>
-The <tt>undirected_dfs()</tt> function performs a depth-first
-traversal of the vertices in an undirected graph.  When possible, a
-depth-first traversal chooses a vertex adjacent to the current vertex
-to visit next. If all adjacent vertices have already been discovered,
-or there are no adjacent vertices, then the algorithm backtracks to
-the last vertex that had undiscovered neighbors. Once all reachable
-vertices have been visited, the algorithm selects from any remaining
-undiscovered vertices and continues the traversal. The algorithm
-finishes when all vertices have been visited. Depth-first search is
-useful for categorizing edges in a graph, and for imposing an ordering
-on the vertices. Section <a
-href="./graph_theory_review.html#sec:dfs-algorithm">Depth-First
-Search</a> describes the various properties of DFS and walks through
-an example.
+template &lt;typename Graph, typename <a href="DFSVisitor.html">DFSVisitor</a>, typename VertexColorMap, typename EdgeColorMap&gt;<br>void undirected_dfs(const Graph&amp; g, DFSVisitor vis, VertexColorMap vertex_color, EdgeColorMap edge_color)<br><br>template &lt;typename Graph, typename <a href="DFSVisitor.html">DFSVisitor</a>, typename VertexColorMap, typename EdgeColorMap&gt;<br>void undirected_dfs(const Graph&amp; g, DFSVisitor vis,<br> VertexColorMap vertex_color, EdgeColorMap edge_color,<br> typename graph_traits&lt;Graph&gt;::vertex_descriptor start)<br><br></pre>
+
+<p>函数 <tt>undirected_dfs()</tt> 对一个无向图执行深度优先遍历。在可能的时 候,深度优先遍历选择邻接于当前顶点的一个顶点来作为下一个顶点访问。如果所有邻 接顶点均已被发现,或者没有 +邻接顶点,则该算法回溯至带有未被发现的邻接顶点的最后一个顶点。一旦所有可到 达顶点均被访问,该算法就选择剩下的任一个未发现顶点来继续遍历。当所有顶 +点都被访问,该算法结束。深度优先搜索可用于对图中的边进行分类,并对顶点施加 一个顺序。<a href="graph_theory_review.html#sec:dfs-algorithm">深度优先搜索 </a> 一节描述了DFS的各种特性并举了一个例子。
 </p>

-<p>
-Similar to BFS, color markers are used to keep track of which vertices
-have been discovered. White marks vertices that have yet to be
-discovered, gray marks a vertex that is discovered but still has
-vertices adjacent to it that are undiscovered. A black vertex is
-discovered vertex that is not adjacent to any white vertices.
-</p>
-
-<p>
-Edges are also colored during the search to disambiguate tree and back
-edges.
-</p>
-
-<p>
-The <tt>undirected_dfs()</tt> function invokes user-defined actions at
-certain event-points within the algorithm. This provides a mechanism
-for adapting the generic DFS algorithm to the many situations in which
-it can be used.  In the pseudo-code below, the event points for DFS
-are indicated in by the triangles and labels on the right. The
-user-defined actions must be provided in the form of a visitor object,
-that is, an object whose type meets the requirements for a <a
-href="./DFSVisitor.html">DFS Visitor</a>. In the pseudo-code we show
-the algorithm computing predecessors <i>p</i>, discover time <i>d</i>
-and finish time <i>t</i>.  By default, the <tt>undirected_dfs()</tt>
-function does not compute these properties, however there are
-pre-defined visitors such as <a
-href="./predecessor_recorder.html"><tt>predecessor_recorder</tt></a>
-and <a href="./time_stamper.html"><tt>time_stamper</tt></a> that can
-be used to do this.
+<p>类似于 BFS,颜色着色器用于跟踪哪些顶点已被发现。白色表示顶点尚未被发 现,灰色表示顶点已被发现但有邻接顶点未被发现。黑色表示已被发现的顶点且没有白 色的邻接顶点。</p>在搜索过程中,边也会被着色,以区分树边与反向边。
+
+
+<p>函数&nbsp;<tt>undirected_dfs()</tt> 可以在算法内部的特定事件点调用用户自 定义的动作。这提供了一种机制,将普通的DFS算法适配至多种可以使用它的情形。在 以下伪代码中,DFS的事件点在右侧标出。用户自定义的动作必须以遍历器对象的形式 提供,即一个其类型符合 <a href="DFSVisitor.html">DFS 遍历器</a> 要求的对象。 在以下伪代码中,我们示范了这个算法,计算出前趋 <i>p</i>, 发现时间 +<i>d</i> 和结束 时间 <i>t</i>。缺省情况下,函数 <tt>undirected_dfs()</tt> 不计算这三项属性,但是我们提供了预定义的遍历器 <a href="predecessor_recorder.html"><tt>predecessor_recorder</tt></a> 和 <a href="time_stamper.html"><tt>time_stamper</tt></a>,它们可用于实现这些功能。
 </p>

 <table>
-<tr>
+<tbody><tr>
 <td valign="top">
-<pre>
-DFS(<i>G</i>)
-  <b>for</b> each vertex <i>u in V</i>
-    <i>vcolor[u] :=</i> WHITE
-    <i>p[u] := u</i>
-  <b>end for</b>
-  <b>for</b> each edge <i>e in E</i>
-    <i>ecolor[u] :=</i> WHITE
-  <b>end for</b>
+<pre>DFS(<i>G</i>)<br> <b>for</b> each vertex <i>u in V</i> <br> <i>vcolor[u] :=</i> WHITE<br> <i>p[u] := u</i> <br> <b>end for</b> + <b>for</b> each edge <i>e in E</i> <br> <i>ecolor[u] :=</i> WHITE<br> <b>end for</b>
   <i>time := 0</i>
   <b>if</b> there is a starting vertex <i>s</i>
-    <b>call</b> DFS-VISIT(<i>G</i>, <i>s</i>)
-  <b>for</b> each vertex <i>u in V</i>
-    <b>if</b> <i>vcolor[u] =</i> WHITE
-      <b>call</b> DFS-VISIT(<i>G</i>, <i>u</i>)
-  <b>end for</b>
+ <b>call</b> DFS-VISIT(<i>G</i>, <i>s</i>)<br> <b>for</b> each vertex <i>u in V</i> <br> <b>if</b> <i>vcolor[u] =</i> WHITE<br> <b>call</b> DFS-VISIT(<i>G</i>, <i>u</i>)<br> <b>end for</b>
   <b>return</b> (<i>p</i>,<i>d_time</i>,<i>f_time</i>) <br>
-DFS-VISIT(<i>G</i>, <i>u</i>)
-  <i>vcolor[u] :=</i> GRAY
-  <i>d_time[u] := time := time + 1</i>
-  <b>for</b> each <i>e in Out[u]</i>
-    <b>var</b> <i>ec := ecolor[e]</i>
-    <i>ecolor[e] :=</i> BLACK
-    <b>if</b> (<i>vcolor[v] =</i> WHITE)
-      <i>p[v] := u</i>
-      <b>call</b> DFS-VISIT(<i>G</i>, <i>v</i>)
-    <b>else if</b> (<i>vcolor[v] =</i> GRAY and <i>ec =</i> WHITE)
-      <i>...</i>
+DFS-VISIT(<i>G</i>, <i>u</i>) <br> <i>vcolor[u] :=</i> GRAY<br> <i>d_time[u] := time := time + 1</i> <br> <b>for</b> each <i>e in Out[u]</i> <br> <b>var</b> <i>ec := ecolor[e]</i> + <i>ecolor[e] :=</i> BLACK<br> <b>if</b> (<i>vcolor[v] =</i> WHITE)<br> <i>p[v] := u</i> <br> <b>call</b> DFS-VISIT(<i>G</i>, <i>v</i>)<br> <b>else if</b> (<i>vcolor[v] =</i> GRAY and <i>ec =</i> WHITE)<br> <i>...</i>
   <b>end for</b>
-  <i>vcolor[u] :=</i> BLACK
-  <i>f_time[u] := time := time + 1</i>
-<pre>
-</td>
+ <i>vcolor[u] :=</i> BLACK<br> <i>f_time[u] := time := time + 1</i> <br><pre></pre></pre></td>
 <td valign="top">
-<pre>
+<pre>-<br>-<br>初始化顶点 <i>u</i>
 -
 -
-initialize vertex <i>u</i>
 -
 -
 -
 -
 -
+开始顶点 <i>s</i>
 -
 -
-start vertex <i>s</i>
+开始顶点 <i>u</i>
 -
 -
-start vertex <i>u</i>
 -
 -
+发现顶点 <i>u</i>
 -
+检查边 <i>(u,v)</i>
 -
-discover vertex <i>u</i>
 -
-examine edge <i>(u,v)</i>
--
--
-<i>(u,v)</i> is a tree edge
--
--
-<i>(u,v)</i> is a back edge
--
--
-finish vertex <i>u</i>
+<i>(u,v)</i> 为树边<br>-<br>-<br><i>(u,v)</i> 为反向边<br>-<br>-<br>结束顶 点 <i>u</i>
 -
 </pre>
 </td>
 </tr>
-</table>
+</tbody></table>



-<H3>Where Defined</H3>
-
-<P>
-<a href="../../../boost/graph/undirected_dfs.hpp"><TT>boost/graph/undirected_dfs.hpp</TT></a>
-
-<h3>Parameters</h3>
+<h3>Where Defined 定义于</h3>
+
+<p>
+<a href="../../../boost/graph/undirected_dfs.hpp"><tt>boost/graph/undirected_dfs.hpp</tt></a>
+
+</p><h3>Parameters 参数</h3>

 IN: <tt>Graph&amp; g</tt>
-<blockquote>
-  An undirected graph. The graph type must
-  be a model of <a href="./IncidenceGraph.html">Incidence Graph</a>,
-  <a href="./VertexListGraph.html">Vertex List Graph</a>,
-  and <a href="./EdgeListGraph.html">Edge List Graph</a>.<br>
-
-  <b>Python</b>: The parameter is named <tt>graph</tt>.
+<blockquote>一个有向图。图的类型必须符合 <a href="./IncidenceGraph.html">关 联图Incidence Graph</a>, <a href="./VertexListGraph.html">点列表图Vertex List Graph</a>, 和 <a href="./EdgeListGraph.html">边列表图Edge List Graph</a>。<br>
+
+
+
+  <b>Python</b>:&nbsp;该参数被命名为 <tt>graph</tt>.&nbsp;
 </blockquote>


-<h3>Named Parameters</h3>
+<h3>Named Parameters 命名参数</h3>

 IN: <tt>visitor(DFSVisitor vis)</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>. <br> <b>Default:</b>
-  <tt>dfs_visitor&lt;null_visitor&gt;</tt><br>
-
-  <b>Python</b>: The parameter should be an object that derives from
-  the <a href="DFSVisitor.html#python"><tt>DFSVisitor</tt></a> type of
-  the graph.
+<blockquote>一个遍历器对象,在算法内部某些由 <a href="DFSVisitor.html">DFS
+ 遍历器</a> 概念所指定的事件点被调用。这个遍历器对象是以值方式传递的<a href="undirected_dfs.html#1">[1]</a>。<br> <b>缺省 值:</b><tt>dfs_visitor&lt;null_visitor&gt;</tt><br>
+
+ <b>Python</b>: 该参数应为派生自该图的&nbsp;<a href="DFSVisitor.html#python"><tt>DFSVisitor</tt></a> 类型的一个对象。
 </blockquote>

 UTIL/OUT: <tt>vertex_color_map(VertexColorMap vertex_color)</tt>
-<blockquote>
-  This is used by the algorithm to keep track of its progress through
-  the graph. The type <tt>VertexColorMap</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 must model
-  <a href="./ColorValue.html">ColorValue</a>.<br>
-  <b>Default:</b> an <a
-  href="../../property_map/iterator_property_map.html">
-  </tt>iterator_property_map</tt></a> created from a
-  <tt>std::vector</tt> of <tt>default_color_type</tt> of size
-  <tt>num_vertices(g)</tt> and using the <tt>i_map</tt> for the index
-  map.<br>
-
-  <b>Python</b>: The color map must be a <tt>vertex_color_map</tt> for
-  the graph.
+<blockquote>被该算法用于跟踪对图的处理过程。类型 <tt>ColorMap</tt> 必须符 合 <a href="../../property_map/ReadWritePropertyMap.html">读/写属性映射</a> 并且其键类型必须为图的顶点描述符类型,值类型必须符合
+  <a href="ColorValue.html">颜色值ColorValue</a>。<br>
+
+ <b>缺省值:</b>一个 <a href="../../property_map/iterator_property_map.html">
+  iterator_property_map</a>,创建自一个大小为
+  <tt>num_vertices(g)</tt>,值为 <tt>default_color_type</tt> 的
+  <tt>std::vector</tt>,且使用 <tt>i_map</tt> 作为索引映射。<br>
+
+
+
+ <b>Python</b>: 这个颜色映射必须是图的一个 <tt>vertex_color_map</tt>。 &nbsp;
 </blockquote>

 UTIL: <tt>edge_color_map(EdgeColorMap edge_color)</tt>
-<blockquote>
-  This is used by the algorithm to keep track of which edges
-  have been visited. The type <tt>EdgeColorMap</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 edge
-  descriptor type and the value type of the color map must model
-  <a href="./ColorValue.html">ColorValue</a>.<br>
-  <b>Default:</b> none.<br>
-
-  <b>Python</b>: The color map must be an <tt>edge_color_map</tt> for
-  the graph.
+<blockquote>被算法用于跟踪哪些边已被访问。类型 <tt>EdgeColorMap</tt> 必须符 合 <a href="../../property_map/ReadWritePropertyMap.html">读/写属性映射</a> 且其键类型必须是图的边描述符,颜色映射的值类型必须符合
+  <a href="./ColorValue.html">颜色值ColorValue</a>。<br>
+  <b>缺省值:</b>无。<br>
+
+  <b>Python</b>:&nbsp;这个颜色映射必须是图的一个 <tt>edge_color_map</tt>。
 </blockquote>

 IN: <tt>root_vertex(typename
 graph_traits&lt;VertexListGraph&gt;::vertex_descriptor start)</tt>
-<blockquote>
-  This specifies the vertex that the depth-first search should
-  originate from. The type is the type of a vertex descriptor for the
-  given graph.<br>
-  <b>Default:</b> <tt>*vertices(g).first</tt>
+<blockquote>指定深度优先搜索开始的顶点。类型为给定图的顶点描述符类型。<br>
+  <b>缺省值:</b><tt>*vertices(g).first</tt>
 </blockquote>

 IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt>
-<blockquote>
-  This maps each vertex to an integer in the range <tt>[0,
-  num_vertices(g))</tt>. This parameter is only necessary when the
-  default color property map is used. The type <tt>VertexIndexMap</tt>
-  must be a model of <a
-  href="../../property_map/ReadablePropertyMap.html">Readable Property
-  Map</a>. The value type of the map must be an integer type. The
-  vertex descriptor type of the graph needs to be usable as the key
-  type of the map.<br>
-
-  <b>Default:</b> <tt>get(vertex_index, g)</tt>
-    Note: if you use this default, make sure your graph has
-    an internal <tt>vertex_index</tt> property. For example,
-    <tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does
-    not have an internal <tt>vertex_index</tt> property.
-   <br>
-
-  <b>Python</b>: Unsupported parameter.
+<blockquote>它将每个顶点映射至位于区间 <tt>[0,
+ num_vertices(g))</tt> 中的一个整数。仅当缺省颜色属性映射被使用时,需要这 个参数。类型 <tt>VertexIndexMap</tt> + 必须符合 <a href="../../property_map/ReadablePropertyMap.html">可读属性映 射</a>。该映射的值类型必须是一个整数类型。图的顶点描述符类型需要可以被用作该 映射的键类型。<br>
+
+
+
+  <b>缺省值:</b><tt>get(vertex_index, g)</tt>.
+ 注意:如果你使用该缺省值,请确认你的图具有一个内部的 <tt>vertex_index</tt> 属性。例如,带 <tt>VertexList=listS</tt> 的
+    <tt>adjacenty_list</tt> 并不具有内部的 <tt>vertex_index</tt> 属性。<br>
+
+
+
+  <b>Python</b>: 不支持该参数。&nbsp;&nbsp;
 </blockquote>

-<P>
-
-<H3><A NAME="SECTION001340300000000000000">
-Complexity</A>
-</H3>
-
-<P>
-The time complexity is <i>O(E + V)</i>.
-
-<P>
-
-<h3>Visitor Event Points</h3>
+<p>
+
+</p><h3><a name="SECTION001340300000000000000">
+Complexity 复杂度</a>
+</h3>
+
+<p>时间复杂度为 <i>O(E + V)</i>。
+
+</p><p>
+
+</p><h3>Visitor Event Points 遍历器事件点</h3>

 <ul>

-<li><b><tt>vis.initialize_vertex(s, g)</tt></b> is invoked on every
-  vertex of the graph before the start of the graph search.
-
-<li><b><tt>vis.start_vertex(s, g)</tt></b> is invoked on the source
-  vertex once before the start of the search.
-
-<li><b><tt>vis.discover_vertex(u, g)</tt></b> is invoked when a vertex
-  is encountered for the first time.
-
-<li><b><tt>vis.examine_edge(e, g)</tt></b> is invoked on every out-edge
-  of each vertex after it is discovered.
-
-<li><b><tt>vis.tree_edge(e, g)</tt></b> is invoked on each edge as it
-  becomes a member of the edges that form the search tree. If you
-  wish to record predecessors, do so at this event point.
-
-<li><b><tt>vis.back_edge(e, g)</tt></b> is invoked on the back edges in
-  the graph.
-
-<li><b><tt>vis.finish_vertex(u, g)</tt></b> is invoked on a vertex after
-  all of its out edges have been added to the search tree and all of
-  the adjacent vertices have been discovered (but before their
-  out-edges have been examined).
-
-</ul>
-
-
-<H3>Example</H3>
-
-<P>
-An example is in <a href="../example/undirected_dfs.cpp">
-<TT>examples/undirected_dfs.cpp</TT></a>.
-
-<h3>See Also</h3>
+<li><b><tt>vis.initialize_vertex(</tt></b><b><tt>s</tt></b><b><tt>, g)</tt></b> 在图搜索开始前对每个顶点调用。
+
+</li><li><b><tt>vis.start_vertex(s, g)</tt></b> 在开始搜索前对源顶点调用一 次。
+
+</li><li><b><tt>vis.discover_vertex(u, g)</tt></b> 在某个顶点第一次被遇到时 调用。</li><li><b><tt>vis.examine_edge(e, g)</tt></b> 在某顶点被发现后,对其 每条出边调用。
+
+</li><li><b><tt>vis.tree_edge(e, g)</tt></b> 当某边成为形成搜索树的一条树边 时被调用。如果你想记录前趋,在此事件点上进行。
+
+</li><li><b><tt>vis.back_edge(e, g)</tt></b> 对图中的反向边调用。 </li><li><b><tt>vis.finish_vertex(u, g)</tt></b> 当某个顶点的所有出边都被增 加至搜索树中且所有邻接顶点都被发现后(但在它们的出边被检查之前),对该顶点调 用。</li></ul>
+
+
+<h3>Example 示例</h3>
+
+<p>例子位于 <a href="../example/undirected_dfs.cpp">
+<tt>examples/undirected_dfs.cpp</tt></a>.
+
+</p><h3>See Also 参见</h3>

 <a href="./depth_first_search.html"><tt>depth_first_search</tt></a>

-<h3>Notes</h3>
+<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="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</A>,
-Indiana University (<A
-HREF="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</A>)<br>
-<A HREF="http://www.boost.org/people/liequan_lee.htm";>Lie-Quan Lee</A>, Indiana University (<A HREF="mailto:llee@xxxxxxxxxxxxxx";>llee@xxxxxxxxxxxxxx</A>)<br>
-<A HREF="http://www.osl.iu.edu/~lums";>Andrew Lumsdaine</A>,
-Indiana University (<A
-HREF="mailto:lums@xxxxxxxxxx";>lums@xxxxxxxxxx</A>)
-</TD></TR></TABLE>
-
-</BODY>
-</HTML>
+ 由于 visitor 参数是以值方式传递的,所以如果你的遍历器含有状态,则在算法中 对该状态的所有修改都是针对该遍历器对象的一个拷贝,而不对传入的遍历器对象进行 的。因此你应该让该遍历器以指针或引用的方式保存该状态。<br>
+</p><hr>
+<table>
+<tbody><tr valign="top">
+<td nowrap="nowrap">Copyright © 2000-2001</td><td>
+<a href="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</a>,
+Indiana University (<a href="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</a>)<br> +<a href="http://www.boost.org/people/liequan_lee.htm";>Lie-Quan Lee</a>, Indiana University (<a href="mailto:llee@xxxxxxxxxxxxxx";>llee@xxxxxxxxxxxxxx</a>)<br>
+<a href="http://www.osl.iu.edu/%7Elums";>Andrew Lumsdaine</a>,
+Indiana University (<a href="mailto:lums@xxxxxxxxxx";>lums@xxxxxxxxxx</a>)
+</td></tr></tbody></table>
+
+</body></html>

Other related posts:

  • » [boost-doc-zh] r284 committed - graph 库文档第21.1-20.3.1节 - codesite-noreply