Revision: 282 Author: alai04 Date: Thu Jul 23 20:28:01 2009 Log: graph 库文档第18-20章 http://code.google.com/p/boost-doc-zh/source/detail?r=282 Modified: /trunk/libs/graph/doc/adjacency_iterator.html /trunk/libs/graph/doc/adjacency_list_traits.html /trunk/libs/graph/doc/edge_list.html /trunk/libs/graph/doc/filtered_graph.html /trunk/libs/graph/doc/graph_traits.html /trunk/libs/graph/doc/inv_adjacency_iterator.html /trunk/libs/graph/doc/property_map.html /trunk/libs/graph/doc/reverse_graph.html /trunk/libs/graph/doc/stanford_graph.html /trunk/libs/graph/doc/subgraph.html ======================================= --- /trunk/libs/graph/doc/adjacency_iterator.html Mon Mar 30 07:58:04 2009 +++ /trunk/libs/graph/doc/adjacency_iterator.html Thu Jul 23 20:28:01 2009 @@ -1,136 +1,88 @@ -<html> -<!-- +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><!-- -- 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> -<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> -<title>Adjacency Iterator Adaptor Documentation</title> -</head> - -<body bgcolor="#FFFFFF" text="#000000"> - -<img src="../../../boost.png" alt="boost.png (6897 bytes)" -align="center" width="277" height="86"> - -<h1>Adjacency Iterator Adaptor</h1> - -Defined in header +<title>Adjacency Iterator Adaptor Documentation</title></head> + + +<body bgcolor="#ffffff" text="#000000"> ++<img src="../../../boost.png" alt="boost.png (6897 bytes)" align="middle" height="86" width="277">
+ +<h1>Adjacency Iterator Adaptor 邻接迭代器适配器</h1>定义于头文件<a href="../../../boost/graph/adjacency_iterator.hpp">boost/graph/adjacency_iterator.hpp</a>
-<p> -The adjacency iterator adaptor transforms an -<tt>out_edge_iterator</tt> into an adjacency iterator. That is, it -takes an iterator that traverses over edges, and creates an iterator -that traverses over the <b><i>target</i></b> vertices of those edges. -With this adaptor it is trivial to take a graph type that models <a -href="IncidenceGraph.html">Incidence Graph</a> and add the -capabilities required of <a href="AdjacencyGraph.html">Adjacency -Graph</a>. +<p>邻接迭代器适配器将一个+<tt>out_edge_iterator</tt> 转换为邻接迭代器。即,它接受一个对边进行遍历的迭 代器,并创建一个对这些边的<b><i>目标</i></b>顶点进行遍历的迭代器。有了这个适 配器,就可以非常简单地接受一个 <a href="IncidenceGraph.html">关联图 Incidence Graph</a> 的图类型并加入 <a href="AdjacencyGraph.html">邻接图 Adjacency
+Graph</a> 所要求的能力。 -<h2>Synopsis</h2> - -<pre> -namespace boost { - template <class Graph, class VertexDescriptor, class OutEdgeIter> - class adjacency_iterator_generator { - public:- typedef <a href="../../iterator/doc/iterator_adaptor.html">iterator_adaptor</a><...> type;
- }; -} -</pre> +</p><h2>Synopsis 概要</h2> ++<pre>namespace boost {<br> template <class Graph, class VertexDescriptor, class OutEdgeIter><br> class adjacency_iterator_generator {<br> public:<br> typedef <a href="../../iterator/doc/iterator_adaptor.html">iterator_adaptor</a><...> type;<br> };<br>}<br></pre>
<hr> -<h3>Example</h3> - -<p> -The following is an example of how to use the -<tt>adjacency_iterator_generator</tt> class. - -<p> -<PRE> -#include <boost/graph/adjacency_iterator.hpp> - -class my_graph { - // ... - typedef ... out_edge_iterator; - typedef ... vertex_descriptor;- typedef boost::adjacency_iterator_generator<my_graph, vertex_descriptor, out_edge_iterator>::type adjacency_iterator;
- // ... -}; - -</PRE> - -<h3>Template Parameters</h3> - -<Table border> -<TR> -<TH>Parameter</TH><TH>Description</TH> -</TR> - -<TR> -<TD><tt>Graph</tt></TD> -<TD>The graph type, which must model <a -href="./IncidenceGraph.html">Incidence Graph</a>.</TD> -</TR> - -<TR> -<TD><tt>VertexDescriptor</tt></TD> -<TD>This must be the same type as -<tt>graph_traits<Graph>::vertex_descriptor</tt>. The reason why -this is a template parameter is that the primary use of -<tt>adjacency_iterator_generator</tt> is <b><i>inside</i></b> the -definition of the graph class, and in that context we can not use -<tt>graph_traits</tt> on the not yet fully defined graph class.<br> -<b>Default:</b> <tt>graph_traits<Graph>::vertex_descriptor</tt></TD> -</TR> - -<TR> -<TD><tt>OutEdgeIter</tt></TD> -<TD>This must be the same type as -<tt>graph_traits<Graph>::out_edge_iterator</tt>.<br> -<b>Default:</b> <tt>graph_traits<Graph>::out_edge_iterator -</TD> -</TR> - -</Table> - -<h3>Model of</h3> - -The adjacency iterator adaptor (the type -<tt>adjacency_iterator_generator<...>::type</tt>) is a model of <a-href="../../utility/MultiPassInputIterator.html">Multi-Pass Input Iterator</a>
-</a>. - - -<h3>Members</h3> - -The adjacency iterator type implements the member functions and -operators required of the <a-href="http://www.sgi.com/tech/stl/RandomAccessIterator.html";>Random Access Iterator</a> -concept, except that the <tt>reference</tt> type is the same as the <tt>value_type</tt> -so <tt>operator*()</tt> returns by-value. In addition it has the following constructor:
- -<pre>-adjacency_iterator_generator::type(const OutEdgeIter& it, const Graph* g)
-</pre> +<h3>Example 示例</h3> + +<p>以下是一个如何使用 +<tt>adjacency_iterator_generator</tt> 类的例子。 ++</p><pre>#include <boost/graph/adjacency_iterator.hpp><br><br>class my_graph {<br> // ...<br> typedef ... out_edge_iterator;<br> typedef ... vertex_descriptor;<br> typedef boost::adjacency_iterator_generator<my_graph, vertex_descriptor, out_edge_iterator>::type adjacency_iterator;<br> // ...<br>};<br><br></pre>
+ +<h3>Template Parameters 模板参数</h3> + +<table border="1"> +<tbody><tr> +<th>Parameter</th><th>Description</th> +</tr> + +<tr> +<td><tt>Graph</tt></td>+<td>图类型,必须符合 <a href="./IncidenceGraph.html">关联图Incidence Graph</a>。</td>
+</tr> + +<tr> +<td><tt>VertexDescriptor</tt></td> +<td>必须是与+<tt>graph_traits<Graph>::vertex_descriptor</tt> 相同的类型。将此作为 一个模板参数的原因是,<tt>adjacency_iterator_generator</tt> 的主要用途是在图 类定义的<b><i>内部</i></b>,而在这样的上下文中我们不能对尚未完整定义的图类使 用
+<tt>graph_traits</tt>。<br> +<b>缺省值:</b><tt>graph_traits<Graph>::vertex_descriptor</tt></td> +</tr> + +<tr> +<td><tt>OutEdgeIter</tt></td> +<td>必须是与 +<tt>graph_traits<Graph>::out_edge_iterator</tt> 相同的类型。<br> +<b>缺省值:</b><tt>graph_traits<Graph>::out_edge_iterator +</tt></td> +</tr> + +</tbody></table> + +<h3>Model of 以...为模型</h3>邻接迭代器适配器(类型+<tt>adjacency_iterator_generator<...>::type</tt>)是 <a href="../../utility/MultiPassInputIterator.html">多遍输入迭代器</a>。
+ ++<h3>Members 成员</h3>邻接迭代器类型实现了 <a href="http://www.sgi.com/tech/stl/RandomAccessIterator.html";>随机访问迭代器 </a>
+概念所要求的成员函数和操作符,除了其引用类型与 <tt>value_type</tt> +相同,因此 <tt>operator*()</tt> 是以值方式返回的。此外它还有以下构造函数: ++<pre>adjacency_iterator_generator::type(const OutEdgeIter& it, const Graph* g)<br></pre>
<hr><p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan -->19 Aug 2001<!--webbot bot="Timestamp" endspan i-checksum="14767" --></p>
<p>(c) Copyright Jeremy Siek 2000. Permission to copy, use,modify, sell and distribute this document is granted provided this copyright
-notice appears in all copies. This document is provided "as is" +notice appears in all copies. This document is provided "as is"without express or implied warranty, and with no claim as to its suitability for
any purpose.</p> -</body> - -</html> +</body></html> =======================================--- /trunk/libs/graph/doc/adjacency_list_traits.html Mon Jun 1 21:27:33 2009 +++ /trunk/libs/graph/doc/adjacency_list_traits.html Thu Jul 23 20:28:01 2009
@@ -1,97 +1,70 @@ -<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: Graph Traits</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=""></A> -<pre> -adjacency_list_traits<EdgeList, VertexList, Directed> -</pre> -</H1> - -This class provides an alternate method for accessing some of the -associated types of the <tt>adjacency_list</tt> class. The main reason -for this class is that sometimes one would like to create graph -properties whose values are vertex or edge descriptors. If you try to -use <tt>graph_traits</tt> for this you will run into a problem with -mutually recursive types. To get around this problem, the -<tt>adjacency_list_traits</tt> class is provided, which gives the user -access to the vertex and edge descriptor types without requiring the -user to provide the property types for the graph. - -<pre> - template <class EdgeList, class VertexList, class Directed> - struct adjacency_list_traits { - typedef ... vertex_descriptor; - typedef ... edge_descriptor; - typedef ... directed_category; - typedef ... edge_parallel_category; - }; -</pre> - -<h3>Where Defined</h3> +<title>Boost Graph Library: Graph Traits</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=""></a> +<pre>adjacency_list_traits<EdgeList, VertexList, Directed><br></pre>+</h1>这个类提供了另一种方法来访问 <tt>adjacency_list</tt> 类的某些关联类 型。主要的原因是,有时你可能想要创建一些其值为顶点描述符或边描述符的属性。如 果你对这些属性使用 <tt>graph_traits</tt>,就会陷入递归类型的问题。为了解决这 一问题,我们提供了 +<tt>adjacency_list_traits</tt> 类,它可以让用户访问顶点描述符和边描述符类 型,而无需用户提供该图的属性类型。
++<pre> template <class EdgeList, class VertexList, class Directed><br> struct adjacency_list_traits {<br> typedef ... vertex_descriptor;<br> typedef ... edge_descriptor;<br> typedef ... directed_category;<br> typedef ... edge_parallel_category;<br> };<br></pre>
+ +<h3>Where Defined 定义于</h3><a href="../../../boost/graph/adjacency_list.hpp"><tt>boost/graph/adjacency_list.hpp</tt></a>
-<H3>Template Parameters</H3> - -<P> -<TABLE border> -<TR> +<h3>Template Parameters 模板参数</h3> + +<p> +<table border="1"> +<tbody><tr> <th>Parameter</th><th>Description</th><th>Default</th> </tr> -<TR><TD><TT>EdgeList</TT></TD> -<TD> -The selector type for the edge container implementation. -</TD> +<tr><td><tt>EdgeList</tt></td> +<td>边容器实现的选择符类型。 +</td> <td><tt>vecS</tt></td> -</TR> - -<TR><TD><TT>VertexList</TT></TD> -<TD> -The selector type for the vertex container implementation. -</TD> +</tr> + +<tr><td><tt>VertexList</tt></td> +<td>顶点容器实现的选择符类型。 +</td> <td><tt>vecS</tt></td> -</TR> - -<TR><TD><TT>Directed</TT></TD> -<TD> -The selector type whether the graph is directed or undirected. -</TD> +</tr> + +<tr><td><tt>Directed</tt></td> +<td>有向图或无向图的选择符类型。 +</td> <td><tt>directedS</tt></td> -</TR> - -</table> - -<h3>Model of</h3> - -<a-href="http://www.sgi.com/tech/stl/DefaultConstructible.html";>DefaultConstructible</a> and
-<a href="http://www.sgi.com/tech/stl/Assignable.html";>Assignable</a> - -<h3>Type Requirements</h3> - -Under construction. - -<H2>Members</H2> +</tr> + +</tbody></table> + +</p><h3>Model of 以...为模型</h3> ++<a href="http://www.sgi.com/tech/stl/DefaultConstructible.html";>可缺省构造 DefaultConstructible</a> 且
+<a href="http://www.sgi.com/tech/stl/Assignable.html";>可赋值Assignable</a> + +<h3>Type Requirements 类型要求</h3>构建中。 + +<h2>Members 成员</h2> <p> -<table border> -<tr> +<table border="1"> +<tbody><tr> <th>Member</th><th>Description</th> </tr> @@ -99,8 +72,7 @@ <td><tt> vertex_descriptor </tt></td> -<td> -The type for the objects used to identify vertices in the graph. +<td>用于标识图中顶点的对象的类型。 </td> </tr> @@ -108,8 +80,7 @@ <td><tt> edge_descriptor </tt></td> -<td> -The type for the objects used to identify edges in the graph. +<td>用于标识图中边的对象的类型。 </td> </tr> @@ -117,9 +88,7 @@ <td><tt> directed_category </tt></td> -<td> -This says whether the graph is undirected (<tt>undirected_tag</tt>) -or directed (<tt>directed_tag</tt>).+<td>表明该图是无向图(<tt>undirected_tag</tt>)或是有向图 (<tt>directed_tag</tt>)。
</td> </tr> @@ -127,32 +96,26 @@ <td><tt> edge_parallel_category </tt></td> -<td> -This says whether the graph allows parallel edges to be inserted -(<tt>allow_parallel_edge_tag</tt>) or if it automatically removes -parallel edges (<tt>disallow_parallel_edge_tag</tt>).+<td>表明该图是允许插入平行边(<tt>allow_parallel_edge_tag</tt>)或是会自动删 除平行边(<tt>disallow_parallel_edge_tag</tt>)。
</td> </tr> -</table> - -<h3>See Also</h3> +</tbody></table> + +</p><h3>See Also 参见</h3> <a href="./adjacency_list.html"><tt>adjacency_list</tt></a> <br> -<HR> -<TABLE> -<TR valign=top> -<TD 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/~lums";>Andrew Lumsdaine</A>, -Indiana University (<A -HREF="mailto:lums@xxxxxxxxxx";>lums@xxxxxxxxxx</A>) -</TD></TR></TABLE> - -</BODY> -</HTML> +<hr> +<table> +<tbody><tr valign="top"> +<td nowrap="nowrap">Copyright (c) 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/edge_list.html Mon Jun 1 21:27:33 2009 +++ /trunk/libs/graph/doc/edge_list.html Thu Jul 23 20:28:01 2009 @@ -1,178 +1,110 @@ -<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: Edge List Class</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:edge-list-class"></A> -<PRE> -edge_list<EdgeIterator, ValueType, DiffType> -</PRE> -</H1> - -<P> -The <TT>edge_list</TT> class is an adaptor that turns a pair of edge -iterators into a class that models <TT>EdgeListGraph</TT>. The -<TT>value_type</TT> of the edge iterator must be a <TT>std::pair</TT> (or -at least have <TT>first</TT> and <TT>second</TT> members). The -<TT>first_type</TT> and <TT>second_type</TT> of the pair must be the -same and they will be used for the graph's <TT>vertex_descriptor</TT>. -The <TT>ValueType</TT> and <TT>DiffType</TT> template parameters are only -needed if your compiler does not support partial -specialization. Otherwise they default to the correct types. - -<P> - -<H3>Example</H3> - -<P> -Applying the Bellman-Ford shortest paths algorithm to an -<TT>edge_list</TT>. - -<P> -<PRE> - enum { u, v, x, y, z, N }; - char name[] = { 'u', 'v', 'x', 'y', 'z' }; - - typedef std::pair<int,int> E; - E edges[] = { E(u,y), E(u,x), E(u,v), - E(v,u), - E(x,y), E(x,v), - E(y,v), E(y,z), - E(z,u), E(z,x) }; - - int weight[] = { -4, 8, 5, - -2, - 9, -3, - 7, 2, - 6, 7 }; - - typedef boost::edge_list<E*> Graph; - Graph g(edges, edges + sizeof(edges) / sizeof(E)); -- std::vector<int> distance(N, std::numeric_limits<short>::max());
- std::vector<int> parent(N,-1); - - distance[z] = 0; - parent[z] = z; - bool r = boost::bellman_ford_shortest_paths(g, int(N), weight, - distance.begin(), - parent.begin()); - if (r) - for (int i = 0; i < N; ++i) - std::cout << name[i] << ": " << distance[i] - << " " << name[parent[i]] << std::endl; - else - std::cout << "negative cycle" << std::endl; -</PRE> -The output is the distance from the root and the parent -of each vertex in the shortest paths tree. -<PRE> - u: 2 v - v: 4 x - x: 7 z - y: -2 u - z: 0 z -</PRE> - -<P> +<title>Boost Graph Library: Edge List Class</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:edge-list-class"></a> +<pre>edge_list<EdgeIterator, ValueType, DiffType><br></pre> +</h1> ++<p><tt>edge_list</tt> 类是一个适配器,将一对边迭代器转换为一个符合 <tt>EdgeListGraph</tt> 的类。这个边迭代器的 +<tt>value_type</tt> 必须是一个 <tt>std::pair</tt> (或者至少具有 <tt>first</tt> 和 <tt>second</tt> 成员)。这个值对的 +<tt>first_type</tt> 和 <tt>second_type</tt> 必须相同,它们将被用作该图的 <tt>vertex_descriptor</tt>。<tt>ValueType</tt> 和 <tt>DiffType</tt> 模板参数 仅当你的编译器不支持偏特化时才需要。否则它们缺省为正确的类型。
+ +</p><h3>Example 示例</h3> + +<p>将 Bellman-Ford 最短路径算法应用于一个 +<tt>edge_list</tt>. ++</p><pre> enum { u, v, x, y, z, N };<br> char name[] = { 'u', 'v', 'x', 'y', 'z' };<br><br> typedef std::pair<int,int> E;<br> E edges[] = { E(u,y), E(u,x), E(u,v),<br> E(v,u),<br> E(x,y), E(x,v),<br> E(y,v), E(y,z),<br> E(z,u), E(z,x) };<br> <br> int weight[] = { -4, 8, 5,<br> -2,<br> 9, -3,<br> 7, 2,<br> 6, 7 };<br><br> typedef boost::edge_list<E*> Graph;<br> Graph g(edges, edges + sizeof(edges) / sizeof(E));<br> <br> std::vector<int> distance(N, std::numeric_limits<short>::max());<br> std::vector<int> parent(N,-1);<br> <br> distance[z] = 0;<br> parent[z] = z;<br> bool r = boost::bellman_ford_shortest_paths(g, int(N), weight,<br> distance.begin(),<br> parent.begin());<br> if (r) <br> for (int i = 0; i < N; ++i)<br> std::cout << name[i] << ": " << distance[i]<br> << " " << name[parent[i]] << std::endl;<br> else<br> std::cout << "negative cycle" << std::endl;<br></pre>输出为从根至各顶点的距离,以及各顶点在最短路径 树中的父节点。
+<pre> u: 2 v<br> v: 4 x<br> x: 7 z<br> y: -2 u<br> z: 0 z<br></pre> + <p> -<H3>Where Defined</H3> --<a href="../../../boost/graph/edge_list.hpp"><TT>boost/graph/edge_list.hpp</TT></a>
- -<P> -<H3>Template Parameters</H3> - -<P> -<TABLE border> -<TR> +</p><h3>Where Defined 定义于</h3> ++<a href="../../../boost/graph/edge_list.hpp"><tt>boost/graph/edge_list.hpp</tt></a>
+ +<p> +</p><h3>Template Parameters 模板参数</h3> + +<p> +<table border="1"> +<tbody><tr> <th>Parameter</th><th>Description</th> </tr> -<TR><TD><TT>EdgeIterator</TT></TD> <TD>Must be model of <a -href="http://www.sgi.com/tech/stl/InputIterator.html";>InputIterator</a> -who's <TT>value_type</TT> must be a pair of vertex descriptors.</TD> -</TR> - -<TR><TD><TT>ValueType</TT></TD> -<TD>The <TT>value_type</TT> of the <TT>EdgeIterator</TT>.<br> -Default: <TT>std::iterator_traits<EdgeIterator>::value_type</TT></TD> -</TR> - -<TR><TD><TT>DiffType</TT></TD> -<TD>The <TT>difference_type</TT> of the <TT>EdgeIterator</TT>.<br>-Default: <TT>std::iterator_traits<EdgeIterator>::difference_type</TT></TD>
-</TR> - -</TABLE> -<P> - -<H3>Model of</H3> - -<a href="./EdgeListGraph.html">EdgeListGraph</a> - -<P>+<tr><td><tt>EdgeIterator</tt></td> <td>必须是 <a href="http://www.sgi.com/tech/stl/InputIterator.html";>输入迭代器</a>,且 <tt>value_type</tt> 必须是一对顶点描述符。</td>
+</tr> + +<tr><td><tt>ValueType</tt></td>+<td><tt>EdgeIterator</tt> 的 <tt>value_type</tt>。<br>缺省 值:<tt>std::iterator_traits<EdgeIterator>::value_type</tt></td>
+</tr> + +<tr><td><tt>DiffType</tt></td>+<td><tt>EdgeIterator</tt> 的<tt>difference_type。</tt><br>缺省 值:<tt>std::iterator_traits<EdgeIterator>::difference_type</tt></td>
+</tr> + +</tbody></table> +</p><p> + +</p><h3>Model of 以...为模型</h3> + +<a href="./EdgeListGraph.html">边列表图EdgeListGraph</a> + +<p> -<H3>Associated Types</H3> +</p><h3>Associated Types 关联类型</h3> <hr> <tt>boost::graph_traits<edge_list>::vertex_descriptor</tt> -<br><br> -The type for the vertex descriptors associated with the -<TT>edge_list</TT>. This will be the same type as -<TT>std::iterator_traits<EdgeIterator>::value_type::first_type</TT>. +<br><br>与 +<tt>edge_list</tt> 相关联的顶点描述符类型。与+<tt>std::iterator_traits<EdgeIterator>::value_type::first_type</tt> 类型相同。
<hr> <tt> boost::graph_traits<edge_list>::edge_descriptor </tt> -<br><br> -The type for the edge descriptors associated with the -<TT>edge_list</TT>. +<br><br>与 +<tt>edge_list</tt> 相关联的边描述符类型。 <hr> <tt> boost::graph_traits<edge_list>::edge_iterator </tt> -<br><br> -The type for the iterators returned by <TT>edges()</TT>. The iterator -category of the <TT>edge_iterator</TT> will be the same as that of the -<TT>EdgeIterator</TT>.+<br><br>由 <tt>edges()</tt> 返回的迭代器类型。<tt>edge_iterator</tt> 的迭代 器种类与
+<tt>EdgeIterator</tt> 相同。 <hr> -<h3>Member Functions</h3> +<h3>Member Functions 成员函数</h3> <hr> <tt> edge_list(EdgeIterator first, EdgeIterator last) </tt> -<br><br> -Creates a graph object with <TT>n</TT> vertices and with the -edges specified in the edge list given by the range <TT>[first,last)</TT>.+<br><br>创建一个有 <tt>n</tt> 个顶点的图对象,并以区间 <tt>[first,last)</tt> 所给定的边列表中的边为边。
<hr> -<H3>Non-Member Functions</H3> +<h3>Non-Member Functions 非成员函数</h3> <hr> @@ -180,8 +112,7 @@ std::pair<edge_iterator, edge_iterator><br> edges(const edge_list& g) </tt> -<br><br>-Returns an iterator-range providing access to the edge set of graph <TT>g</TT>.
+<br><br>返回一个迭代器区间,提供对图 <tt>g</tt> 的边集的访问。 <hr> @@ -189,8 +120,7 @@ vertex_descriptor<br> source(edge_descriptor e, const edge_list& g) </tt> -<br><br> -Returns the source vertex of edge <TT>e</TT>. +<br><br>返回边 <tt>e</tt> 的源顶点。 <hr> @@ -198,24 +128,20 @@ vertex_descriptor<br> target(edge_descriptor e, const edge_list& g) </tt> -<br><br> -Returns the target vertex of edge <TT>e</TT>. +<br><br>返回边 <tt>e</tt> 的目标顶点。 <hr> <br> -<HR> -<TABLE> -<TR valign=top> -<TD 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/~lums";>Andrew Lumsdaine</A>, -Indiana University (<A -HREF="mailto:lums@xxxxxxxxxx";>lums@xxxxxxxxxx</A>) -</TD></TR></TABLE> - -</BODY> -</HTML> +<hr> +<table> +<tbody><tr valign="top"> +<td nowrap="nowrap">Copyright (c) 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/filtered_graph.html Mon Jun 1 21:27:33 2009 +++ /trunk/libs/graph/doc/filtered_graph.html Thu Jul 23 20:28:01 2009 @@ -1,535 +1,309 @@ -<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: Filtered Graph</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: Filtered Graph</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:filtered-graph-class"></A> -<pre> -filtered_graph<Graph, EdgePredicate, VertexPredicate> -</pre> -</H1> +<h1><a name="sec:filtered-graph-class"></a> +<pre>filtered_graph<Graph, EdgePredicate, VertexPredicate><br></pre> +</h1> -<P> -The <tt>filtered_graph</tt> class template is an adaptor that creates -a filtered view of a graph. The predicate function objects determine -which edges and vertices of the original graph will show up in the -filtered graph. If the edge predicate returns <tt>true</tt> for an -edge then it shows up in the filtered graph, and if the predicate -returns <tt>false</tt> then the edge does not appear in the filtered -graph. Likewise for vertices. The <tt>filtered_graph</tt> class does -not create a copy of the original graph, but uses a reference to the -original graph. The lifetime of the original graph must extend past -any use of the filtered graph. The filtered graph does not change the -structure of the original graph, though vertex and edge properties of -the original graph can be changed through property maps of the -filtered graph. Vertex and edge descriptors of the filtered graph are -the same as, and interchangeable with, the vertex and edge descriptors -of the original graph. - -<P>The <a href="#num_vertices"><tt>num_vertices</tt></a> and <a -href="#num_edges"><tt>num_edges</tt></a> functions do not filter -before returning results, so they return the number of vertices or -edges in the underlying graph, unfiltered <a href="#2">[2]</a>. - -<H3>Example</H3> - -<P> -In this example we will filter a graph's edges based on edge -weight. We will keep all edges with positive edge weight. -First, we create a predicate function object. - -<PRE> -template <typename EdgeWeightMap> -struct positive_edge_weight { - positive_edge_weight() { } - positive_edge_weight(EdgeWeightMap weight) : m_weight(weight) { } - template <typename Edge> - bool operator()(const Edge& e) const { - return 0 < get(m_weight, e); - } - EdgeWeightMap m_weight; -}; -</PRE> - -Now we create a graph and print out the filtered graph. -<pre> -int main() -{ - using namespace boost; - - typedef adjacency_list<vecS, vecS, directedS, - no_property, property<edge_weight_t, int> > Graph; - typedef property_map<Graph, edge_weight_t>::type EdgeWeightMap; - - enum { A, B, C, D, E, N }; - const char* name = "ABCDE"; - Graph g(N); - add_edge(A, B, 2, g); - add_edge(A, C, 0, g); - add_edge(C, D, 1, g); - add_edge(C, E, 0, g); - add_edge(D, B, 3, g); - add_edge(E, C, 0, g); - - positive_edge_weight<EdgeWeightMap> filter(get(edge_weight, g)); - filtered_graph<Graph, positive_edge_weight<EdgeWeightMap> > - fg(g, filter); - - std::cout << "filtered edge set: "; - print_edges(fg, name); - - std::cout << "filtered out-edges:" << std::endl; - print_graph(fg, name); - - return 0; -} -</pre> -The output is: -<PRE> -filtered edge set: (A,B) (C,D) (D,B) -filtered out-edges: -A --> B -B --> -C --> D -D --> B -E --> -</PRE> - -<P> - -<H3>Template Parameters</H3> - -<P> -<TABLE border> -<TR>+<p><tt>filtered_graph</tt> 类模板是一个适配器,它创建一个图的过滤视图。其中 的断言函数对象决定原图的哪些边和顶点会在过滤视图中出现。如果边断言对于某条边 返回 <tt>true</tt>,则该边出现在过滤视图中,如果断言返回 <tt>false</tt> 则该 边不会出现在过滤视图中。对于顶点也同样如此。<tt>filtered_graph</tt> 类不会创 建原图的一份拷贝,而是使用一个引向原图的引用。原图的生存期必须比其任一过滤视 图长。过滤视图不会修改原图的结构,不过原图的顶点属性和边属性可以通过过滤视图 的属性映射来修改。过滤视图的顶点描述符及边描述符与原图的顶点描述符及边描述符 相同,且可互换。
++</p><p>函数 <a href="#num_vertices"><tt>num_vertices</tt></a> 和 <a href="#num_edges"><tt>num_edges</tt></a> 在返回结果之前不进行过滤,所以它们 返回的是底层图的顶点数和边数,未经过滤<a href="#2">[2]</a>。
+ +</p><h3>Example 示例</h3> ++<p>在以下例子中,我们将基于边的权重来过滤一个图的边。我们将保持所有边的权重 为正。首先,我们创建一个断言函数对象。
++</p><pre>template <typename EdgeWeightMap><br>struct positive_edge_weight {<br> positive_edge_weight() { }<br> positive_edge_weight(EdgeWeightMap weight) : m_weight(weight) { }<br> template <typename Edge><br> bool operator()(const Edge& e) const {<br> return 0 < get(m_weight, e);<br> }<br> EdgeWeightMap m_weight;<br>};<br></pre>现在我们创建并打印这个过滤视图。 +<pre>int main()<br>{<br> using namespace boost;<br> <br> typedef adjacency_list<vecS, vecS, directedS,<br> no_property, property<edge_weight_t, int> > Graph;<br> typedef property_map<Graph, edge_weight_t>::type EdgeWeightMap;<br><br> enum { A, B, C, D, E, N };<br> const char* name = "ABCDE";<br> Graph g(N);<br> add_edge(A, B, 2, g);<br> add_edge(A, C, 0, g);<br> add_edge(C, D, 1, g);<br> add_edge(C, E, 0, g);<br> add_edge(D, B, 3, g);<br> add_edge(E, C, 0, g);<br> <br> positive_edge_weight<EdgeWeightMap> filter(get(edge_weight, g));<br> filtered_graph<Graph, positive_edge_weight<EdgeWeightMap> ><br> fg(g, filter);<br><br> std::cout << "filtered edge set: ";<br> print_edges(fg, name);<br><br> std::cout << "filtered out-edges:" << std::endl;<br> print_graph(fg, name);<br> <br> return 0;<br>}<br></pre>输出如下: +<pre>filtered edge set: (A,B) (C,D) (D,B) <br>filtered out-edges:<br>A --> B <br>B --> <br>C --> D <br>D --> B <br>E --> <br></pre>
+ +<p> + +</p><h3>Template Parameters 模板参数</h3> + +<p> +<table border="1"> +<tbody><tr> <th>Parameter</th><th>Description</th><th>Default</th> </tr> -<TR><TD><TT>Graph</TT></TD> -<TD>The underlying graph type.</TD> -<TD> </TD> -</TR> - -<TR> -<TD><TT>EdgePredicate</TT></TD> <TD>A function object that selects -which edges from the original graph will appear in the filtered -graph. The function object must model <a -href="http://www.sgi.com/tech/stl/Predicate.html";>Predicate</a>. The -argument type for the function object must be the edge descriptor type -of the graph. Also, the predicate must be <a-href="http://www.sgi.com/tech/stl/DefaultConstructible.html";>Default Constructible</a> <a href="#1">[1]</a>.</TD>
-<TD> </TD> -</TR> - -<TR> -<TD><TT>VertexPredicate</TT></TD> -<TD>A function object that selects -which vertices from the original graph will appear in the filtered -graph. The function object must model <a -href="http://www.sgi.com/tech/stl/Predicate.html";>Predicate</a>. The -argument type for the function object must be the vertex descriptor type -of the graph. Also, the predicate must be <a-href="http://www.sgi.com/tech/stl/DefaultConstructible.html";>Default Constructible</a> <a href="#1">[1]</a>.</TD>
-<TD><TT>keep_all</TT></TD> -</TR> - -</TABLE> -<P> - -<H3>Model of</H3> - -<P> -This depends on the underlying graph type. If the underlying -<tt>Graph</tt> type models <a -href="./VertexAndEdgeListGraph.html">VertexAndEdgeListGraph</a> and <a -href="./PropertyGraph.html">PropertyGraph</a> then so does the -filtered graph. If the underlying <tt>Graph</tt> type models fewer or -smaller concepts than these, then so does the filtered graph. - -<P> - -<H3>Where Defined</H3> - -<P>-<a href="../../../boost/graph/filtered_graph.hpp"><TT>boost/graph/filtered_graph.hpp</TT></a>
- -<P> - -<H2>Associated Types</H2> +<tr><td><tt>Graph</tt></td> +<td>底层的图类型。</td> +<td> </td> +</tr> + +<tr>+<td><tt>EdgePredicate</tt></td> <td>一个函数对象,用于选择原图中的哪些边会 在过滤视图中出现。该函数对象必须是 <a href="http://www.sgi.com/tech/stl/Predicate.html";>断言Predicate</a>。函数对 象的参数类型必须是该图的边描述符类型。此外,断言必须是 <a href="http://www.sgi.com/tech/stl/DefaultConstructible.html";>可缺省构造的 </a> <a href="#1">[1]</a>。</td>
+<td> </td> +</tr> + +<tr> +<td><tt>VertexPredicate</tt></td>+<td>一个函数对象,用于选择原图中的哪些顶点会在过滤视图中出现。该函数对象必 须是 <a href="http://www.sgi.com/tech/stl/Predicate.html";>断言 Predicate</a>。函数对象的参数类型必须是该图的顶点描述符类型。此外,断言必须 是 <a href="http://www.sgi.com/tech/stl/DefaultConstructible.html";>可缺省构 造的</a> <a href="#1">[1]</a>。</td>
+<td><tt>keep_all</tt></td> +</tr> + +</tbody></table> +</p><p> + +</p><h3>Model of 以...为模型</h3> + +<p>取决于底层的图类型。如果底层的+<tt>Graph</tt> 类型是 <a href="./VertexAndEdgeListGraph.html">点边列表图 VertexAndEdgeListGraph</a> 和 <a href="./PropertyGraph.html">属性图 PropertyGraph</a>,则过滤视图也是。如果底层的 <tt>Graph</tt> 类型只满足较小 的概念,则过滤视图也是。
+ +</p><p> + +</p><h3>Where Defined 定义于</h3> + +<p>+<a href="../../../boost/graph/filtered_graph.hpp"><tt>boost/graph/filtered_graph.hpp</tt></a>
+ +</p><p> + +</p><h2>Associated Types 关联类型</h2> <hr> <tt>graph_traits<filtered_graph>::vertex_descriptor</tt> -<br><br> - -The type for the vertex descriptors associated with the -<TT>filtered_graph</TT>, which is the same type as the -<tt>vertex_descriptor</tt> for the original <tt>Graph</tt>. +<br><br>与 +<tt>filtered_graph</tt> 关联的顶点描述符类型,与原图的 +<tt>vertex_descriptor</tt> 相同。 <hr> <tt>graph_traits<filtered_graph>::edge_descriptor</tt><br> -<br><br> -The type for the edge descriptors associated with the -<TT>filtered_graph</TT>, which is the same type as the -<tt>edge_descriptor</tt> for the original <tt>Graph</tt>. +<br><br>与+<tt>filtered_graph</tt> 关联的顶点描述符类型,与原图的 <tt>edge</tt><tt>_descriptor</tt> 相同。
<hr> <tt>graph_traits<filtered_graph>::vertex_iterator</tt><br> -<br><br> -The type for the iterators returned by <TT>vertices()</TT>, -which is: -<pre>-<a href="../../iterator/doc/filter_iterator.html">filter_iterator</a><VertexPredicate, graph_traits<Graph>::vertex_iterator>
-</pre>-The iterator is a model of <a href="../../utility/MultiPassInputIterator.html">MultiPassInputIterator</a>.
+<br><br>由 <tt>vertices()</tt> 返回的迭代器类型,为:+<pre><a href="../../iterator/doc/filter_iterator.html">filter_iterator</a><VertexPredicate, graph_traits<Graph>::vertex_iterator><br></pre>该迭代为 <a href="../../utility/MultiPassInputIterator.html">多遍输入迭代器 MultiPassInputIterator</a>。
<hr> <tt>graph_traits<filtered_graph>::edge_iterator</tt> -<br><br> -The type for the iterators returned by <TT>edges()</TT>, which is: -<pre>-<a href="../../iterator/doc/filter_iterator.html">filter_iterator</a><EdgePredicate, graph_traits<Graph>::edge_iterator>
-</pre>-The iterator is a model of <a href="../../utility/MultiPassInputIterator.html">MultiPassInputIterator</a>.
+<br><br>由 <tt>edges()</tt> 返回的迭代器类型,为:+<pre><a href="../../iterator/doc/filter_iterator.html">filter_iterator</a><EdgePredicate, graph_traits<Graph>::edge_iterator><br></pre>该迭代为 <a href="../../utility/MultiPassInputIterator.html">多遍输入迭代器 MultiPassInputIterator</a>。
<hr> <tt>graph_traits<filtered_graph>::out_edge_iterator</tt> -<br><br> -The type for the iterators returned by <TT>out_edges()</TT>, which is: -<pre>-<a href="../../iterator/doc/filter_iterator.html">filter_iterator</a><EdgePredicate, graph_traits<Graph>::out_edge_iterator>
-</pre>-The iterator is a model of <a href="../../utility/MultiPassInputIterator.html">MultiPassInputIterator</a>.
+<br><br>由 <tt>out_edges()</tt> 返回的迭代器类型,为:+<pre><a href="../../iterator/doc/filter_iterator.html">filter_iterator</a><EdgePredicate, graph_traits<Graph>::out_edge_iterator><br></pre>该迭代为 <a href="../../utility/MultiPassInputIterator.html">多遍输入迭代器 MultiPassInputIterator</a>。
<hr> <tt>graph_traits<filtered_graph>::adjacency_iterator</tt> -<br><br> -The type for the iterators returned by <TT>adjacent_vertices()</TT>. - -The <tt>adjacency_iterator</tt> models the same iterator concept as -<tt>out_edge_iterator</tt>.+<br><br>由 <tt>adjacent_vertices()</tt> 返回的迭代器类型。 <tt>adjacency_iterator</tt> 符合与
+<tt>out_edge_iterator</tt> 相同的迭代器概念。 <hr> <tt>graph_traits<filtered_graph>::directed_category</tt><br> -<br><br> -Provides information about whether the graph is directed -(<TT>directed_tag</TT>) or undirected (<TT>undirected_tag</TT>).+<br><br>提供关于该图是有向图(<tt>directed_tag</tt>)或是无向图 (<tt>undirected_tag</tt>)的信息。
<hr> <tt>graph_traits<filtered_graph>::edge_parallel_category</tt><br> -<br><br> -This describes whether the graph class allows the insertion of -parallel edges (edges with the same source and target). The two tags -are <TT>allow_parallel_edge_tag</TT> and -<TT>disallow_parallel_edge_tag</TT>.+<br><br>说明该图类是否允许插入平行边(具有相同源和目标的边)。可能的两个标签 是 <tt>allow_parallel_edge_tag</tt> 和 + <tt>disallow_parallel_edge_tag</tt>。<tt>setS</tt> 和 <tt>hash_setS</tt> 变体不允许平行边,而其它则允许平行边。
<hr> <tt>graph_traits<filtered_graph>::vertices_size_type</tt> -<br><br> -The type used for dealing with the number of vertices in the graph. +<br><br>用于处理图中顶点数量的类型。 + + <hr> <tt>graph_traits<filtered_graph>::edge_size_type</tt> -<br><br> -The type used for dealing with the number of edges in the graph. +<br><br>用于处理图中边数量的类型。 + + <hr> <tt>graph_traits<filtered_graph>::degree_size_type</tt> -<br><br> -The type used for dealing with the number of edges incident to a vertex -in the graph. +<br><br>用于处理单个顶点的出边数量的类型。 + + <hr> <tt>property_map<filtered_graph, Property>::type</tt><br> -and<br> +和<br> <tt>property_map<filtered_graph, Property>::const_type</tt> -<br><br> -The property map type for vertex or edge properties in the graph. -The same property maps from the adapted graph are available -in the filtered graph.+<br><br>图中顶点属性或边属性所用的映射类型。在原图中的属性映射同样在过滤视 图中可用。
<hr> -<H2>Member Functions</H2> +<h2>Member Functions 成员函数</h2> <hr> -<pre>-filtered_graph(Graph& g, EdgePredicate ep, VertexPredicate vp)
-</pre> -Create a filtered graph based on the graph <i>g</i> and the -edge filter <i>ep</i> and vertex filter <i>vp</i>.+<pre>filtered_graph(Graph& g, EdgePredicate ep, VertexPredicate vp)<br></pre>基于图 <i>g</i> 和边过滤器 <i>ep</i> 及顶 点过滤器 <i>vp</i> 创建一个过滤视图。
<hr> -<pre> -filtered_graph(Graph& g, EdgePredicate ep) -</pre> -Create a filtered graph based on the graph <i>g</i> and the -edge filter <i>ep</i>. All vertices from the original graph -are retained.+<pre>filtered_graph(Graph& g, EdgePredicate ep)<br></pre>基于 图 <i>g</i> 和边过滤器 <i>ep</i> 创建一个过滤视图。原图的所有顶点被保留。
<hr> filtered_graph(const filtered_graph& x) -</pre> -This creates a filtered graph for the same underlying graph -as <i>x</i>. Anotherwords, this is a shallow copy. ++<br><br>创建一个与底层图 <i>x</i> 一样的过滤视图。换句话说,就是一个浅拷 贝。
<hr> -<pre> -filtered_graph& operator=(const filtered_graph& x) -</pre> -This creates a filtered graph for the same underlying graph -as <i>x</i>. Anotherwords, this is a shallow copy.+<pre>filtered_graph& operator=(const filtered_graph& x)<br></pre>创建一个与底层图 <i>x</i> 一样的过滤视图。换句话说,就是一个浅拷贝。
<hr> -<P> - -<H2>Non-Member Functions</H2> - -<h4>Structure Access</h4> +<p> + +</p><h2>Non-Member Functions 非成员函数</h2> + +<h4>Structure Access 结构访问</h4> <hr> -<pre> -std::pair<vertex_iterator, vertex_iterator> -vertices(const filtered_graph& g) -</pre> -Returns an iterator-range providing access to the vertex set of graph -<tt>g</tt>.+<pre>std::pair<vertex_iterator, vertex_iterator><br>vertices(const filtered_graph& g)<br></pre>返回一个迭代器区间,提供对图 <tt>g</tt> 的顶点集的访问。
+ + <hr> -<pre> -std::pair<edge_iterator, edge_iterator> -edges(const filtered_graph& g) -</pre> -Returns an iterator-range providing access to the edge set of graph -<tt>g</tt>.+<pre>std::pair<edge_iterator, edge_iterator><br>edges(const filtered_graph& g)<br></pre>返回一个迭代器区间,提供对图 <tt>g</tt> 的边集的访问。
+ + <hr> -<pre> -std::pair<adjacency_iterator, adjacency_iterator>-adjacent_vertices(vertex_descriptor u, const filtered_graph& g)
-</pre> -Returns an iterator-range providing access to the vertices adjacent to -vertex <tt>u</tt> in graph <tt>g</tt>.+<pre>std::pair<adjacency_iterator, adjacency_iterator><br>adjacent_vertices(vertex_descriptor u, const filtered_graph& g)<br></pre>返 回一个迭代器区间,提供对图 <tt>g</tt> 中顶点 <tt>u</tt> 的邻接顶点的访问。
<hr> -<pre> -std::pair<out_edge_iterator, out_edge_iterator> -out_edges(vertex_descriptor u, const filtered_graph& g) -</pre> -Returns an iterator-range providing access to the out-edges of vertex -<tt>u</tt> in graph <tt>g</tt>. If the graph is undirected, this -iterator-range provides access to all edges incident on vertex -<tt>u</tt>. For both directed and undirected graphs, for an out-edge -<tt>e</tt>, <tt>source(e, g) == u</tt> and <tt>target(e, g) == v</tt> -where <tt>v</tt> is a vertex adjacent to <tt>u</tt>.+<pre>std::pair<out_edge_iterator, out_edge_iterator><br>out_edges(vertex_descriptor u, const filtered_graph& g)<br></pre>返 回一个迭代器区间,提供对图 <tt>g</tt> 的顶点 <tt>u</tt> 的出边的访问。如果是无向图,则该迭代 器区间提供对顶点
+<tt>u</tt> 的所有关联边的访问。对于有向图及无向图,其某条出边+<tt>e</tt>,有 <tt>source(e, g) == u</tt> 且 <tt>target(e, g) == v</tt>,其 中 <tt>v</tt> 是邻接于 <tt>u</tt> 的顶点。
<hr> -<pre> -std::pair<in_edge_iterator, in_edge_iterator> -in_edges(vertex_descriptor v, const filtered_graph& g) -</pre> -Returns an iterator-range providing access to the in-edges of vertex -<tt>v</tt> in graph <tt>g</tt>. For an in-edge <tt>e</tt>, -<tt>target(e, g) == v</tt> and <tt>source(e, g) == u</tt> for some -vertex <tt>u</tt> that is adjacent to <tt>v</tt>, whether the graph is -directed or undirected.+<pre>std::pair<in_edge_iterator, in_edge_iterator><br>in_edges(vertex_descriptor v, const filtered_graph& g)<br></pre>返 回一个迭代器区间,提供对图 <tt>g</tt> 的顶点 <tt>v</tt><tt></tt> 的入边的访问。对于某条入边 +<tt>e</tt>,有 <tt>target(e, g) == v</tt> 且 <tt>source(e, g) == u</tt>,其 中 <tt>u</tt> 是邻接于 <tt>v</tt> 的顶点,无论是有向图还是无向图。
<hr> -<pre> -vertex_descriptor -source(edge_descriptor e, const filtered_graph& g) -</pre> -Returns the source vertex of edge <tt>e</tt>.+<pre>vertex_descriptor<br>source(edge_descriptor e, const filtered_graph& g)<br></pre>返回边 <tt>e</tt> 的源 顶点。
+ + <hr> -<pre> -vertex_descriptor -target(edge_descriptor e, const filtered_graph& g) -</pre> -Returns the target vertex of edge <tt>e</tt>.+<pre>vertex_descriptor<br>target(edge_descriptor e, const filtered_graph& g)<br></pre>返回边 <tt>e</tt> 的目 标顶点。
+ + <hr> -<pre> -degree_size_type -out_degree(vertex_descriptor u, const filtered_graph& g) -</pre> -Returns the number of edges leaving vertex <tt>u</tt>.+<pre>degree_size_type<br>out_degree(vertex_descriptor u, const filtered_graph& g)<br></pre>返回顶点 <tt>u</tt> 的出边数 量。
+ + <hr> -<pre> -degree_size_type -in_degree(vertex_descriptor u, const filtered_graph& g) -</pre> -Returns the number of edges entering vertex <tt>u</tt>.+<pre>degree_size_type<br>in_degree(vertex_descriptor u, const filtered_graph& g)<br></pre>返回顶点 <tt>u</tt> 的入边数 量。
+ + <hr> <pre><a name="num_vertices"></a> vertices_size_type num_vertices(const filtered_graph& g) -</pre>-Returns the number of vertices in the underlying graph <a href="#2">[2]</a>.
+</pre>返回在底层图中的顶点数量<a href="#2">[2]</a>。 <hr> <pre><a name="num_edges"></a> edges_size_type num_edges(const filtered_graph& g) -</pre> -Returns the number of edges in the underlying graph <a href="#2">[2]</a>. +</pre>返回在底层图中的边数量<a href="filtered_graph.html#2">[2]</a>。 <hr> -<pre> -std::pair<edge_descriptor, bool> -edge(vertex_descriptor u, vertex_descriptor v, - const filtered_graph& g) -</pre> -Returns the edge connecting vertex <tt>u</tt> to vertex <tt>v</tt> in -graph <tt>g</tt>.+<pre>std::pair<edge_descriptor, bool><br>edge(vertex_descriptor u, vertex_descriptor v,<br> const filtered_graph& g)<br></pre>返回在图 <tt>g</tt> 中连接顶 点 <tt>u</tt> 至顶点 <tt>v</tt> 的边。
<hr> -<pre> -template <typename G, typename EP, typename VP> -std::pair<out_edge_iterator, out_edge_iterator> -edge_range(vertex_descriptor u, vertex_descriptor v, - const filtered_graph& g) -</pre> -Returns a pair of out-edge iterators that give the range for all the -parallel edges from <tt>u</tt> to <tt>v</tt>. This function only works -when the underlying graph supports <tt>edge_range</tt>, which requires -that it sorts its out edges according to target vertex and allows -parallel edges. The <tt>adjacency_list</tt> class with -<tt>OutEdgeList=multisetS</tt> is an example of such a graph.+<pre>template <typename G, typename EP, typename VP><br>std::pair<out_edge_iterator, out_edge_iterator><br>edge_range(vertex_descriptor u, vertex_descriptor v,<br> const filtered_graph& g)<br></pre>返回一对出边迭代器,给出从 <tt>u</tt> 到 <tt>v</tt> 的所有平行边。该函数仅当底层图支持 <tt>edge_range</tt> 时可用,它要求图根据目标顶点来对出边进行排序,并允许平行 边。带 +<tt>OutEdgeList=multisetS</tt> 的 <tt>adjacency_list</tt> 类是满足要求的一 个例子。
<hr> -<h4>Property Map Access</h4> +<h4>Property Map Access 属性映射访问</h4> <hr> -<pre> -template <class <a href="./PropertyTag.html">PropertyTag</a>> -property_map<filtered_graph, PropertyTag>::type -get(PropertyTag, filtered_graph& g) - -template <class <a href="./PropertyTag.html">PropertyTag</a>> -property_map<filtered_graph, Tag>::const_type -get(PropertyTag, const filtered_graph& g) -</pre> -Returns the property map object for the vertex property specified by -<TT>PropertyTag</TT>. The <TT>PropertyTag</TT> must match one of the -properties specified in the graph's <TT>VertexProperty</TT> template -argument.+<pre>template <class <a href="./PropertyTag.html">PropertyTag</a>><br>property_map<filtered_graph, PropertyTag>::type<br>get(PropertyTag, filtered_graph& g)<br><br>template <class <a href="./PropertyTag.html">PropertyTag</a>><br>property_map<filtered_graph, Tag>::const_type<br>get(PropertyTag, const filtered_graph& g)<br></pre>返回由 +<tt>PropertyTag</tt> 指定的顶点属性的属性映射对象。<tt>PropertyTag</tt> 必 须是在图的 <tt>VertexProperty</tt> 模板参数中所指定的某一个属性相匹配。
<hr> -<pre>-template <class <a href="./PropertyTag.html">PropertyTag</a>, class X> -typename property_traits<property_map<filtered_graph, PropertyTag>::const_type>::value_type
-get(PropertyTag, const filtered_graph& g, X x) -</pre> -This returns the property value for <tt>x</tt>, where <tt>x</tt> is either -a vertex or edge descriptor.+<pre>template <class <a href="./PropertyTag.html">PropertyTag</a>, class X><br>typename property_traits<property_map<filtered_graph, PropertyTag>::const_type&gt::value_type<br>get(PropertyTag, const filtered_graph& g, X x)<br></pre>返回 <tt>x</tt> 的属性 值,<tt>x</tt> 是一个顶点描述符或边描述符。
<hr> -<pre>-template <class <a href="./PropertyTag.html">PropertyTag</a>, class X, class Value>
-void -put(PropertyTag, const filtered_graph& g, X x, const Value& value) -</pre> -This sets the property value for <tt>x</tt> to -<tt>value</tt>. <tt>x</tt> is either a vertex or edge descriptor. -<tt>Value</tt> must be convertible to-<tt>typename property_traits<property_map<filtered_graph, PropertyTag>::type>::value_type</tt> +<pre>template <class <a href="./PropertyTag.html">PropertyTag</a>, class X, class Value><br>void<br>put(PropertyTag, const filtered_graph& g, X x, const Value& value)<br></pre>将 <tt>x</tt> 的属性值设置为 +<tt>value</tt>。<tt>x</tt> 是一个顶点描述符或边描述符。<tt>Value</tt> 必须 可以转换为 +<tt>typename property_traits<property_map<filtered_graph, PropertyTag>::type&gt::value_type</tt>
<hr> -<h3>See Also</h3> +<h3>See Also 参见</h3> <a href="./property_map.html"><tt>property_map</tt></a>, <a href="./graph_traits.html"><tt>graph_traits</tt></a> -<h3>Notes</h3> +<h3>Notes 备注</h3> <p> -<a name="1">[1]</a> The reason for requiring <a -href="http://www.sgi.com/tech/stl/DefaultConstructible.html";>Default -Constructible</a> in the <tt>EdgePredicate</tt> and -<tt>VertexPredicate</tt> types is that these predicates are stored -by-value (for performance reasons) in the filter iterator adaptor, and -iterators are required to be Default Constructible by the C++ -Standard. - -<p> <a name="2">[2]</a> It would be nicer to return the number of -vertices (or edges) remaining after the filter has been applied, but -this has two problems. The first is that it would take longer to -calculate, and the second is that it would interact badly with the -underlying vertex/edge index mappings. The index mapping would no -longer fall in the range <tt>[0,num_vertices(g))</tt> (resp. <tt>[0, -num_edges(g))</tt>) which is assumed in many of the algorithms. - - -<br> -<HR> -<TABLE> -<TR valign=top> -<TD 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/~lums";>Andrew Lumsdaine</A>, -Indiana University (<A -HREF="mailto:lums@xxxxxxxxxx";>lums@xxxxxxxxxx</A>) -</TD></TR></TABLE> - -</BODY> -</HTML> +<a name="1">[1]</a> 要求 <tt>EdgePredicate</tt> 和+<tt>VertexPredicate</tt> 类型满足 <a href="http://www.sgi.com/tech/stl/DefaultConstructible.html";>可缺省构造</a> 的要求是,这些断言是以值方式保存(为了性能的原因)在过滤迭代器适配器中的,而 C++标准要求迭代器要满足可缺省构造。
++</p><p> <a name="2">[2]</a> 本来,返回过滤后所剩下的顶点数(或边数)似乎更好 一些,不过这有两个问题。首先是需要更多的计算,其次是这样的话与底层的顶点/边 索引映射的交互性较差。索引映射不再位于 <tt>[0,num_vertices(g))</tt> (或 <tt>[0,
+num_edges(g))</tt>) 范围中了,这一点在许多算法中是假定满足的。<br> +</p><hr> +<table> +<tbody><tr valign="top"> +<td nowrap="nowrap">Copyright (c) 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/graph_traits.html Mon Jun 1 21:27:33 2009 +++ /trunk/libs/graph/doc/graph_traits.html Thu Jul 23 20:28:01 2009 @@ -1,100 +1,63 @@ -<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: Graph Traits</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=""></A> -<pre> -graph_traits<<a href="./Graph.html">Graph</a>> -</pre> -</H1> - -Just like the <a -href="http://www.sgi.com/tech/stl/iterator_traits.html";> -iterators</a> of STL, graphs have <b>associated types</b>. As stated -in the various <a href="./graph_concepts.html">graph concepts</a>, a -graph has quite a few associated types: <tt>vertex_descriptor</tt>, -<tt>edge_descriptor</tt>, <tt>out_edge_iterator</tt>, etc.. Any -particular graph concepts will not require that all of the following -associated types be defined. When implementing a graph class that -fullfils one or more graph concepts, for associated types that are not -required by the concepts, it is ok to use <tt>void</tt> as the type -(when using nested typedefs inside the graph class), or to leave the -typedef out of the <tt>graph_traits</tt> specialization for the graph -class. - -<pre> - template <typename Graph> - struct graph_traits { - typedef typename Graph::vertex_descriptor vertex_descriptor; - typedef typename Graph::edge_descriptor edge_descriptor; - typedef typename Graph::adjacency_iterator adjacency_iterator; - typedef typename Graph::out_edge_iterator out_edge_iterator; - typedef typename Graph::in_edge_iterator in_edge_iterator; - typedef typename Graph::vertex_iterator vertex_iterator; - typedef typename Graph::edge_iterator edge_iterator; - - typedef typename Graph::directed_category directed_category; - typedef typename Graph::edge_parallel_category edge_parallel_category; - typedef typename Graph::traversal_category traversal_category; - - typedef typename Graph::vertices_size_type vertices_size_type; - typedef typename Graph::edges_size_type edges_size_type; - typedef typename Graph::degree_size_type degree_size_type; - }; -</pre> - -<h3>Where Defined</h3> +<title>Boost Graph Library: Graph Traits</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=""></a> +<pre>graph_traits<<a href="./Graph.html">Graph</a>><br></pre>+</h1>类似于STL的 <a href="http://www.sgi.com/tech/stl/iterator_traits.html";> +迭代器</a>,图也有<b>相关的类型</b>。正如在各种 <a href="./graph_concepts.html">图概念</a> 中所声明的,一个图带有一些相关联的类 型:<tt>vertex_descriptor</tt>, +<tt>edge_descriptor</tt>, <tt>out_edge_iterator</tt>, 等等。任意一个特定的 图概念并不要求以下所有关联类型都被定义。当实现一个符合一个或多个图概念的图类 时,对于那些不被图概念所要求的关联类型,可以以 <tt>void</tt> 作为它们的类型 (在图类的内部使用嵌套 typedefs),或者在针对该图类的 <tt>graph_traits</tt> 特 化中去掉这些
+typedef。 ++<pre> template <typename Graph><br> struct graph_traits {<br> typedef typename Graph::vertex_descriptor vertex_descriptor;<br> typedef typename Graph::edge_descriptor edge_descriptor;<br> typedef typename Graph::adjacency_iterator adjacency_iterator;<br> typedef typename Graph::out_edge_iterator out_edge_iterator;<br> typedef typename Graph::in_edge_iterator in_edge_iterator;<br> typedef typename Graph::vertex_iterator vertex_iterator;<br> typedef typename Graph::edge_iterator edge_iterator;<br><br> typedef typename Graph::directed_category directed_category;<br> typedef typename Graph::edge_parallel_category edge_parallel_category;<br> typedef typename Graph::traversal_category traversal_category;<br><br> typedef typename Graph::vertices_size_type vertices_size_type;<br> typedef typename Graph::edges_size_type edges_size_type;<br> typedef typename Graph::degree_size_type degree_size_type;<br> };<br></pre>
+ +<h3>Where Defined 定义于</h3><a href="../../../boost/graph/graph_traits.hpp"><tt>boost/graph/graph_traits.hpp</tt></a>
-<H3>Template Parameters</H3> - -<P> -<TABLE border> -<TR> +<h3>Template Parameters 模板参数</h3> + +<p> +<table border="1"> +<tbody><tr> <th>Parameter</th><th>Description</th> </tr> -<TR><TD><TT>Graph</TT></TD> -<TD> -The graph type whose associated types are being accessed. -</TD> -</TR> - -</table> - -<h3>Model of</h3> - -<a-href="http://www.sgi.com/tech/stl/DefaultConstructible.html";>DefaultConstructible</a> and
-<a href="http://www.sgi.com/tech/stl/Assignable.html";>Assignable</a> - -<h3>Type Requirements</h3> +<tr><td><tt>Graph</tt></td> +<td>要访问其关联类型的图类型。 +</td> +</tr> + +</tbody></table> + +</p><h3>Model of 以...为模型</h3> ++<a href="http://www.sgi.com/tech/stl/DefaultConstructible.html";>可缺省构造 DefaultConstructible</a> 且
+<a href="http://www.sgi.com/tech/stl/Assignable.html";>可赋值Assignable</a> + +<h3>Type Requirements 类型要求</h3> <ul> - <li><tt>Graph</tt> is a model of one of the <a - href="./graph_concepts.html">graph concepts</a>. -</ul> - -<H2>Members</H2> + <li><tt>Graph</tt> 符合某个 <a href="./graph_concepts.html">图概念</a>。 +</li></ul> + +<h2>Members 成员</h2> <p> -<table border> -<tr> +<table border="1"> +<tbody><tr> <th>Member</th><th>Description</th> </tr> @@ -102,8 +65,7 @@ <td><tt> vertex_descriptor </tt></td> -<td> -The type for the objects used to identity vertices in the graph. +<td>用于标识图中顶点的对象的类型。 </td> </tr> @@ -111,8 +73,7 @@ <td><tt> edge_descriptor </tt></td> -<td> -The type for the objects used to identity edges in the graph. +<td>用于标识图中边的对象的类型。 </td> </tr> @@ -120,9 +81,7 @@ <td><tt> adjacency_iterator </tt></td> -<td> -The type for the iterators that traverse the vertices adjacent -to a vertex. +<td>对某个顶点的邻接顶点进行遍历的迭代器的类型。 </td> </tr> @@ -130,9 +89,7 @@ <td><tt> out_edge_iterator </tt></td> -<td> -The type for the iterators that traverse through the out-edges -of a vertex. +<td>对某个顶点的出边进行遍历的迭代器的类型。 </td> </tr> @@ -140,9 +97,7 @@ <td><tt> in_edge_iterator </tt></td> -<td> -The type for the iterators that traverse through the in-edges -of a vertex. +<td>对某个顶点的入边进行遍历的迭代器的类型。 </td> </tr> @@ -150,9 +105,7 @@ <td><tt> vertex_iterator </tt></td> -<td> -The type for the iterators that traverse through the complete vertex -set of the graph. +<td>对图的完整顶点集进行遍历的迭代器的类型。 </td> </tr> @@ -160,9 +113,7 @@ <td><tt> edge_iterator </tt></td> -<td> -The type for the iterators that traverse through the complete edge -set of the graph. +<td>对图的完整边集进行遍历的迭代器的类型。 </td> </tr> @@ -170,9 +121,7 @@ <td><tt> directed_category </tt></td> -<td> -This says whether the graph is undirected (<tt>undirected_tag</tt>) -or directed (<tt>directed_tag</tt>).+<td>表明该图是无向图(<tt>undirected_tag</tt>)或是有向图 (<tt>directed_tag</tt>)。
</td> </tr> @@ -180,10 +129,7 @@ <td><tt> edge_parallel_category </tt></td> -<td> -This says whether the graph allows parallel edges to be inserted -(<tt>allow_parallel_edge_tag</tt>) or if it automatically removes -parallel edges (<tt>disallow_parallel_edge_tag</tt>).+<td>表明该图是允许插入平行边(<tt>allow_parallel_edge_tag</tt>)或是会自动删 除平行边(<tt>disallow_parallel_edge_tag</tt>)。
</td> </tr> @@ -191,14 +137,10 @@ <td><tt> traversal_category </tt></td> -<td> -The ways in which the vertices in the graph can be traversed. -The traversal category tags are: -<tt>incidence_graph_tag, adjacency_graph_tag,+<td>可以对图中顶点进行遍历的方法。遍历类别标签包括 有:<tt>incidence_graph_tag, adjacency_graph_tag,
bidirectional_graph_tag, vertex_list_graph_tag, edge_list_graph_tag, vertex_and_edge_list_graph_tag, -adjacency_matrix_tag</tt>. You can also create your own -tag which should inherit from one of the above. +adjacency_matrix_tag</tt>。你也可以从以上之一进行派生以创建自己的标签。 </td> </tr> @@ -206,9 +148,7 @@ <td><tt> vertices_size_type </tt></td> -<td> -The unsigned integer type used for representing the number of -vertices in the graph. +<td>用于表示图中顶点数的无符号整数类型。 </td> </tr> @@ -216,9 +156,7 @@ <td><tt> edge_size_type </tt></td> -<td> -The unsigned integer type used for representing the number of -edge in the graph. +<td>用于表示图中边数的无符号整数类型。 </td> </tr> @@ -226,27 +164,22 @@ <td><tt> degree_size_type </tt></td> -<td> -The unsigned integer type used for representing the degree -of vertices in the graph. +<td>用于表示图中顶点度数的无符号整数类型。 </td> </tr> -</table> +</tbody></table> <br> -<HR> -<TABLE> -<TR valign=top> -<TD 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/~lums";>Andrew Lumsdaine</A>, -Indiana University (<A -HREF="mailto:lums@xxxxxxxxxx";>lums@xxxxxxxxxx</A>) -</TD></TR></TABLE> - -</BODY> -</HTML> +</p><hr> +<table> +<tbody><tr valign="top"> +<td nowrap="nowrap">Copyright (c) 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/inv_adjacency_iterator.html Mon Mar 30 07:58:04 2009 +++ /trunk/libs/graph/doc/inv_adjacency_iterator.html Thu Jul 23 20:28:01 2009
@@ -1,34 +1,26 @@ -<html> -<!-- +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><!-- -- Copyright (c) 2000 Jeremy Siek -- -- 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> -<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> -<title>Inverse Adjacency Iterator Adaptor Documentation</title> -</head> - -<body bgcolor="#FFFFFF" text="#000000"> - -<img src="../../../boost.png" alt="boost.png (6897 bytes)" -align="center" width="277" height="86"> - -<h1>Inverse Adjacency Iterator Adaptor</h1> - -Defined in header +<title>Inverse Adjacency Iterator Adaptor Documentation</title></head> + + +<body bgcolor="#ffffff" text="#000000"> ++<img src="../../../boost.png" alt="boost.png (6897 bytes)" align="middle" height="86" width="277">
++<h1>Inverse Adjacency Iterator Adaptor 反向邻接迭代器适配器</h1>定义于头文 件 <a href="../../../boost/graph/adjacency_iterator.hpp">boost/graph/adjacency_iterator.hpp</a>
-<p> -The inverse adjacency iterator adaptor transforms an -<tt>in_edge_iterator</tt> into an inverse adjacency iterator. That is, it -takes an iterator that traverses over edges, and creates an iterator -that traverses over the <b><i>source</i></b> vertices of those edges. +<p>反向邻接迭代器适配器将一个+<tt>in_edge_iterator</tt> 转换为反向邻接迭代器。即,它接受一个对边进行遍历 的迭代器,并创建一个对这些边的<b><i>源</i></b>顶点进行遍历的迭代器。
<!-- With this adaptor it is trivial to take a graph type that models <a @@ -37,105 +29,66 @@ Graph</a>. --> -<h2>Synopsis</h2> - -<pre> -namespace boost { - template <class Graph, class VertexDescriptor, class InEdgeIter> - class inv_adjacency_iterator_generator { - public:- typedef <a href="../../iterator/doc/iterator_adaptor.html">iterator_adaptor</a><...> type;
- }; -} -</pre> +</p><h2>Synopsis 概要</h2> ++<pre>namespace boost {<br> template <class Graph, class VertexDescriptor, class InEdgeIter><br> class inv_adjacency_iterator_generator {<br> public:<br> typedef <a href="../../iterator/doc/iterator_adaptor.html">iterator_adaptor</a><...> type;<br> };<br>}<br></pre>
<hr> -<h3>Example</h3> - -<p> -The following is an example of how to use the -<tt>inv_adjacency_iterator_generator</tt> class. - -<p> -<PRE> -#include <boost/graph/adjacency_iterator.hpp> - -class my_graph { - // ... - typedef ... in_edge_iterator; - typedef ... vertex_descriptor;- typedef boost::inv_adjacency_iterator_generator<my_graph, vertex_descriptor, in_edge_iterator>::type inv_adjacency_iterator;
- // ... -}; - -</PRE> - -<h3>Template Parameters</h3> - -<Table border> -<TR> -<TH>Parameter</TH><TH>Description</TH> -</TR> - -<TR> -<TD><tt>Graph</tt></TD> -<TD>The graph type, which must model <a -href="./IncidenceGraph.html">Incidence Graph</a>.</TD> -</TR> - -<TR> -<TD><tt>VertexDescriptor</tt></TD> -<TD>This must be the same type as -<tt>graph_traits<Graph>::vertex_descriptor</tt>. The reason why -this is a template parameter is that the primary use of -<tt>inv_adjacency_iterator_generator</tt> is <b><i>inside</i></b> the -definition of the graph class, and in that context we can not use -<tt>graph_traits</tt> on the not yet fully defined graph class.<br> -<b>Default:</b> <tt>graph_traits<Graph>::vertex_descriptor</tt></TD> -</TR> - -<TR> -<TD><tt>InEdgeIter</tt></TD> -<TD>This must be the same type as -<tt>graph_traits<Graph>::in_edge_iterator</tt>.<br> -<b>Default:</b> <tt>graph_traits<Graph>::in_edge_iterator -</TD> -</TR> - -</Table> - -<h3>Model of</h3> - -The inverse adjacency iterator adaptor (the type -<tt>inv_adjacency_iterator_generator<...>::type</tt>) is a model of <a-href="../../utility/MultiPassInputIterator.html">Multi-Pass Input Iterator</a>
-</a>. - - -<h3>Members</h3> - -The inverse adjacency iterator type implements the member functions and -operators required of the <a-href="http://www.sgi.com/tech/stl/RandomAccessIterator.html";>Random Access Iterator</a> -concept, except that the <tt>reference</tt> type is the same as the <tt>value_type</tt> -so <tt>operator*()</tt> returns by-value. In addition it has the following constructor:
- -<pre>-inv_adjacency_iterator_generator::type(const InEdgeIter& it, const Graph* g)
-</pre> +<h3>Example 示例</h3> + +<p>以下是一个如何使用 +<tt>inv_adjacency_iterator_generator</tt> 类的例子。 ++</p><pre>#include <boost/graph/adjacency_iterator.hpp><br><br>class my_graph {<br> // ...<br> typedef ... in_edge_iterator;<br> typedef ... vertex_descriptor;<br> typedef boost::inv_adjacency_iterator_generator<my_graph, vertex_descriptor, in_edge_iterator>::type inv_adjacency_iterator;<br> // ...<br>};<br><br></pre>
+ +<h3>Template Parameters 模板参数</h3> + +<table border="1"> +<tbody><tr> +<th>Parameter</th><th>Description</th> +</tr> + +<tr> +<td><tt>Graph</tt></td>+<td>图类型,必须符合 <a href="./IncidenceGraph.html">关联图Incidence Graph</a>。</td>
+</tr> + +<tr> +<td><tt>VertexDescriptor</tt></td> +<td>必须是与+<tt>graph_traits<Graph>::vertex_descriptor</tt> 相同的类型。将此作为 一个模板参数的原因是,<tt>inv_</tt><tt>adjacency_iterator_generator</tt> 的 主要用途是在图类定义的<b><i>内部</i></b>,而在这样的上下文中我们不能对尚未完 整定义的图类使用
+<tt>graph_traits</tt>。<br> +<b>缺省值:</b><tt>graph_traits<Graph>::vertex_descriptor</tt></td> +</tr> + +<tr> +<td><tt>InEdgeIter</tt></td>+<td>必须是与 <tt>graph_traits<Graph>::in_edge_iterator</tt> 相同的类 型。<br>
+<b>缺省值:</b><tt>graph_traits<Graph>::in_edge_iterator +</tt></td> +</tr> + +</tbody></table> + +<h3>Model of 以...为模型</h3>反向邻接迭代器适配器(类型+<tt>inv_</tt><tt>adjacency_iterator_generator<...>::type</tt>)是 <a href="../../utility/MultiPassInputIterator.html">多遍输入迭代器</a>。
+ ++<h3>Members 成员</h3>反向邻接迭代器类型实现了 <a href="http://www.sgi.com/tech/stl/RandomAccessIterator.html";>随机访问迭代器 </a>
+概念所要求的成员函数和操作符,除了其引用类型与 <tt>value_type</tt>+相同,因此 <tt>operator*()</tt> 是以值方式返回的。此外它还有以下构造函 数:
++<pre>inv_adjacency_iterator_generator::type(const InEdgeIter& it, const Graph* g)<br></pre>
<hr><p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan -->19 Aug 2001<!--webbot bot="Timestamp" endspan i-checksum="14767" --></p>
<p>(c) Copyright Jeremy Siek 2000. Permission to copy, use,modify, sell and distribute this document is granted provided this copyright
-notice appears in all copies. This document is provided "as is" +notice appears in all copies. This document is provided "as is"without express or implied warranty, and with no claim as to its suitability for
any purpose.</p> -</body> - -</html> - <!-- LocalWords: VertexDescriptor InEdgeIter inv const Aug Siek --> +</body></html> ======================================= --- /trunk/libs/graph/doc/property_map.html Mon Jun 1 21:27:33 2009 +++ /trunk/libs/graph/doc/property_map.html Thu Jul 23 20:28:01 2009 @@ -1,86 +1,58 @@ -<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: Property Map Traits</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> - -<BR Clear> - -<H1><A NAME=""></A> -<pre>-property_map<<a href="./PropertyGraph.html">PropertyGraph</a>, <a href="./PropertyTag.html">PropertyTag</a>>
-</pre> -</H1> - -This is the traits class that produces the type for a <a -href="../../property_map/property_map.html">property map</a> object -for a particular graph type. The property is specified by the <a-href="./PropertyTag.html">PropertyTag</a> template parameter. Graph classes
-must specialize this traits class to provide their own implementation -for property maps. - -<pre> - template <class Graph, class PropertyTag> - struct property_map { - typedef ... type; - typedef ... const_type; - }; -</pre> - -<h3>Where Defined</h3> +<title>Boost Graph Library: Property Map Traits</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=""> + +<br clear=""> + +<h1><a name=""></a>+<pre>property_map<<a href="./PropertyGraph.html">PropertyGraph</a>, <a href="./PropertyTag.html">PropertyTag</a>><br></pre> +</h1>这是一个 traits 类,对某个特定图类型生成指定 <a href="../../property_map/property_map.html">属性映射property map</a> 对象的 类型。属性由 <a href="./PropertyTag.html">PropertyTag</a> 模板参数指定。 Graph 图必须指定这一 traits 类,以提供它们自己的属性映射实现。
++<pre> template <class Graph, class PropertyTag><br> struct property_map {<br> typedef ... type;<br> typedef ... const_type;<br> };<br></pre>
+ +<h3>Where Defined 定义于</h3><a href="../../../boost/graph/properties.hpp"><tt>boost/graph/properties.hpp</tt></a>
-<h3>Associated Types</h3> - -<table border> - -<tr> +<h3>Associated Types 关联类型</h3> + +<table border="1"> + +<tbody><tr> <td>Map Type</td> -<td><TT>type</TT> </td> -<td> -The (mutable) property map type for mapping vertex or edge desriptors of -the graph to their associated property values, where the property is -specified by <tt>PropertyTag</tt>. This type is a <a -href="../../property_map/property_map.html">property map</a>. -</tr> +<td><tt>type</tt> </td>+<td>用于将图的顶点描述符或边描述符映射至它们相关的属性值的(可变)属性映射类 型,属性由 <tt>PropertyTag</tt> 指定。该类型是一个 <a href="../../property_map/property_map.html">属性映射</a>。
+</td></tr> <tr> <td>Const Map Type</td> -<td><TT>const_type</TT> </td> -<td> -The (non-mutable) property map type for mapping vertex or edge -desriptors of the graph to their associated property values, where the -property is specified by <tt>PropertyTag</tt>. This type is a <a -href="../../property_map/property_map.html">property map</a>. -</tr> - -</table> +<td><tt>const_type</tt> </td>+<td>用于将图的顶点描述符或边描述符映射至它们相关的属性值的(不可变)属性映射 类型,属性由 <tt>PropertyTag</tt> 指定。该类型是一个 <a href="../../property_map/property_map.html">属性映射</a>。
+</td></tr> + +</tbody></table> <br> -<HR> -<TABLE> -<TR valign=top> -<TD 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/~lums";>Andrew Lumsdaine</A>, -Indiana University (<A -HREF="mailto:lums@xxxxxxxxxx";>lums@xxxxxxxxxx</A>) -</TD></TR></TABLE> - -</BODY> -</HTML> +<hr> +<table> +<tbody><tr valign="top"> +<td nowrap="nowrap">Copyright (c) 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/reverse_graph.html Mon Mar 30 07:58:04 2009 +++ /trunk/libs/graph/doc/reverse_graph.html Thu Jul 23 20:28:01 2009 @@ -1,419 +1,229 @@ -<HTML> -<!-- +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">+<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><!--
-- (C) Copyright David Abrahams and 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: Reverse Graph Adaptor</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: Reverse Graph Adaptor</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:reverse-graph-adaptor"></A> +<h1><a name="sec:reverse-graph-adaptor"></a> </h1> -<pre>-reverse_graph<<a href="./BidirectionalGraph.html">BidirectionalGraph</a>, GraphReference>
-</pre> - -The <tt>reverse_graph</tt> adaptor flips the in-edges and out-edges of -a <a href="./BidirectionalGraph.html">BidirectionalGraph</a>, -effectively transposing the graph. The construction of the -<tt>reverse_graph</tt> is constant time, providing a highly efficient -way to obtain a transposed-view of a graph. - - -<H3>Example</H3> - -The example from <a -href="../example/reverse-graph-eg.cpp"><tt>examples/reverse-graph-eg.cpp</tt></a>. - -<pre> -int -main() -{ - typedef boost::adjacency_list< - boost::vecS, boost::vecS, boost::bidirectionalS, - > Graph; - - Graph G(5); - boost::add_edge(0, 2, G); - boost::add_edge(1, 1, G); - boost::add_edge(1, 3, G); - boost::add_edge(1, 4, G); - boost::add_edge(2, 1, G); - boost::add_edge(2, 3, G); - boost::add_edge(2, 4, G); - boost::add_edge(3, 1, G); - boost::add_edge(3, 4, G); - boost::add_edge(4, 0, G); - boost::add_edge(4, 1, G); - - std::cout << "original graph:" << std::endl; - boost::print_graph(G, boost::get(boost::vertex_index, G)); -- std::cout << std::endl << "reversed graph:" << std::endl;
- boost::print_graph(boost::make_reverse_graph(G), - boost::get(boost::vertex_index, G)); - - - return 0; -} -</pre> -The output is: -<pre> -original graph: -0 --> 2 -1 --> 1 3 4 -2 --> 1 3 4 -3 --> 1 4 -4 --> 0 1 - -reversed graph: -0 --> 4 -1 --> 1 2 3 4 -2 --> 0 -3 --> 1 2 -4 --> 1 2 3 -</pre> - -<H3>Template Parameters</H3> - -<P> -<TABLE border> -<TR>+<pre>reverse_graph<<a href="./BidirectionalGraph.html">BidirectionalGraph</a>, GraphReference><br></pre><tt>reverse_graph</tt> 适配器通过倒转一个 <a href="./BidirectionalGraph.html">双向图BidirectionalGraph</a> 的出边和入 边,高效地倒转一个图。<tt>reverse_graph</tt> 的构造是常量时间的,提供了获得 一个图的翻转视图的高效方法。
+ ++<h3>Example 示例</h3>这个例子来自 <a href="../example/reverse-graph-eg.cpp"><tt>examples/reverse-graph-eg.cpp</tt></a>.
++<pre>int<br>main()<br>{<br> typedef boost::adjacency_list< <br> boost::vecS, boost::vecS, boost::bidirectionalS,<br> > Graph;<br> <br> Graph G(5);<br> boost::add_edge(0, 2, G);<br> boost::add_edge(1, 1, G);<br> boost::add_edge(1, 3, G);<br> boost::add_edge(1, 4, G);<br> boost::add_edge(2, 1, G);<br> boost::add_edge(2, 3, G);<br> boost::add_edge(2, 4, G);<br> boost::add_edge(3, 1, G);<br> boost::add_edge(3, 4, G);<br> boost::add_edge(4, 0, G);<br> boost::add_edge(4, 1, G);<br><br> std::cout << "original graph:" << std::endl;<br> boost::print_graph(G, boost::get(boost::vertex_index, G));<br><br> std::cout << std::endl << "reversed graph:" << std::endl;<br> boost::print_graph(boost::make_reverse_graph(G), <br> boost::get(boost::vertex_index, G));<br><br><br> return 0;<br>}<br></pre>输 出为: +<pre>original graph:<br>0 --> 2 <br>1 --> 1 3 4 <br>2 --> 1 3 4 <br>3 --> 1 4 <br>4 --> 0 1 <br><br>reversed graph:<br>0 --> 4 <br>1 --> 1 2 3 4 <br>2 --> 0 <br>3 --> 1 2 <br>4 --> 1 2 3 <br></pre>
+ +<h3>Template Parameters 模板参数</h3> + +<p> +<table border="1"> +<tbody><tr> <th>Parameter</th><th>Description</th><th>Default</th> </tr> -<TR><TD><TT>BidirectionalGraph</TT></TD> -<TD>The graph type to be adapted.</TD> -<TD> </TD> -</TR> - -<TR><TD><TT>GraphReference</TT></TD> -<TD>This type should be <tt>const BidirectionalGraph&</tt>-if you want to create a const reverse graph, or <tt>BidirectionalGraph&</tt> if you want to create a non-const reverse graph.</TD>
-<TD><tt>const BidirectionalGraph&</tt></TD> -</TR> +<tr><td><tt>BidirectionalGraph</tt></td> +<td>被适配的图类型。</td> +<td> </td> +</tr> + +<tr><td><tt>GraphReference</tt></td>+<td>如果你想创建一个常性的翻转图,则该类型应为 <tt>const BidirectionalGraph&</tt>,如果你想创建一个非常性的翻转 图,则为 <tt>BidirectionalGraph&</tt>。</td>
+<td><tt>const BidirectionalGraph&</tt></td> +</tr> -</table> +</tbody></table> -<H3>Model of</H3> - -<P> -<a href="./BidirectionalGraph.html">BidirectionalGraph</a> -and optionally -<a href="./VertexListGraph.html">VertexListGraph</a> -and <a href="./PropertyGraph.html">PropertyGraph</a> +</p><h3>Model of 以...为模型</h3> + +<p> +<a href="./BidirectionalGraph.html">双向图BidirectionalGraph</a> +并且可能是+<a href="./VertexListGraph.html">点列表图VertexListGraph</a> 和 <a href="./PropertyGraph.html">属性图PropertyGraph</a>
-<H3>Where Defined</H3> - -<P>-<a href="../../../boost/graph/reverse_graph.hpp"><TT>boost/graph/reverse_graph.hpp</TT></a>
+</p><h3>Where Defined 定义于</h3> + +<p>+<a href="../../../boost/graph/reverse_graph.hpp"><tt>boost/graph/reverse_graph.hpp</tt></a>
-<H2>Associated Types</H2> +</p><h2>Associated Types 关联类型</h2> <hr> <tt>graph_traits<reverse_graph>::vertex_descriptor</tt> -<br><br> -The type for the vertex descriptors associated with the -<TT>reverse_graph</TT>. +<br><br>与 +<tt>reverse_graph</tt> 相关联的顶点描述符类型。 <hr> <tt>graph_traits<reverse_graph>::edge_descriptor</tt> -<br><br> -The type for the edge descriptors associated with the -<TT>reverse_graph</TT>. +<br><br>与 +<tt>reverse_graph</tt> 相关联的边描述符类型。 <hr> <tt>graph_traits<reverse_graph>::vertex_iterator</tt> -<br><br> -The type for the iterators returned by <TT>vertices()</TT>. +<br><br>由 <tt>vertices()</tt> 返回的迭代器类型。 <hr> <tt>graph_traits<reverse_graph>::edge_iterator</tt> -<br><br> -The type for the iterators returned by <TT>edges()</TT>. +<br><br>由 <tt>edges()</tt> 返回的迭代器类型。 <hr> <tt>graph_traits<reverse_graph>::out_edge_iterator</tt> -<br><br> -The type for the iterators returned by <TT>out_edges()</TT>. +<br><br>由 <tt>out_edges()</tt> 返回的迭代器类型。 <hr> <tt>graph_traits<reverse_graph>::adjacency_iterator</tt> -<br><br> -The type for the iterators returned by <TT>adjacent_vertices()</TT>. +<br><br>由 <tt>adjacent_vertices()</tt> 返回的迭代器类型。 <hr> <tt>graph_traits<reverse_graph>::directed_category</tt> -<br><br> -Provides information about whether the graph is -directed (<TT>directed_tag</TT>) or undirected -(<TT>undirected_tag</TT>).+<br><br>提供关于该图是有向图(<tt>directed_tag</tt>)或是无向图 (<tt>undirected_tag</tt>)的信息。
<hr> <tt>graph_traits<reverse_graph>::edge_parallel_category</tt> -<br><br> -This describes whether the graph class allows the insertion of -parallel edges (edges with the same source and target). The two tags -are <TT>allow_parallel_edge-_tag</TT> and -<TT>disallow_parallel_edge_tag</TT>. The -<TT>setS</TT> and <TT>hash_setS</TT> variants disallow -parallel edges while the others allow parallel edges.+<br><br>说明该图类是否允许插入平行边(具有相同源和目标的边)。可能的两个标签 是 <tt>allow_parallel_edge_tag</tt> 和 + <tt>disallow_parallel_edge_tag</tt>。<tt>setS</tt> 和 <tt>hash_setS</tt> 变体不允许平行边,而其它则允许平行边。
<hr> <tt>graph_traits<reverse_graph>::vertices_size_type</tt> -<br><br> -The type used for dealing with the number of vertices in the graph. +<br><br>用于处理图中顶点数量的类型。 <hr> <tt>graph_traits<reverse_graph>::edge_size_type</tt> -<br><br> -The type used for dealing with the number of edges in the graph. +<br><br>用于处理图中边数量的类型。 <hr> <tt>graph_traits<reverse_graph>::degree_size_type</tt> -<br><br> -The type used for dealing with the number of edges incident to a vertex -in the graph. +<br><br>用于处理单个顶点的出边数量的类型。 <hr> <tt>property_map<reverse_graph, PropertyTag>::type</tt><br> -and<br> +和<br> <tt>property_map<reverse_graph, PropertyTag>::const_type</tt> -<br><br> -The property map type for vertex or edge properties in the graph. The-specific property is specified by the <TT>PropertyTag</TT> template argument,
-and must match one of the properties specified in the -<TT>VertexProperty</TT> or <TT>EdgeProperty</TT> for the graph.+<br><br>图中顶点属性或边属性所用的映射类型。特定属性由 <tt>PropertyTag</tt> 模板参数指定,且必须与该图的 <tt>VertexProperty</tt> 或 <tt>EdgeProperty</tt> 中所指定的某个属性相匹配。
<hr> -<H2>Member Functions</H2> +<h2>Member Functions 成员函数</h2> <hr> -<pre> -reverse_graph(BidirectionalGraph& g) -</pre> -Constructor. Create a reversed (transposed) view of the graph <tt>g</tt>. +<pre>reverse_graph(BidirectionalGraph& g)<br></pre> +构造函数。创建图 <tt>g</tt> 的一个反向(倒转)视图。 <hr> -<H2>Non-Member Functions</H2> +<h2>Non-Member Functions 非成员函数</h2> <hr> -<pre> -template <class BidirectionalGraph> -reverse_graph<BidirectionalGraph, BidirectionalGraph&> -make_reverse_graph(BidirectionalGraph& g); - -template <class BidirectionalGraph> -reverse_graph<BidirectionalGraph, const BidirectionalGraph&> -make_reverse_graph(const BidirectionalGraph& g) - -</pre> -Helper function for creating a <tt>reverse_graph</tt>.+<pre>template <class BidirectionalGraph><br>reverse_graph<BidirectionalGraph, BidirectionalGraph&><br>make_reverse_graph(BidirectionalGraph& g);<br><br>template <class BidirectionalGraph><br>reverse_graph<BidirectionalGraph, const BidirectionalGraph&><br>make_reverse_graph(const BidirectionalGraph& g)<br><br></pre>创建一个 <tt>reverse_graph</tt> 的辅 助函数。
<hr> -<pre> -std::pair<vertex_iterator, vertex_iterator> -vertices(const reverse_graph& g) -</pre> -Returns an iterator-range providing access to the vertex set of graph -<tt>g</tt>.+<pre>std::pair<vertex_iterator, vertex_iterator><br>vertices(const reverse_graph& g)<br></pre>返回一个迭代器区间,提供对图 <tt>g</tt> 的顶点集的访问。
<hr> -<pre> -std::pair<out_edge_iterator, out_edge_iterator> -out_edges(vertex_descriptor v, const reverse_graph& g) -</pre> -Returns an iterator-range providing access to the out-edges of vertex -<tt>v</tt> in graph <tt>g</tt>. These out-edges correspond to the -in-edges of the adapted graph.+<pre>std::pair<out_edge_iterator, out_edge_iterator><br>out_edges(vertex_descriptor v, const reverse_graph& g)<br></pre>返 回一个迭代器区间,提供对图 <tt>g</tt> 的顶点 <tt>v</tt> 的出边的访问。这些出边对应于被适配图 的入边。
<hr> -<pre> -std::pair<in_edge_iterator, in_edge_iterator> -in_edges(vertex_descriptor v, const reverse_graph& g) -</pre> -Returns an iterator-range providing access to the in-edges of vertex -<tt>v</tt> in graph <tt>g</tt>. These in-edges correspond to the -out edges of the adapted graph.+<pre>std::pair<in_edge_iterator, in_edge_iterator><br>in_edges(vertex_descriptor v, const reverse_graph& g)<br></pre>返 回一个迭代器区间,提供对图 <tt>g</tt> 的顶点 <tt>v</tt> 的入边的访问。这些入边对应于被适配图 的出边。
<hr> -<pre> -std::pair<adjacency_iterator, adjacency__iterator>-adjacent_vertices(vertex_descriptor v, const reverse_graph& g)
-</pre>-Returns an iterator-range providing access to the adjacent vertices of vertex
-<tt>v</tt> in graph <tt>g</tt>.+<pre>std::pair<adjacency_iterator, adjacency__iterator><br>adjacent_vertices(vertex_descriptor v, const reverse_graph& g)<br></pre>返 回一个迭代器区间,提供对图 <tt>g</tt> 中顶点 <tt>v</tt> 的邻接顶点的访问。
<hr> -<pre> -vertex_descriptor -source(edge_descriptor e, const reverse_graph& g) -</pre> -Returns the source vertex of edge <tt>e</tt>.+<pre>vertex_descriptor<br>source(edge_descriptor e, const reverse_graph& g)<br></pre>返回边 <tt>e</tt> 的源顶 点。
<hr> -<pre> -vertex_descriptor -target(edge_descriptor e, const reverse_graph& g) -</pre> -Returns the target vertex of edge <tt>e</tt>.+<pre>vertex_descriptor<br>target(edge_descriptor e, const reverse_graph& g)<br></pre>返回边 <tt>e</tt> 的目标 顶点。
<hr> -<pre> -degree_size_type -out_degree(vertex_descriptor u, const reverse_graph& g) -</pre> -Returns the number of edges leaving vertex <tt>u</tt>.+<pre>degree_size_type<br>out_degree(vertex_descriptor u, const reverse_graph& g)<br></pre>返回顶点 <tt>u</tt> 的出边数 量。
<hr> -<pre> -degree_size_type -in_degree(vertex_descriptor u, const reverse_graph& g) -</pre> -Returns the number of edges entering vertex <tt>u</tt>. This operation -is only available if <TT>bidirectionalS</TT> was specified for -the <TT>Directed</TT> template parameter.+<pre>degree_size_type<br>in_degree(vertex_descriptor u, const reverse_graph& g)<br></pre>返回顶点 <tt>u</tt> 的入边数 量。该操作仅当 <tt>bidirectionalS</tt> 被指定为 <tt>Directed</tt> 模板参数时 可用。
<hr> -<pre> -vertices_size_type -num_vertices(const reverse_graph& g) -</pre> -Returns the number of vertices in the graph <tt>g</tt>.+<pre>vertices_size_type<br>num_vertices(const reverse_graph& g)<br></pre>返回图 <tt>g</tt> 中的顶点数。
<hr> -<pre> -vertex_descriptor -vertex(vertices_size_type n, const reverse_graph& g) -</pre> -Returns the nth vertex in the graph's vertex list.+<pre>vertex_descriptor<br>vertex(vertices_size_type n, const reverse_graph& g)<br></pre>返回该图的顶点列表中的第 n 个 顶点。
<hr> -<pre> -std::pair<edge_descriptor, bool> -edge(vertex_descriptor u, vertex_descriptor v, - const reverse_graph& g) -</pre> -Returns the edge connecting vertex <tt>u</tt> to vertex <tt>v</tt> in -graph <tt>g</tt>.+<pre>std::pair<edge_descriptor, bool><br>edge(vertex_descriptor u, vertex_descriptor v,<br> const reverse_graph& g)<br></pre>返回在图 <tt>g</tt> 中连接顶 点 <tt>u</tt> 至顶点 <tt>v</tt> 的边。
<hr> -<pre> -template <class <a href="./PropertyTag.html">PropertyTag</a>> -property_map<reverse_graph, PropertyTag>::type -get(PropertyTag, reverse_graph& g) - -template <class <a href="./PropertyTag.html">PropertyTag</a>> -property_map<reverse_graph, Tag>::const_type -get(PropertyTag, const reverse_graph& g) -</pre> -Returns the property map object for the vertex property specified by -<TT>PropertyTag</TT>. The <TT>PropertyTag</TT> must match one of the -properties specified in the graph's <TT>VertexProperty</TT> template -argument.+<pre>template <class <a href="./PropertyTag.html">PropertyTag</a>><br>property_map<reverse_graph, PropertyTag>::type<br>get(PropertyTag, reverse_graph& g)<br><br>template <class <a href="./PropertyTag.html">PropertyTag</a>><br>property_map<reverse_graph, Tag>::const_type<br>get(PropertyTag, const reverse_graph& g)<br></pre>返回由 +<tt>PropertyTag</tt> 指定的顶点属性或边属性的属性映射对象。 <tt>PropertyTag</tt> 必须与在该图的 <tt>VertexProperty</tt>
+ 模板参数中所指定的某一个属性相匹配。 <hr> -<pre>-template <class <a href="./PropertyTag.html">PropertyTag</a>, class X> -typename property_traits<property_map<reverse_graph, PropertyTag>::const_type>::value_type
-get(PropertyTag, const reverse_graph& g, X x) -</pre> -This returns the property value for <tt>x</tt>, which is either -a vertex or edge descriptor.+<pre>template <class <a href="./PropertyTag.html">PropertyTag</a>, class X><br>typename property_traits<property_map<reverse_graph, PropertyTag>::const_type>::value_type<br>get(PropertyTag, const reverse_graph& g, X x)<br></pre>返回 <tt>x</tt> 的属性值,它是一个 顶点描述符或边描述符。
<hr> -<pre>-template <class <a href="./PropertyTag.html">PropertyTag</a>, class X, class Value>
-void -put(PropertyTag, const reverse_graph& g, X x, const Value& value) -</pre> -This sets the property value for <tt>x</tt> to -<tt>value</tt>. <tt>x</tt> is either a vertex or edge descriptor. -<tt>Value</tt> must be convertible to-<tt>typename property_traits<property_map<reverse_graph, PropertyTag>::type>::value_type</tt> +<pre>template <class <a href="./PropertyTag.html">PropertyTag</a>, class X, class Value><br>void<br>put(PropertyTag, const reverse_graph& g, X x, const Value& value)<br></pre>将 <tt>x</tt> 的 属性值设置为 +<tt>value</tt>。<tt>x</tt> 是一个顶点描述符或边描述符。<tt>Value</tt> 必须 可以转换为 +<tt>typename property_traits<property_map<reverse_graph, PropertyTag>::type&gt::value_type</tt>
<hr> -<pre>-template <class GraphProperties, class <a href="./PropertyTag.html#GraphPropertyTag">GraphPropertyTag</a>>
-typename property_value<GraphProperties, GraphPropertyTag>::type& -get_property(reverse_graph& g, GraphPropertyTag); -</pre> -Return the property specified by <tt>GraphPropertyTag</tt> that is -attached to the graph object <tt>g</tt>. The <tt>property_value</tt> -traits class is defined in <a -href="../../../boost/pending/property.hpp"><tt>boost/pending/property.hpp</tt></a>.+<pre>template <class GraphProperties, class <a href="./PropertyTag.html#GraphPropertyTag">GraphPropertyTag</a>><br>typename property_value<GraphProperties, GraphPropertyTag>::type&<br>get_property(reverse_graph& g, GraphPropertyTag);<br></pre>返回由 <tt>GraphPropertyTag</tt> 所指定的关联至 图对象 <tt>g</tt> 的属性。该 <tt>property_value</tt> traits 类定义于 <a href="../../../boost/pending/property.hpp"><tt>boost/pending/property.hpp</tt></a>.
<hr> -<pre>-template <class GraphProperties, class <a href="./PropertyTag.html#GraphPropertyTag">GraphPropertyTag</a>> -const typename property_value<GraphProperties, GraphPropertyTag>::type&
-get_property(const reverse_graph& g, GraphPropertyTag); -</pre> -Return the property specified by <tt>GraphPropertyTag</tt> that is -attached to the graph object <tt>g</tt>. The <tt>property_value</tt> -traits class is defined in <a -href="../../../boost/pending/property.hpp"><tt>boost/pending/property.hpp</tt></a>.+<pre>template <class GraphProperties, class <a href="./PropertyTag.html#GraphPropertyTag">GraphPropertyTag</a>><br>const typename property_value<GraphProperties, GraphPropertyTag>::type&<br>get_property(const reverse_graph& g, GraphPropertyTag);<br></pre>返回由 <tt>GraphPropertyTag</tt> 所指定的关联至 图对象 <tt>g</tt> 的属性。该 <tt>property_value</tt> traits 类定义于 <a href="../../../boost/pending/property.hpp"><tt>boost/pending/property.hpp</tt></a>.
<hr> <br> -<HR> -<TABLE> -<TR valign=top> -<TD nowrap>Copyright © 2000-2001</TD><TD> -<a HREF="http://www.boost.org/people/dave_abrahams.htm";>Dave Abrahams</a> -(<A HREF="mailto:david.abrahams@xxxxxxx";>david.abrahams@xxxxxxx</A>)<br> -<A HREF="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</A>, -Indiana University (<A -HREF="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</A>)<br> -</TD></TR></TABLE> - -</BODY> -</HTML> +<hr> +<table> +<tbody><tr valign="top"> +<td nowrap="nowrap">Copyright (c) 2000-2001</td><td> +<a href="http://www.boost.org/people/dave_abrahams.htm";>Dave Abrahams</a> +(<a href="mailto:david.abrahams@xxxxxxx";>david.abrahams@xxxxxxx</a>)<br> +<a href="http://www.boost.org/people/jeremy_siek.htm";>Jeremy Siek</a>,+Indiana University (<a href="mailto:jsiek@xxxxxxxxxx";>jsiek@xxxxxxxxxx</a>)<br>
+</td></tr></tbody></table> + +</body></html> ======================================= --- /trunk/libs/graph/doc/stanford_graph.html Mon Jun 1 21:27:33 2009 +++ /trunk/libs/graph/doc/stanford_graph.html Thu Jul 23 20:28:01 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) 2001, Andreas Scherer, Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine @@ -7,396 +7,236 @@ -- (See accompanying file LICENSE_1_0.txt or copy at -- http://www.boost.org/LICENSE_1_0.txt) --> -<Head> -<Title>Boost Graph Library: Stanford Graph Interface</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> -Using SGB Graphs in BGL -</H1> - -The Boost Graph Library (BGL) header, <a -href="../../../boost/graph/stanford_graph.hpp" -><tt><boost/graph/stanford_graph.hpp></tt></a>, adapts a -Stanford GraphBase (SGB) <tt>Graph</tt> pointer into a BGL-compatible -<a href="./VertexListGraph.html">VertexListGraph</a>. Note that -a graph adaptor <b>class</b> is <i>not</i> used; SGB's <tt>Graph*</tt> -itself becomes a model of VertexListGraph. The VertexListGraph -concept is fulfilled by defining the appropriate non-member functions -for <tt>Graph*</tt>. - -<H2><a name="sec:SGB"></a> +<title>Boost Graph Library: Stanford Graph Interface</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>+Using SGB Graphs in BGL 在BGL中使用 SGB 图</h1>BGL头文件 <a href="../../../boost/graph/stanford_graph.hpp"><tt><boost/graph/stanford_graph.hpp></tt></a> 将一个
+Stanford GraphBase (SGB) <tt>图指针适配到一个</tt>BGL-兼容的+<a href="./VertexListGraph.html">点列表图VertexListGraph</a>。注意,这里没 有使用一个图适配器类,SGB的 <tt>Graph*</tt> +本身变成 点列表图VertexListGraph 的模型。通过为 <tt>Graph*</tt> 定义适当的 非成员函数,以符合 点列表图VertexListGraph
+概念。 + +<h2><a name="sec:SGB"></a> The Stanford GraphBase -</H2> - -<P> -"The <a href="http://www-cs-staff.stanford.edu/~knuth/sgb.html";>Stanford -GraphBase</a> (SGB) is a collection of datasets and computer programs that-generate and examine a wide variety of graphs and networks." The SGB was
-developed and published by -<a href="http://www-cs-staff.stanford.edu/~knuth";>Donald E. Knuth</a>-in 1993. The fully documented source code is available for anonymous ftp
-from <a href="ftp://labrea.stanford.edu/pub/sgb/sgb.tar.gz";>Stanford -University</a> and in the book "The Stanford GraphBase, A Platform for -Combinatorial Computing," published jointly by ACM Press and Addison-Wesley -Publishing Company in 1993. (This book contains several chapters with -additional information not available in the electronic distribution.) - -<H3><a name="sec:CWEB"></a> -Prerequisites -</H3> - -The source code of SGB is written in accordance with the rules of the -<a href="http://www-cs-staff.stanford.edu/~knuth/lp.html";>Literate-Programming</a> paradigm, so you need to make sure that your computer supports
-the <a href="http://www-cs-staff.stanford.edu/~knuth/cweb.html";>CWEB</a> -system. The CWEB sources are available for anonymous ftp from +</h2> + +<p> +"<a href="http://www-cs-staff.stanford.edu/%7Eknuth/sgb.html";>Stanford+GraphBase</a> (SGB) 是一组数据集和计算机程序,它们生成并检查各种各样的图和 网络。" SGB 是由
+<a href="http://www-cs-staff.stanford.edu/%7Eknuth";>Donald E. Knuth</a>+在1993年开发并发布的。完整的带文档的源码可以从 <a href="ftp://labrea.stanford.edu/pub/sgb/sgb.tar.gz";>Stanford
+University</a> 的匿名FTP获得,也可以在由 ACM Press 和 Addison-Wesley +Publishing Company 在1993年出版的 "The Stanford GraphBase, A Platform for +Combinatorial Computing," 一书中找到(该书中有几章内容是电子版中没有的)。 + +</p><h3><a name="sec:CWEB"></a> +Prerequisites 先决条件 +</h3>SGB的源码是按照+<a href="http://www-cs-staff.stanford.edu/%7Eknuth/lp.html";>文字编程 Literate +Programming</a> 的范式编写的,所以你需要确认你的计算机支持 <a href="http://www-cs-staff.stanford.edu/%7Eknuth/cweb.html";>CWEB</a>
+系统。CWEB源码可以从 <a href="ftp://labrea.stanford.edu/pub/cweb/cweb.tar.gz";>Stanford -University</a>. Bootstrapping CWEB on Unix systems is elementary and -documented in the CWEB distribution; pre-compiled binary executables of the -CWEB tools for Win32 systems are available from-<a href="http://www.literateprogramming.com";>www.literateprogramming.com</a>.
- -<H3><a name="sec:SGB:Installation"></a> -Installing the SGB -</H3> - -After you have acquired the <a href="#sec:SGB">SGB sources</a> and have -installed a working <a href="#sec:CWEB">CWEB system</a> (at least the -"ctangle" processor is required), you're almost set for compiling the SGB -sources. SGB is written in "old-style C," but the Boost Graph Library-expects to handle "modern C" and C++. Fortunately, the SGB distribution
-comes with an appropriate set of patches that convert all the sources from -"KR-C" to "ANSI-C," thus allowing for smooth integration of the Stanford -GraphBase in the Boost Graph Library. -+University</a> 匿名FTP。在Unix系统上的CWEB自举很容易,并且在CWEB分发包中有 文档记录;Win32系统上的CWEB工具的二进制可执行文件的预编译可在 +<a href="http://www.literateprogramming.com";>www.literateprogramming.com</a> 上 找到。
+ +<h3><a name="sec:SGB:Installation"></a> +Installing the SGB 安装SGB+</h3>在获得 <a href="#sec:SGB">SGB 源码</a> 并已安装了一个可用的 <a href="#sec:CWEB">CWEB 系统</a>
+(至少要求 +"ctangle"+处理器)后,你就基本完成编译SGB源码的设置了。SGB是以"旧的C风格"来编写的,而 BGL要的是"现代的C"和C++。幸好,SGB发布包配备了一 +套适当的修补程序来将所有源码从"KR-C"转换为"ANSI-C",从而顺利地将SGB整合到 BGL中。
<ul> <li> -<b>Unix</b>: After extracting the SGB archive, but prior to invoking -"<tt>make tests</tt>" and "<tt>make install</tt>," you should say-"<tt>ln -s PROTOTYPES/*.ch .</tt>" in the root directory where you extracted
-the SGB files (or you can simply copy the change files next to the proper-source files). The Unix <tt>Makefile</tt> coming with SGB conveniently
-looks for "change files" matching the SGB source files and automatically -applies them with the "ctangle" processor. The resulting C files will -smoothly run through the compiler. +<b>Unix</b>: 解压了 SGB 文件之后,在执行+"<tt>make tests</tt>" 和 "<tt>make install</tt>" 之前,你要在解压 SGB 文件 的根目录中执行 +"<tt>ln -s PROTOTYPES/*.ch .</tt>" (或者你可以只将有修改的文件复制到正确的 源文件处)。随SGB一起的 Unix <tt>Makefile</tt> 会查找与SGB源文件相匹配 的"change files"并自动将它们应用于"ctangle"处理器。所得的 C 文件将顺利通过编 译。
</li> <li> -<b>Win32</b>: The "MSVC" subdirectory of the SGB distribution contains a -complete set of "Developer Studio Projects" (and a single "Workspace"),-applicable with Microsoft Developer Studio 6. The installation process -is documented in the accompanying file <tt>README.MSVC</tt>. The "MSVC" -contribution has been updated to make use of the "PROTOTYPES" as well, so you
-don't need to worry about that.+<b>Win32</b>: SGB分发包中的 "MSVC" 子目录包含了完整的一组 "Developer Studio Projects" (和单个 "Workspace"),适用于 Microsoft Developer Studio 6。 安装过程在所附文件 <tt>README.MSVC</tt> 中说明。"MSVC"
+的贡献已经被更新,以同时利用 "PROTOTYPES",因此你不必担心。 </li> </ul> -<H3><a name="sec:UsingSGB"></a> -Using the SGB -</H3> - -After you have run <a href="#sec:SGB:Installation">the installation -process</a> of the SGB, you can use the BGL graph interface with the -SGB <tt>Graph*</tt>, <a href="../../../boost/graph/stanford_graph.hpp" -><tt><boost/graph/stanford_graph.hpp></tt></a>, which will be -described <a href="#sec:BGL:Interface">next</a>. All you have to -do is tell the C++ compiler where to look for the SGB headerfiles (by -default, <tt>/usr/local/sgb/include</tt> on Unix and the "MSVC" -subdirectory of the SGB installation on Win32) and the linker where to -find the SGB static library file (<tt>libgb.a</tt> on Unix and -<tt>libgb.lib</tt> on Win32); consult the documentation of your -particular compiler about how to do that. - -<H3><a name="sec:SGB:Problems"></a> -Technicalities -</H3> +<h3><a name="sec:UsingSGB"></a> +Using the SGB 使用SGB+</h3>在运行了SGB的 <a href="#sec:SGB:Installation">安装过程</a> 之后,你就 可以使用 +SGB <tt>Graph*</tt> 的BGL接口,<a href="../../../boost/graph/stanford_graph.hpp"><tt><boost/graph/stanford_graph.hpp></tt></a>,具 体说明 <a href="#sec:BGL:Interface">见后</a>。你所要做的就是,告诉C++编译器 去何处寻找SGB头文件(缺省是在Unix的 <tt>/usr/local/sgb/include</tt> 目录或 Win32的SGB安装目录下的 "MSVC" +子目录),以及告诉链接器去何处寻找SGB静态库文件(Unix上是 <tt>libgb.a</tt>,Win32上是
+<tt>libgb.lib</tt>);至于在你的特定编译器上要如何做,请参考相关文档。 + +<h3><a name="sec:SGB:Problems"></a> +Technicalities 技术性 +</h3> <ul> <li> -<b>Headerfile selection</b>: The two SGB modules <tt>gb_graph</tt> and-<tt>gb_io</tt> use the preprocessor switch <tt>SYSV</tt> to select either the -headerfile <tt><string.h></tt> (if <tt>SYSV</tt> is <tt>#define</tt>d) -or the headerfile <tt><strings.h></tt> (if <tt>SYSV</tt> is <i>not</i>
-<tt>#define</tt>d). Some compilers, like <tt>gcc</tt>/<tt>g++</tt>, -don't care much (<tt>gcc</tt> "knows" about the "string" functions without-refering to <tt><string.h></tt>), but others, like MSVC on Win32, do (so
-all "Developer Studio Projects" in the "MSVC" subdirectory of the-<a href="#sec:SGB">SGB distribution</a> appropriately define <tt>SYSV</tt>). -You should be careful to set (or not) <tt>SYSV</tt> according to the needs of
-your compiler. +<b>头文件选择:</b>有两个SGB模块,<tt>gb_graph</tt> 和+<tt>gb_io</tt>,使用了预处理器开关 <tt>SYSV</tt> 来选择头文件 <tt><string.h></tt> (若 <tt>SYSV</tt> 被 <tt>#define</tt>d)
+或头文件 <tt><strings.h></tt> (若 <tt>SYSV</tt> 未+<tt>#define</tt>d)。有些编译器,如 <tt>gcc</tt>/<tt>g++</tt>,并不关心这一 点(<tt>gcc</tt>无需 <tt><string.h></tt> 也"知道" "string" 函数 <tt></tt>),但是其它编译器,如Win32的 MSVC,则在乎(因此 +<a href="stanford_graph.html#sec:SGB">SGB 发布包</a> 的"MVSC"子目录下的所 有 "Developer Studio Projects" 都正确地定义了<a href="#sec:SGB"></a> <tt>SYSV</tt>)。你应当小心地根据编译器的需要来设定(或不设定) <tt>SYSV</tt>。
</li> <li> -<b>Missing include guards</b>: None of the SGB headerfiles uses "internal -include guards" to protect itself from multiple inclusion. To avoid -trouble, you must <i>not</i> <tt>#include</tt> any of the SGB headerfiles -before or after <a href="#sec:Wrapper">the BGL wrapper</a> in a compilation -unit; it will fully suffice to use the BGL interface.+<b>没有包含防护:</b>SGB头文件都没有使用 "内部包含防护" 来防止自己被多次包 含。为了避免麻烦,你必须不要在一个编译器单元中的 <a href="#sec:Wrapper">BGL 包围</a> 的之前或之后 <tt>#include</tt> 任何的 SGB头文件;这样就可充分地使用BGL接口。
</li> <li> -<b>Preprocessor macros</b>: The SGB headerfiles make liberal use of the -preprocessor <i>without</i> sticking to a particular convention (like -all-uppercase names or a particular prefix). At the time of writing, -already three of these preprocessor macros collide with the conventions of -either C++, g++, or BGL, and are fixed in <a href="#sec:Wrapper">the BGL -wrapper</a>. We can not guarantee that no other preprocessor-induced -problems may arise (but we are willing to learn about any such collisions).+<b>预处理器宏:</b>SGB头文件非常随意地使用预处理器,没有某种特定的约定(如全 大写的名字或特定的前缀)。在编写本文之时,已有三个预处理宏与 C++, g++, 或 BGL 的约定相冲突,并已在 <a href="#sec:Wrapper">BGL +包围</a> 中修正。我们不能保证没有其它的预处理器相关问题发生(不过我们愿意了 解任何此类的冲突)。
</li> </ul> -<H2><a name="sec:BGL:Interface"></a> -The BGL Interface for the SGB -</H2> - -<H3><a name="sec:Wrapper"></a> -Where Defined -</H3> - -<a href="../../../boost/graph/stanford_graph.hpp" -><tt><boost/graph/stanford_graph.hpp></tt></a> - -<p> The main purpose of this Boost Graph Library (BGL) headerfile is to -<tt>#include</tt> all global definitions for the general stuff of the-<a href="#sec:SGB">Stanford GraphBase</a> (SGB) and its various graph generator -functions by reading all <a href="#sec:SGB:Problems">SGB headerfiles</a> as in
-section 2 of the "<tt>test_sample</tt>" program. - -<p> On top of the SGB stuff, the BGL <tt>stanford_graph.hpp</tt> -header adds and defines appropriate types and functions for using the -SGB graphs in the BGL framework. Apart from the improved -interface, the <a href="#sec:UsingSGB">SGB (static) library</a> is -used "as is" in the context of BGL. - -<H3> -Model Of -</H3> - -<a href="./VertexListGraph.html">Vertex List Graph</a> and <a -href="./PropertyGraph.html">Property Graph</a>. The set of property -tags that can be used with the SGB graph is described in the <a -href="#properties">Vertex and Edge Properties</a> section below. +<h2><a name="sec:BGL:Interface"></a> +The BGL Interface for the SGB 用于SGB的BGL接口 +</h2> + +<h3><a name="sec:Wrapper"></a> +Where Defined 定义于 +</h3> ++<a href="../../../boost/graph/stanford_graph.hpp"><tt><boost/graph/stanford_graph.hpp></tt></a>
+ +<p>这个BGL头文件的主要目的是,<tt>#include</tt> 用于+<a href="#sec:SGB">Stanford GraphBase</a> (SGB)通用内容及其各种图生成器函数 的所有全局定义,通过象 "<tt>test_sample</tt>" 程序的第2节中那样读入所有 <a href="stanford_graph.html#sec:SGB:Problems">SGB 头文件</a>。
+ +</p><p>在 SGB 的顶层,BGL的 <tt>stanford_graph.hpp</tt> +头文件增加并定义了适当的类型和函数,以便在BGL框架中使用+SGB 图。除了改进的接口,<a href="#sec:UsingSGB">SGB (静态)库</a> 就象在 BGL上下文中一样被使用。
+ +</p><h3> +Model Of 以...为模型 +</h3> ++<a href="./VertexListGraph.html">点列表图Vertex List Graph</a> 和 <a href="./PropertyGraph.html">属性图Property Graph</a>。可以用于SGB图的属性标 签集在后面的 <a href="#properties">顶点属性与边属性</a> 一节中介绍。
-<H3><a name="sec:Example"></a> -Example -</H3> - -The example program <a href="../example/miles_span.cpp"> -<tt><example/miles_span.cpp></tt></a> represents the first -application of the generic framework of BGL to an SGB graph. It -uses Prim's algorithm to solve the "minimum spanning tree" -problem. In addition, the programs <a -href="../../../libs/graph/example/girth.cpp"> -<tt><example/girth.cpp></tt></a> and <a -href="../example/roget_components.cpp"> -<tt><example/roget_components.cpp></tt></a> have been ported -from the SGB. We intend to implement more algorithms from SGB in -a generic fashion and to provide the remaining example programs of SGB -for the BGL framework. If you would like to help, feel free to -submit your contributions! - -<H3> -Associated Types -</H3> +<h3><a name="sec:Example"></a> +Example 示例 +</h3>示例程序 <a href="../example/miles_span.cpp">+<tt><example/miles_span.cpp></tt></a> 是将BGL泛型框架用于SGB图的第一 个应用。它使用 Prim's 算法来解决"最小生成树"问题。此外,程序 <a href="../../../libs/graph/example/girth.cpp"> +<tt><example/girth.cpp></tt></a> 和 <a href="../example/roget_components.cpp"> +<tt><example/roget_components.cpp></tt></a> 也是从SGB移植过来的。我们 打算将更多来自SGB的算法实现为泛型风格,并为BGL框架提供其余的SGB例程。如果你 愿意帮助我们,请随时提交你的贡献!
+ +<h3> +Associated Types 关联类型 +</h3> <hr> -<tt>graph_traits<Graph*>::vertex_descriptor</tt><br><br> -The type for the vertex descriptors associated with the <tt>Graph*</tt>. -We use the type <tt>Vertex*</tt> as the vertex descriptor.+<tt>graph_traits<Graph*>::vertex_descriptor</tt><br><br>与 <tt>Graph*</tt> 相关联的顶点描述符类型。我们以类型 <tt>Vertex*</tt> 作为顶点 描述符。
<hr> -<tt>graph_traits<Graph*>::edge_descriptor</tt><br><br> The type -for the edge descriptors associated with the <tt>Graph*</tt>. This is -the type <tt>boost::sgb_edge</tt>. In addition to supporting all the -required operations of a BGL edge descriptor, the -<tt>boost::sgb_edge</tt> class has the following constructor. -<pre> - sgb_edge::sgb_edge(Arc* arc, Vertex* source) -</pre>+<tt>graph_traits<Graph*>::edge_descriptor</tt><br><br>与 <tt>Graph*</tt> 相关联的边描述符类型。即类型 <tt>boost::sgb_edge</tt>。除了 支持BGL边描述符所要求的所有操作之外,<tt>boost::sgb_edge</tt> 类还有以下构造 函数。
+<pre> sgb_edge::sgb_edge(Arc* arc, Vertex* source)<br></pre> <hr> -<tt>graph_traits<Graph*>::vertex_iterator</tt><br><br> -The type for the iterators returned by <tt>vertices()</tt>.+<tt>graph_traits<Graph*>::vertex_iterator</tt><br><br>由 <tt>vertices()</tt> 返回的迭代器类型。
<hr> -<tt>graph_traits<Graph*>::out_edge_iterator</tt><br><br> -The type for the iterators returned by <tt>out_edges()</tt>.+<tt>graph_traits<Graph*>::out_edge_iterator</tt><br><br>由 <tt>out_edges()</tt> 返回的迭代器类型。
<hr> -<tt>graph_traits<Graph*>::adjacency_iterator</tt><br><br> -The type for the iterators returned by <tt>adjacent_vertices()</tt>.+<tt>graph_traits<Graph*>::adjacency_iterator</tt><br><br>由 <tt>adjacent_vertices()</tt> 返回的迭代器类型。
<hr> -<tt>graph_traits<Graph*>::vertices_size_type</tt><br><br> -The type used for dealing with the number of vertices in the graph.+<tt>graph_traits<Graph*>::vertices_size_type</tt><br><br>用于处理图中 顶点数量的类型。
<hr> -<tt>graph_traits<Graph*>::edge_size_type</tt><br><br> -The type used for dealing with the number of edges in the graph.+<tt>graph_traits<Graph*>::edge_size_type</tt><br><br>用于处理图中边数 量的类型。
+ + + + <hr> -<tt>graph_traits<Graph*>::degree_size_type</tt><br><br> -The type used for dealing with the number of edges incident to a vertex -in the graph.+<tt>graph_traits<Graph*>::degree_size_type</tt><br><br>用于处理单个顶 点的出边数量的类型。
<hr> -<tt>graph_traits<Graph*>::directed_category</tt><br><br> -Provides information about whether the graph is directed or -undirected. An SGB <tt>Graph*</tt> is directed so this type is -<tt>directed_tag</tt>.+<tt>graph_traits<Graph*>::directed_category</tt><br><br>提供关于该图 是有向图还是无向图的信息。SGB <tt>Graph*</tt> 是有向的,因此该类型为
+<tt>directed_tag</tt>。 <hr> <tt>graph_traits<Graph*>::traversal_category</tt><br><br> -An SGB <tt>Graph*</tt> provides traversal of the vertex set, -out edges, and adjacent vertices. Therefore the traversal category -tag is defined as follows: -<pre> -struct sgb_traversal_tag : - public virtual vertex_list_graph_tag, - public virtual incidence_graph_tag, - public virtual adjacency_graph_tag { }; -</pre>+SGB <tt>Graph*</tt> 提供了顶点集、出边和邻接顶点的遍历。因此遍历类别标签定 义如下: +<pre>struct sgb_traversal_tag :<br> public virtual vertex_list_graph_tag,<br> public virtual incidence_graph_tag,<br> public virtual adjacency_graph_tag { };<br></pre>
<hr> -<tt>graph_traits<Graph*>::edge_parallel_category</tt><br><br>-This describes whether the graph class allows the insertion of parallel edges
-(edges with the same source and target). The SGB <tt>Graph*</tt> -does not prevent addition of parallel edges, so this type -is <tt>allow_parallel_edge_tag</tt>.+<tt>graph_traits<Graph*>::edge_parallel_category</tt><br><br>用于说明 该图类是否允许插入平行边(具有相同源及目标的边)。SGB <tt>Graph*</tt>
+不阻止加入平行边,因此该类型为 <tt>allow_parallel_edge_tag</tt>。 <hr> -<H3> -Non-Member Functions -</H3> +<h3> +Non-Member Functions 非成员函数 +</h3> <hr> -<pre> -std::pair<vertex_iterator, vertex_iterator> -vertices(Graph* g) -</pre> -Returns an iterator-range providing access to the vertex set of graph -<tt>g</tt>.+<pre>std::pair<vertex_iterator, vertex_iterator><br>vertices(Graph* g)<br></pre>返 回 一个迭代器区间,提供对图 <tt>g</tt> 的顶点集的访问。
<hr> -<pre> -std::pair<out_edge_iterator, out_edge_iterator> -out_edges(vertex_descriptor v, Graph* g) -</pre> -Returns an iterator-range providing access to the out-edges of vertex -<tt>v</tt> in graph <tt>g</tt>.<br> -There is no corresponding <tt>in_edges</tt> function.+<pre>std::pair<out_edge_iterator, out_edge_iterator><br>out_edges(vertex_descriptor v, Graph* g)<br></pre>返 回一个迭代器区间,提供对图 <tt>g</tt> 的顶点 <tt>v</tt> 的出边的访问。<br>没有相对应的 <tt>in_edges</tt> 函数。
<hr> -<pre> -std::pair<adjacency_iterator, adjacency_iterator> -adjacent_vertices(vertex_descriptor v, Graph* g) -</pre>-Returns an iterator-range providing access to the adjacent vertices of vertex
-<tt>v</tt> in graph <tt>g</tt>.+<pre>std::pair<adjacency_iterator, adjacency_iterator><br>adjacent_vertices(vertex_descriptor v, Graph* g)<br></pre>返 回一个迭代器区间,提供对图 <tt>g</tt> 中顶点 <tt>v</tt> 的邻接顶点的访问。
<hr> -<pre> -vertex_descriptor -source(edge_descriptor e, Graph* g) -</pre> -Returns the source vertex of edge <tt>e</tt>.+<pre>vertex_descriptor<br>source(edge_descriptor e, Graph* g)<br></pre>返回边 <tt>e</tt> 的源顶点。
<hr> -<pre> -vertex_descriptor -target(edge_descriptor e, Graph* g) -</pre> -Returns the target vertex of edge <tt>e</tt>.+<pre>vertex_descriptor<br>target(edge_descriptor e, Graph* g)<br></pre>返回边 <tt>e</tt> 的目标顶点。
<hr> -<pre> -degree_size_type -out_degree(vertex_descriptor v, Graph* g) -</pre> -Returns the number of edges leaving vertex <tt>v</tt>.<br> -There is no corresponding <tt>in_degree</tt> function.+<pre>degree_size_type<br>out_degree(vertex_descriptor v, Graph* g)<br></pre>返回顶点 <tt>v</tt> 的出边数量。 <br>没有相对应 的 <tt>in_degree</tt> 函数。
<hr> -<pre> -vertices_size_type -num_vertices(Graph* g) -</pre> -Returns the number of vertices in the graph <tt>g</tt>.+<pre>vertices_size_type<br>num_vertices(Graph* g)<br></pre>返回在图 <tt>g</tt> 中的顶点数量。
<hr> -<pre> -edge_size_type -num_edges(Graph* g) -</pre> -Returns the number of edges in the graph <tt>g</tt>.+<pre>edge_size_type<br>num_edges(Graph* g)<br></pre>返回在图 <tt>g</tt> 中的边数量。
<hr> -<pre> -vertex_descriptor -vertex(vertices_size_type n, Graph* g) -</pre> -Returns the (0-based) nth vertex in the graph's vertex list.+<pre>vertex_descriptor<br>vertex(vertices_size_type n, Graph* g)<br></pre>返回该图顶点列表中第 n 个顶点(从0起计)。
<hr> -<pre> -template <class <a href="./PropertyTag.html">PropertyTag</a>> -property_map<Graph*, PropertyTag>::type -get(PropertyTag, Graph*& g) - -template <class <a href="./PropertyTag.html">PropertyTag</a>> -property_map<Graph*, Tag>::const_type -get(PropertyTag, const Graph*& g) -</pre> -Returns the property map object for the vertex property specified by -<TT>PropertyTag</TT>. The <TT>PropertyTag</TT> must be one of -the described below.+<pre>template <class <a href="./PropertyTag.html">PropertyTag</a>><br>property_map<Graph*, PropertyTag>::type<br>get(PropertyTag, Graph*& g)<br><br>template <class <a href="./PropertyTag.html">PropertyTag</a>><br>property_map<Graph*, Tag>::const_type<br>get(PropertyTag, const Graph*& g)<br></pre>返回由 +<tt>PropertyTag</tt> 指定的顶点属性的属性映射对象。<tt>PropertyTag</tt> 必 须是以下所描述的之一。
<hr> -<h3><a name="properties">Vertex and Edge Properties</a></h3> - -The SGB <tt>Vertex</tt> and <tt>Arc</tt> structures provide -"utility" fields for storing extra information. We provide -BGL wrappers that provide access to these fields through <a -href="../../property_map/property_map.html">property maps</a>. In -addition, vertex index and edge length maps are provided. A property -map object can be obtained from a SGB <tt>Graph*</tt> using the -<tt>get()</tt> function described in the <a -href="./PropertyGraph.html">Property Graph</a> concept. - -<p> -The following list of property tags can be used to specify which -utility field you would like a property map for.+<h3><a name="properties">Vertex and Edge Properties 顶点属性和边属性 </a></h3>SGB的 <tt>Vertex</tt> 和 <tt>Arc</tt> 结构提供了
+"utility" 域来存储额外的信息。我们提供了+BGL 包装,以通过 <a href="../../property_map/property_map.html">属性映射 </a> 提供对这些域的访问。此外,还提供了顶点索引和边长度的映射。可以使用在 <a href="./PropertyGraph.html">属性图Property Graph</a> 概念中描述的
+<tt>get()</tt> 函数从一个 SGB <tt>Graph*</tt> 获取属性映射对象。 + +<p>以下所列属性标签可用于指定你想以属性映射方式访问哪个 +utility 域。 </p> -<pre> -<i>// vertex properties</i> +<pre><i>// 顶点属性</i> template <class T> u_property; template <class T> v_property; template <class T> w_property; @@ -404,55 +244,39 @@ template <class T> y_property; template <class T> z_property; -<i>// edge properties</i> +<i>// 边属性</i> template <class T> a_property; template <class T> b_property; </pre> -<p> -The template parameter <tt>T</tt> for these tags is limited to the -types in the <tt>util</tt> union declared in the SGB header -<tt>gb_graph.h</tt>, which are <tt>Vertex*</tt>, <tt>Arc*</tt>, -<tt>Graph*</tt>, <tt>char*</tt>, and <tt>long</tt>. The property maps -for the utility fields are models of <a -href="../../property_map/LvaluePropertyMap.html">Lvalue Property -Map</a>. +<p>这些标签中的模板参数 <tt>T</tt> 必须是在SGB头文件+<tt>gb_graph.h</tt> 的 <tt>util</tt> union 中所声明的类型 <tt></tt>,即 <tt>Vertex*</tt>, <tt>Arc*</tt>, +<tt>Graph*</tt>, <tt>char*</tt>, 和 <tt>long</tt>。用于 utility 域的属性映 射为 <a href="../../property_map/LvaluePropertyMap.html">左值属性映射Lvalue Property
+Map</a>。 </p> -<p> -The property map for vertex indices can be obtained using the -<tt>vertex_index_t</tt> tag, and this property map is a <a -href="../../property_map/ReadablePropertyMap.html">Readable Property -Map</a>. A property map for edge length's can be obtained using the -<tt>edge_length_t</tt> tag, and this property map is a <a -href="../../property_map/LvaluePropertyMap.html">Lvalue Property -Map</a> whose value type is <tt>long</tt>. +<p>顶点索引的属性映射可以用+<tt>vertex_index_t</tt> 标签获取,该属性映射为 <a href="../../property_map/ReadablePropertyMap.html">可读属性映射Readable Property
+Map</a>。边长度的属性映射则可以用+<tt>edge_length_t</tt> 标签获取,它是 <a href="../../property_map/LvaluePropertyMap.html">左值属性映射Lvalue Property
+Map</a> 且其值类型为 <tt>long</tt>。 </p> -<p> -Property map objects can be obtained via the <tt>get()</tt> function -of the Property Graph concept. The type of the property map is given -by the <a href="./property_map.html"><tt>property_map</tt></a> traits -class.</p>+<p>属性映射对象可以通过属性图概念的 <tt>get()</tt> 函数获得。属性映射的类型 由 <a href="./property_map.html"><tt>property_map</tt></a> traits 类给出。 </p>
-<HR> -<TABLE> -<TR valign=top> -<TD nowrap>Copyright © 2001</TD><TD> -<A HREF="http://people.freenet.de/andreas.scherer";>Andreas Scherer</A>, -Aachen (<A -HREF="mailto:andreas_freenet@xxxxxxxxxx";>andreas_freenet@xxxxxxxxxx</A>)<br> -<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> +<hr> +<table> +<tbody><tr valign="top"> +<td nowrap="nowrap">Copyright (c) 2001</td><td> +<a href="http://people.freenet.de/andreas.scherer";>Andreas Scherer</a>,+Aachen (<a href="mailto:andreas_freenet@xxxxxxxxxx";>andreas_freenet@xxxxxxxxxx</a>)<br>
+<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/subgraph.html Mon Mar 30 07:58:04 2009 +++ /trunk/libs/graph/doc/subgraph.html Thu Jul 23 20:28:01 2009 @@ -1,646 +1,279 @@ -<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: Subgraph</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:subgraph-class"></A> -<pre> -subgraph<Graph> -</pre> +<title>Boost Graph Library: Subgraph</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:subgraph-class"></a> +<pre>subgraph<Graph><br></pre> </h1> <!--The space consumption of the <tt>subgraph</tt> is quite high. We should change subgraph from representing induced subgraphs to just normal subgraphs (from talk with Steven North). --> -<p> -The subgraph class provides a mechanism for keeping track of a graph -and its subgraphs. A graph <i>G'</i> is a <i>subgraph</i> of a graph -<i>G</i> if the vertex set of <i>G'</i> is a subset of the vertex set -of <i>G</i> and if the edge set of <i>G'</i> is a subset of the edge -set of <i>G</i>. That is, if <i>G'=(V',E')</i> and <i>G=(V,E)</i>, -then <i>G'</i> is a subgraph of <i>G</i> if <i>V'</i> is a subset of -<i>V</i> and <i>E</i> is a subset of <i>E'</i>. An <i>induced -subgraph</i> is a subgraph formed by specifying a set of vertices -<i>V'</i> and then selecting all of the edges from the original graph -that connect two vertices in <i>V'</i>. So in this case <i>E' = {(u,v) -in E: u,v in V'}</i>. Figure 1 shows a graph <i>G<sub>0</sub></i> and -two subgraphs <i>G<sub>1</sub></i> and <i>G<sub>2</sub></i>. The edge -set for <i>G<sub>1</sub></i> is <i>E<sub>1</sub> = { (E,F), (C,F) -}</i> and the edge set for <i>G<sub>2</sub></i> is <i>E<sub>2</sub> = -{ (A,B) }</i>. Edges such as <i>(E,B)</i> and <i>(F,D)</i> that cross -out of a subgraph are not in the edge set of the subgraph.+<p>subgraph 类提供了一种跟踪一个图及其子图的机制。图 <i>G'</i> 被称为 <i></i>图 +<i>G</i> 的 <i>子图subgraph</i>,如果 <i>G'</i> 的顶点集是 <i>G</i> 的顶点 集的一个子集且 <i>G'</i> 的边集是 <i>G</i> 的边集的一个子集。即,给定 <i>G'=(V',E')</i> 和 <i>G=(V,E)</i>,如果 <i>V'</i> 是 +<i>V</i> 的一个子集且 <i>E'</i> 是 <i>E</i> 的一个子集,则 <i>G'</i> 是 <i>G</i> 的子图。<i>导出子图induced
+subgraph</i> 是这样形成的一个子图,指定一个顶点集+<i>V'</i>,然后从原图中选择连接 <i>V'</i> 中任两个顶点的所有边。所以在此情 况下,<i>E' = {(u,v) +in E: u,v in V'}</i>。图 1 示范了一个图 <i>G<sub>0</sub></i> 和两个子图 <i>G<sub>1</sub></i> 和 <i>G<sub>2</sub></i>。<i>G<sub>1</sub></i> 的边集是 <i>E<sub>1</sub> = { (E,F), (C,F)
+}</i>,而 <i>G<sub>2</sub></i> 的边集是 <i>E<sub>2</sub> =+{ (A,B) }</i>。象 <i>(E,B)</i> 和 <i>(F,D)</i> 这些连接两个子图的边不属于任 一子图的边集。
</p> -<P></P> -<DIV ALIGN="center"><A NAME="fig:subgraph-tree"></A> -<TABLE>-<CAPTION ALIGN="BOTTOM"><STRONG>Figure 1:</STRONG> A graph with nested subgraphs, maintained in a tree structure.</CAPTION>
-<TR><TD><IMG SRC="./figs/subgraph.gif"></TD> -<TD><IMG SRC="./figs/subgraph-tree.gif"></TD></TR> -</TABLE> -</DIV><P></P> - -<p>The <tt>subgraph</tt> class implements induced subgraphs. The main graph -and its subgraphs are maintained in a tree data structure. The main -graph is the root, and subgraphs are either children of the root or of -other subgraphs. All of the nodes in this tree, including the root -graph, are instances of the <tt>subgraph</tt> class. The -<tt>subgraph</tt> implementation ensures that each node in the tree is -an induced subgraph of its parent. The <tt>subgraph</tt> class -implements the BGL graph interface, so each subgraph object can be -treated as a graph.</p> - -<h3>Example</h3> - -The full source code for this example is in -<tt>example/subgraph.cpp</tt>. To create a graph and subgraphs, first -create the root graph object. Here we use <tt>adjacency_list</tt> as -the underlying graph implementation. The underlying graph type is -required to have <tt>vertex_index</tt> and <tt>edge_index</tt> -internal properties, so we add an edge index property to the adjacency -list. We do not need to add a vertex index properety because that is -built in to the <tt>adjacency_list</tt>. We will be building the graph -and subgraphs in Figure 1, so we will need a total of six vertices. - -<pre> -typedef adjacency_list_traits<vecS, vecS, directedS> Traits; -typedef subgraph< adjacency_list<vecS, vecS, directedS, - no_property, property<edge_index_t, int> > > Graph; - -const int N = 6; -Graph G0(N); - -enum { A, B, C, D, E, F}; // for conveniently refering to vertices in G0 -</pre> +<p></p> +<div align="center"><a name="fig:subgraph-tree"></a> +<table>+<caption align="bottom"><strong>图 1:</strong> 带有嵌套子图的图,用一个树结 构来维护。</caption>
+<tbody><tr><td><img src="./figs/subgraph.gif"></td> +<td><img src="./figs/subgraph-tree.gif"></td></tr> +</tbody></table> +</div> ++<p><tt>subgraph</tt> 类实现了导出子图。主图及其子图在一个树形数据结构中维 护。主图为树根,子图是根或其它子图的子节点。树中的所有节点,包括根图,都是 <tt>subgraph</tt> 类的实例。<tt>subgraph</tt> 实现确保了树中的每个节点都是其 父节点的一个导出子图。<tt>subgraph</tt> 类实现了BGL的图接口,因此每个子图对 象都可以被视作为一个图。</p>
+ +<h3>Example 示例</h3>这个例子的完整源码在+<tt>example/subgraph.cpp</tt>。要创建一个图和子图,首先要创建根图对象。这里 我们用 <tt>adjacency_list</tt> 作为底层的图实现。底层的图类型要求具有 <tt>vertex_index</tt> 和 <tt>edge_index</tt> +内部属性,因此我们为邻接表增加一个边索引属性。我们不用增加顶点索引属性,因 为在 <tt>adjacency_list</tt> 已经内建了。我们将构建图1中的图和子图,所以我们 总共需要6个顶点。
++<pre>typedef adjacency_list_traits<vecs ,="" vecs="" directeds=""> Traits;<br>typedef subgraph< adjacency_list<vecs ,="" vecs="" directeds="" no_property="" property=""><edge_index_t ,="" int=""> > > Graph;<br><br>const int N = 6;<br>Graph G0(N);<br><br>enum { A, B, C, D, E, F}; // 为了方便引用 G0 中的顶点 <br></edge_index_t></vecs></vecs></pre>
Next we create two empty subgraph objects, specifying <tt>G0</tt> as their parent. -<pre> -Graph& G1 = G0.create_subgraph(), G2 = G0.create_subgraph(); -enum { A1, B1, C2 }; // for conveniently refering to vertices in G1 -enum { A2, B2 }; // for conveniently refering to vertices in G2 -</pre> - -We can add vertices from the root graph to the subgraphs using the -<tt>add_vertex</tt> function. Since the graph implementation is -<tt>adjacency_list</tt> with <tt>VertexList=vecS</tt>, we can use the -integers (or in this case enums) in the range <i>[0,6)</i> as vertex -descriptors. - -<pre> -add_vertex(C, G1); // global vertex C becomes local A1 for G1 -add_vertex(E, G1); // global vertex E becomes local B1 for G1 -add_vertex(F, G1); // global vertex F becomes local C1 for G1 - -add_vertex(A, G2); // global vertex A becomes local A2 for G2 -add_vertex(B, G2); // global vertex B becomes local B2 for G2 -</pre> - -Next we can add edges to the main graph using the usual -<tt>add_edge</tt> function. - -<pre> -add_edge(A, B, G0); -add_edge(B, C, G0); -add_edge(B, D, G0); -add_edge(E, B, G0); -add_edge(E, F, G0); -add_edge(F, D, G0); -</pre> - -We can also add edges to subgraphs such as <tt>G1</tt> using the -<tt>add_edge</tt> function. Each subgraph has its own vertex and edge -descriptors, which we call <i>local</i> descriptors. We refer to root -graph's vertex and edge descriptors as the <i>global</i> -descriptors. Above, we used global vertex descriptors to add vertices -to the graph. However, most <tt>subgraph</tt> functions work with -local descriptors. So in the following call to <tt>add_edge</tt> we -add the edge <tt>(A1,C1)</tt> (or numerically <tt>(0,2)</tt>) which is -the local version (for subgraph <tt>G1</tt>) of the global edge -<tt>(C,F)</tt> (or numerically <tt>(2,5)</tt>). Adding an edge to a -subgraph causes the edge to also be added to all of its ancestors in -the subgraph tree to ensure that the subgraph property is maintained. - -<pre> -add_edge(A1, C1, G1); // (A1,C1) is subgraph G1 local indices - // for the global edge (C,F). -</pre>+<pre>Graph& G1 = G0.create_subgraph(), G2 = G0.create_subgraph();<br>enum { A1, B1, C2 }; // 为了方便引用 G1 中的顶点 <br>enum { A2, B2 }; // 为了方便引用 G2 中的顶点<br></pre>我们可以用 +<tt>add_vertex</tt> 函数从根图增加顶点到子图中。因为这里的图实现是带有 <tt>VertexList=vecS</tt> 的 +<tt>adjacency_list</tt>,所以我们可以用区间 <i>[0,6)</i> 中的整数(或是枚举 值)作为顶点描述符。
++<pre>add_vertex(C, G1); // 全局顶点 C 成为 G1 的局部顶点 A1<br>add_vertex(E, G1); // 全局顶点 E 成为 G1 的局部顶点 B1<br>add_vertex(F, G1); // 全局顶点 F 成为 G1 的局部顶点 C1<br><br>add_vertex(A, G2); // 全局顶点 A 成为 G2 的局部顶点 A2<br>add_vertex(B, G2); // 全局顶点 B 成为 G2 的局部顶点 B2<br></pre>接下 来,我们可以用
+<tt>add_edge</tt> 函数往主图中增加边。 ++<pre>add_edge(A, B, G0);<br>add_edge(B, C, G0);<br>add_edge(B, D, G0);<br>add_edge(E, B, G0);<br>add_edge(E, F, G0);<br>add_edge(F, D, G0);<br></pre>我们也可以用 +<tt>add_edge</tt> 函数往 G1 这样的子图中增加边。每个子图有它自己的顶点描述 符和边描述符,我们称之为<i>局部</i>描述符。我们称根图的顶点描述符和边描述符 为<i>全局</i>描述符。在前面,我们使用了全局顶点描述符来往图中增加顶点。不 过,多数子图函数是使用局部描述符的。因此,在以下的 <tt>add_edge</tt> 调用 中,我们增加了边 <tt>(A1,C1)</tt> (或用数字<tt>(0,2)</tt>),它是全局边 +<tt>(C,F)</tt> (<span style="font-family: monospace;">或用数字 </span><tt>(2,5)</tt>)的局部版本(用于子图<tt>G1</tt>)。往一个子图增加边会导 致该边同时被增加至该子图在子图树中的所有祖先中,以确保子图属性被保持。
++<pre>add_edge(A1, C1, G1); // (A1,C1) 是子图 G1 的局部索引 <br> // 对应于全局边 (C,F).<br></pre>
<!-----------------------------> -<h3>Where Defined</h3> +<h3>Where Defined 定义于</h3> <tt>boost/graph/subgraph.hpp</tt> <!-----------------------------> -<h3>Template Parameters</h3> - -<P> -<TABLE border> -<TR> +<h3>Template Parameters 模板参数</h3> + +<p> +<table border="1"> +<tbody><tr> <th>Parameter</th><th>Description</th> </tr> <tr><td><tt>Graph</tt> </td>-<td> A graph type modeling <a href="VertexMutableGraph.html">VertexMutableGraph</a>
- and <a href="EdgeMutableGraph.html">EdgeMutableGraph</a>. Also - the graph must have internal <tt>vertex_index</tt> and - <tt>edge_index</tt> properties. The vertex indices must be maintained - automatically by the graph, whereas the edge indices will be - assigned by the <tt>subgraph</tt> class implementation. </td>+<td>一个符合 <a href="VertexMutableGraph.html">顶点可变图 VertexMutableGraph</a> 和 <a href="EdgeMutableGraph.html">边可变图 EdgeMutableGraph</a> 的图类型。该图还必须具有内部的 <tt>vertex_index</tt> 和 + <tt>edge_index</tt> 属性。顶点索引必须由图自动维护,而边索引则被 <tt>subgraph</tt> 类实现赋值。 </td>
</tr> -</table> +</tbody></table> <!-----------------------------> -<h3>Model Of</h3> --<tt>subgraph</tt> is a model of <a href="VertexMutableGraph.html">VertexMutableGraph</a>. Also, if -the <tt>Graph</tt> type models <a href="VertexListGraph.html">VertexListGraph</a>, -<a href="EdgeListGraph.html">EdgeListGraph</a> and/or <a href="BidirectionalGraph.html">BidirectionalGraph</a>, then
-<tt>subgraph<Graph></tt> will also models these concepts. - -<!-----------------------------> -<h3>Associates Types</h3> - -If the graph is the root of the subgraph tree, then the vertex and -edge descriptors are both the local descriptors for the root graph, -and they are the global descriptors. If the graph is not the root, -then the descriptors are local descriptors for the subgraph. -The subgraph iterators are the same iterator types as the iterators of -the underlying <tt>Graph</tt> type. +</p><h3>Model Of 以...为模型</h3> ++<tt>subgraph</tt> 是符合 <a href="VertexMutableGraph.html">顶点可变图 VertexMutableGraph</a>。另外,如果 <tt>Graph</tt> 类型符合 <a href="VertexListGraph.html">点列表图VertexListGraph</a>, +<a href="EdgeListGraph.html">边列表图EdgeListGraph</a> 和/或 <a href="BidirectionalGraph.html">双向图BidirectionalGraph</a>,则 +<tt>subgraph<Graph></tt> 也符合这些概念。 <!-----------------------------> +<h3>Associates Types 关联类型</h3>如果一个图是子图树的根,那么它的顶点描述 符和边描述符既是根图的局部描述符,也是全局描述符。如果某个图不是根,则它的描 述符只是这个子图的局部描述符。子图的迭代器与底层的图类型的迭代器具有相同的迭 代器类型。
<hr> -<pre> -graph_traits<subgraph>::vertex_descriptor -</pre> - The type for the vertex descriptors. - (Required by <a href="Graph.html">Graph</a>.)+<pre>graph_traits<subgraph>::vertex_descriptor<br></pre>顶点描述符类 型。(<a href="Graph.html">图Graph</a> 的要求)
<hr> -<pre> -graph_traits<subgraph>::edge_descriptor -</pre> - The type for the edge descriptors. - (Required by <a href="Graph.html">Graph</a>.)+<pre>graph_traits<subgraph>::edge_descriptor<br></pre>边描述符类型。 (<a href="Graph.html">图Graph</a> 的要求)
<hr> -<pre> -graph_traits<subgraph>::vertex_iterator -</pre> - The type for the iterators returned by <tt>vertices</tt>. - (Required by <a href="VertexListGraph.html">VertexListGraph</a>.)+<pre>graph_traits<subgraph>::vertex_iterator<br></pre><tt>vertices</tt> 所 返回的迭代器类型。 (<a href="VertexListGraph.html">点列表图 VertexListGraph</a> 的要求)
<hr> -<pre> -graph_traits<subgraph>::edge_iterator -</pre> - The type for the iterators returned by <tt>edges</tt>. - (Required by <a href="EdgeListGraph.html">EdgeListGraph</a>.)+<pre>graph_traits<subgraph>::edge_iterator<br></pre><tt>edges</tt> 所 返回的迭代器类型。(<a href="EdgeListGraph.html">边列表图EdgeListGraph</a> 的 要求)
<hr> -<pre> -graph_traits<subgraph>::out_edge_iterator -</pre> - The type for the iterators returned by <tt>out_edges</tt>. - (Required by <a href="IncidenceGraph.html">IncidenceGraph</a>.)+<pre>graph_traits<subgraph>::out_edge_iterator<br></pre><tt>out_edges</tt> 所 返回的迭代器类型。(<a href="IncidenceGraph.html">关联图IncidenceGraph</a> 的要求)
<hr> -<pre> -graph_traits<subgraph>::in_edge_iterator -</pre> - The <tt>in_edge_iterator</tt> is the - iterator type returned by the <tt>in_edges</tt> function. - (Required by <a href="BidirectionalGraph.html">BidirectionalGraph</a>.)+<pre>graph_traits<subgraph>::in_edge_iterator<br></pre><tt>in_edge_iterator</tt> 是 <tt>in_edges</tt> 函数所返回的迭代器类型。(<a href="BidirectionalGraph.html">双向图BidirectionalGraph</a> 的要求)
<hr> -<pre> -graph_traits<subgraph>::adjacency_iterator -</pre> - The type for the iterators returned by <tt>adjacent_vertices</tt>. - (Required by <a href="AdjacencyGraph.html">AdjacencyGraph</a>.)+<pre>graph_traits<subgraph>::adjacency_iterator<br></pre><tt>adjacent_vertices</tt> 所 返回的迭代器类型。(<a href="AdjacencyGraph.html">邻接图AdjacencyGraph</a> 的要求)
<hr> -<pre> -graph_traits<subgraph>::directed_category -</pre> - Provides information about whether the graph is directed - (<tt>directed_tag</tt>) or undirected (<tt>undirected_tag</tt>). - (Required by <a href="Graph.html">Graph</a>.)+<pre>graph_traits<subgraph>::directed_category<br></pre>提供关于图是 有向的(<tt>directed_tag</tt>)或是无向的(<tt>undirected_tag</tt>)的信息。(<a href="Graph.html">图Graph</a> 的要求)
<hr> -<pre> -graph_traits<subgraph>::edge_parallel_category -</pre> - This describes whether the graph class allows the insertion of - parallel edges (edges with the same source and target), which - depends on the underlying <tt>Graph</tt> class. The two tags are - <tt>allow_parallel_edge_tag</tt> and+<pre>graph_traits<subgraph>::edge_parallel_category<br></pre>说明该图 类是否允许插入平行边(具有相同源和目标的边),这取决于底层的 <tt>Graph</tt> 类。可能的两个标签是 <tt>allow_parallel_edge_tag</tt> 和
<tt>disallow_parallel_edge_tag</tt>. - (Required by <a href="Graph.html">Graph</a>.) + (<a href="Graph.html">图Graph</a> 的要求) <hr> -<pre> -graph_traits<subgraph>::vertices_size_type -</pre> - The type used for dealing with the number of vertices in - the graph. - (Required by <a href="VertexListGraph.html">VertexListGraph</a>.)+<pre>graph_traits<subgraph>::vertices_size_type<br></pre>用于处理图中 顶点数量的类型。(<a href="VertexListGraph.html">点列表图VertexListGraph</a> 的要求)
<hr> -<pre> -graph_traits<subgraph>::edges_size_type -</pre> - The type used for dealing with the number of edges in the graph. - (Required by <a href="EdgeListGraph.html">EdgeListGraph</a>.)+<pre>graph_traits<subgraph>::edges_size_type<br></pre>用于处理图中边 数量的类型。(<a href="EdgeListGraph.html">边列表图EdgeListGraph</a> 的要求)
<hr> -<pre> -graph_traits<subgraph>::degree_size_type -</pre> - The type used for dealing with the number of out-edges of a vertex. - (Required by <a href="IncidenceGraph.html">IncidenceGraph</a>.)+<pre>graph_traits<subgraph>::degree_size_type<br></pre>用于处理单个顶 点的出边数量的类型。(<a href="IncidenceGraph.html">关联图IncidenceGraph</a> 的要求)
<hr> -<pre> -property_map<subgraph, PropertyTag>::type -property_map<subgraph, PropertyTag>::const_type -</pre> - The map type for vertex or edge properties in the graph. The - specific property is specified by the <tt>PropertyTag</tt> template - argument, and must match one of the properties specified in the - <tt>VertexProperty</tt> or <tt>EdgeProperty</tt> for the graph. - (Required by <a href="PropertyGraph.html">PropertyGraph</a>.)+<pre>property_map<subgraph, PropertyTag>::type<br>property_map<subgraph, PropertyTag>::const_type<br></pre>图中顶点属性或边属性所用的映射类型。特 定属性由 <tt>PropertyTag</tt> 模板参数指定,且必须与该图的 <tt>VertexProperty</tt> 或 <tt>EdgeProperty</tt> 中所指定的某个属性相匹配。 (<a href="PropertyGraph.html">属性图PropertyGraph</a> 的要求)
<hr> -<pre> -subgraph::children_iterator -</pre> - The iterator type for accessing the children subgraphs of the graph.+<pre>subgraph::children_iterator<br></pre>这个迭代器类型用于访问该图的各个 子图。
<!-----------------------------> -<h3>Member Functions</h3> +<h3>Member Functions 成员函数</h3> <hr> -<pre>-subgraph(vertices_size_type n, const GraphProperty& p = GraphProperty())
-</pre> - Creates the root graph object with <tt>n</tt> vertices and zero edges.+<pre>subgraph(vertices_size_type n, const GraphProperty& p = GraphProperty())<br></pre>创建根图对象,带有 <tt>n</tt> 个顶点和零条边。
<hr> -<pre> -subgraph<Graph>& create_subgraph(); -</pre> - Creates an empty subgraph object whose parent is <i>this</i> - graph.+<pre>subgraph<Graph>& create_subgraph();<br></pre>创建一个空的子 图对象,其父母为 <i>this</i> 图。
<hr> -<pre> -template <typename VertexIterator> -subgraph<Graph>& -create_subgraph(VertexIterator first, VertexIterator last) -</pre> - Creates a subgraph object with the specified vertex set. The - edges of the subgraph are induced by the vertex set. That is, - every edge in the parent graph (which is <i>this</i> graph) that - connects two vertices in the subgraph will be added to the - subgraph.+<pre>template <typename VertexIterator><br>subgraph<Graph>&<br>create_subgraph(VertexIterator first, VertexIterator last)<br></pre>以特定的顶点集创建一个子图对象。该子图 的边由这个顶点集导出。即,父图(即 <i>this</i> 图)中连接子图中的任两个顶点的 每一条边都被增加至子图中。
<hr> -<pre> -vertex_descriptor local_to_global(vertex_descriptor u_local) const -</pre> - Converts a local vertex descriptor to the corresponding global - vertex descriptor.+<pre>vertex_descriptor local_to_global(vertex_descriptor u_local) const<br></pre>将一个局部的顶点描述符转换为相应的全局顶点描述符。
<hr> -<pre> -vertex_descriptor global_to_local(vertex_descriptor u_global) const -</pre> - Converts a global vertex descriptor to the corresponding local - vertex descriptor.+<pre>vertex_descriptor global_to_local(vertex_descriptor u_global) const<br></pre>将一个全局的顶点描述符转换为相应的局部顶点描述符。
<hr> -<pre> -edge_descriptor local_to_global(edge_descriptor e_local) const -</pre> - Converts a local edge descriptor to the corresponding global edge - descriptor.+<pre>edge_descriptor local_to_global(edge_descriptor e_local) const<br></pre>将一个局部的边描述符转换为相应的全局边描述符。
<hr> -<pre> -edge_descriptor global_to_local(edge_descriptor u_global) const -</pre> - Converts a global edge descriptor to the corresponding local edge - descriptor.+<pre>edge_descriptor global_to_local(edge_descriptor u_global) const<br></pre>将一个全局的边描述符转换为相应的局部边描述符。
<hr> -<pre>-std::pair<vertex_descriptor, bool> find_vertex(vertex_descriptor u_global) const
-</pre> - If vertex <i>u</i> is in this subgraph, the function returns the local - vertex descriptor that corresponds to the global vertex descriptor - <tt>u_global</tt> as the first part of the pair and <tt>true</tt> for - the second part of the pair. If vertex <i>u</i> is not in the subgraph - then this function returns false in the second part of the - pair.+<pre>std::pair<vertex_descriptor, bool> find_vertex(vertex_descriptor u_global) const<br></pre>如果顶点 <i>u</i> 在 此子图中,则该函数将与全局顶点描述符 + <tt>u_global</tt> 相对应的局部顶点描述符作为返回值对的第一部分,将 <tt>true</tt> 作为值对的第二部分。如果顶点 <i>u</i> 不在子图中,则该函数在返 回值对的第二部分中返回 false。
<hr> -<pre> -subgraph& root() -</pre> - Returns the root graph of the subgraph tree. +<pre>subgraph& root()<br></pre>返回该子图树的根图。 <hr> -<pre> -bool is_root() const -</pre> - Return <tt>true</tt> if the graph is the root of the subgraph tree, - and returns <tt>false</tt> otherwise.+<pre>bool is_root() const<br></pre>如果该图是子图树的根,返回 <tt>true</tt>,否则返回 <tt>false</tt>。
<hr> -<pre> -subgraph& parent() -</pre> - Returns the parent graph. +<pre>subgraph& parent()<br></pre>返回父图。 <hr> -<pre> -std::pair<children_iterator, children_iterator> children() const -</pre> -Return an iterator pair for accessing the children subgraphs.+<pre>std::pair<children_iterator, children_iterator> children() const<br></pre>返回一个迭代器对,用于访问子图。
<!-----------------------------> -<h3>Nonmember Functions</h3> - -The functionality of <tt>subgraph</tt> depends on the -<tt>Graph</tt> type. For example, if <tt>Graph</tt> in a-<a href="BidirectionalGraph.html">BidirectionalGraph</a> and supports <tt>in_edges</tt>, then so
-does <tt>subgraph</tt>. Here we list all the functions that -<tt>subgraph</tt> could possibly support given a <tt>Graph</tt>-type that is a model of <a href="VertexListGraph.html">VertexListGraph</a>, <a href="EdgeListGraph.html">EdgeListGraph</a> and -<a href="BidirectionalGraph.html">BidirectionalGraph</a>. If the <tt>Graph</tt> type that you use
-with <tt>subgraph</tt> does not model these concepts and supports -fewer functions, then the <tt>subgraph</tt> will also support -fewer functions and some of the functions listed below will not be -implemented. +<h3>Nonmember Functions 非成员函数</h3>子图的功能取决于它的 +<tt>Graph</tt> 类型。例如,如果 <tt>Graph</tt> 是一个+<a href="BidirectionalGraph.html">双向图BidirectionalGraph</a> 且支持 <tt>in_edges</tt>,则子图也同样。下面我们列出当给定的 <tt>Graph</tt> +类型是 <a href="VertexListGraph.html">点列表图VertexListGraph</a>, <a href="EdgeListGraph.html">边列表图EdgeListGraph</a> 和 +<a href="BidirectionalGraph.html">双向图BidirectionalGraph</a> 时,子图可能 支持的所有函数。如果你所使用的 <tt>Graph</tt> 类型不满足这些概念且支持较少的 函数,则子图同样只支持较少的函数,以下所列函数中的一部分将不被实现。
<hr> -<pre> -std::pair<vertex_iterator, vertex_iterator> -vertices(const subgraph& g) -</pre>- Returns an iterator range providing access to the vertex set of subgraph <i>g</i>.
- (Required by <a href="VertexListGraph.html">VertexListGraph</a>.)+<pre>std::pair<vertex_iterator, vertex_iterator><br>vertices(const subgraph& g)<br></pre>返回一个迭代器区间,提供对图 <i>g</i> 的顶点集的访 问。(<a href="VertexListGraph.html">点列表图VertexListGraph</a> 的要求)
<hr> -<pre> -std::pair<edge_iterator, edge_iterator> -edges(const subgraph& g) -</pre>- Returns an iterator range providing access to the edge set of subgraph <i>g</i>.
- (Required by <a href="EdgeListGraph.html">EdgeListGraph</a>.)+<pre>std::pair<edge_iterator, edge_iterator><br>edges(const subgraph& g)<br></pre>返回一个迭代器区间,提供对图 <i>g</i> 的边集的访 问。(<a href="EdgeListGraph.html">边列表图EdgeListGraph</a> 的要求)
<hr> -<pre> -std::pair<adjacency_iterator, adjacency_iterator> -adjacent_vertices(vertex_descriptor u_local, const subgraph& g) -</pre> - Returns an iterator range providing access to the vertices - adjacent to - vertex <i>u</i> in subgraph <i>g</i>. - (Required by <a href="AdjacencyGraph.html">AdjacencyGraph</a>.)+<pre>std::pair<adjacency_iterator, adjacency_iterator><br>adjacent_vertices(vertex_descriptor u_local, const subgraph& g)<br></pre>返回一个迭代器区间,提供对图 <i>g</i> 中顶 点 <i>u</i> 的邻接顶点的访问。(<a href="AdjacencyGraph.html">邻接图 AdjacencyGraph</a> 的要求)
<hr> -<pre> -std::pair<out_edge_iterator, out_edge_iterator> -out_edges(vertex_descriptor u_local, const subgraph& g) -</pre> - Returns an iterator range providing access to the out-edges of - vertex <i>u</i> in subgraph <i>g</i>. If the graph is undirected, this - iterator range provides access to all edge incident on - vertex <i>u</i>. - (Required by <a href="IncidenceGraph.html">IncidenceGraph</a>.)+<pre>std::pair<out_edge_iterator, out_edge_iterator><br>out_edges(vertex_descriptor u_local, const subgraph& g)<br></pre>返回一个迭代器区间,提供对图 <i>g</i> 的顶点 <i>u</i> 的出边的访问。如果是无向图,则该迭代器区间提供对顶点 <i>u</i> 的所有邻接边的访问。(<a href="IncidenceGraph.html">关联图 IncidenceGraph</a> 的要求)
<hr> -<pre> -std::pair<in_edge_iterator, in_edge_iterator> -in_edges(vertex_descriptor v_local, const subgraph& g) -</pre> - Returns an iterator range providing access to the in-edges of - vertex - <i>v</i> in subgraph <i>g</i>. - (Required by <a href="BidirectionalGraph.html">BidirectionalGraph</a>.)+<pre>std::pair<in_edge_iterator, in_edge_iterator><br>in_edges(vertex_descriptor v_local, const subgraph& g)<br></pre>返回一个迭代器区间,提供对图 <i>g</i> 的顶点 <i>v</i> 的入边的访问。(<a href="BidirectionalGraph.html">双向图 BidirectionalGraph</a> 的要求)
<hr> -<pre> -vertex_descriptor -source(edge_descriptor e_local, const subgraph& g) -</pre> - Returns the source vertex of edge <i>e</i> in subgraph <i>g</i>. - (Required by <a href="IncidenceGraph.html">IncidenceGraph</a>.)+<pre>vertex_descriptor<br>source(edge_descriptor e_local, const subgraph& g)<br></pre>返回图 <i>g</i> 中边 <i>e</i> 的源顶点。(<a href="IncidenceGraph.html">关联图IncidenceGraph</a> 的要求)
<hr> -<pre> -vertex_descriptor -target(edge_descriptor e_local, const subgraph& g) -</pre> - Returns the target vertex of edge <i>e</i> in subgraph <i>g</i>. - (Required by <a href="IncidenceGraph.html">IncidenceGraph</a>.)+<pre>vertex_descriptor<br>target(edge_descriptor e_local, const subgraph& g)<br></pre>返回图 <i>g</i> 中边 <i>e</i> 的目标顶点。 (<a href="IncidenceGraph.html">关联图IncidenceGraph</a> 的要求)
<hr> -<pre> -degree_size_type -out_degree(vertex_descriptor u_local, const subgraph& g) -</pre>- Returns the number of edges leaving vertex <i>u</i> in subgraph <i>g</i>.
- (Required by <a href="IncidenceGraph.html">IncidenceGraph</a>.)+<pre>degree_size_type<br>out_degree(vertex_descriptor u_local, const subgraph& g)<br></pre>返回图 <i>g</i> 中顶点 <i>u</i> 的出边数量。 (<a href="IncidenceGraph.html">关联图IncidenceGraph</a> 的要求)
<hr> -<pre>-degree_size_type in_degree(vertex_descriptor u_local, const subgraph& g)
-</pre>- Returns the number of edges entering vertex <i>u</i> in subgraph <i>g</i>.
- (Required by <a href="BidirectionalGraph.html">BidirectionalGraph</a>.)+<pre>degree_size_type in_degree(vertex_descriptor u_local, const subgraph& g)<br></pre>返回图 <i>g</i> 中顶点 <i>u</i> 的入边数量。 (<a href="BidirectionalGraph.html">双向图BidirectionalGraph</a> 的要求)
<hr> -<pre> -vertices_size_type num_vertices(const subgraph& g) -</pre> - Returns the number of vertices in the subgraph <i>g</i>. - (Required by <a href="VertexListGraph.html">VertexListGraph</a>.)+<pre>vertices_size_type num_vertices(const subgraph& g)<br></pre>返回 图 <i>g</i> 的顶点数。(<a href="VertexListGraph.html">点列表图 VertexListGraph</a> 的要求)
<hr> -<pre> -edges_size_type num_edges(const subgraph& g) -</pre> - Returns the number of edges in the subgraph <i>g</i>. (Required by - <a href="EdgeListGraph.html">EdgeListGraph</a>.)+<pre>edges_size_type num_edges(const subgraph& g)<br></pre>返回图 <i>g</i> 的边数。(<a href="EdgeListGraph.html">边列表图EdgeListGraph</a> 的 要求)
<hr> -<pre> -vertex_descriptor vertex(vertices_size_type n, const subgraph& g) -</pre> - Returns the <i>n</i>th vertex in the subgraph's vertex list.+<pre>vertex_descriptor vertex(vertices_size_type n, const subgraph& g)<br></pre>返回子图的顶点列表中第 <i>n</i> 个顶点。
<hr> -<pre> -std::pair<edge_descriptor, bool>-edge(vertex_descriptor u_local, vertex_descriptor v_local, const subgraph& g)
-</pre>- Returns the edge connecting vertex <i>u</i> to vertex <i>v</i> in subgraph <i>g</i>.
- (Required by <a href="AdjacencyMatrix.html">AdjacencyMatrix</a>.)+<pre>std::pair<edge_descriptor, bool><br>edge(vertex_descriptor u_local, vertex_descriptor v_local, const subgraph& g)<br></pre>返回子 图 <i>g</i> 中连接顶点 <i>u</i> 和 <i>v</i> 的边。(<a href="AdjacencyGraph.html">邻接图AdjacencyGraph</a> 的要求)
<hr> -<pre> -std::pair<edge_descriptor, bool>-add_edge(vertex_descriptor u_local, vertex_descriptor v_local, subgraph& g)
-</pre>- Adds edge <i>(u,v)</i> to the subgraph <i>g</i> and to all of the subgraph's
- ancestors in the subgraph tree. This function returns the edge - descriptor for the new edge. If the edge is already in the graph - then a duplicate will not be added and the Boolean flag will be - false. - (Required by <a href="EdgeMutableGraph.html">EdgeMutableGraph</a>.)+<pre>std::pair<edge_descriptor, bool><br>add_edge(vertex_descriptor u_local, vertex_descriptor v_local, subgraph& g)<br></pre>将边 <i>(u,v)</i> 增加至子图 <i>g</i> 以及它在子图树中的所有前辈节点中。该函数返 回新边的边描述符。如果该边已存在于图中,则不会重复加入,且布尔标志被设为 false。(<a href="EdgeMutableGraph.html">边可变图EdgeMutableGraph</a> 的要求)
<hr> -<pre> -std::pair<edge_descriptor, bool> -add_edge(vertex_descriptor u_local, vertex_descriptor v_local, - const EdgeProperty& p, subgraph& g) -</pre>- Adds edge <i>(u,v)</i> to the graph and attaches <tt>p</tt> as the value
- of the edge's internal property storage. Also see the previous - <tt>add_edge</tt> member function for more details.+<pre>std::pair<edge_descriptor, bool><br>add_edge(vertex_descriptor u_local, vertex_descriptor v_local,<br> const EdgeProperty& p, subgraph& g)<br></pre>将边 <i>(u,v)</i> 增加至图中,并将 <tt>p</tt> 作为 该边的内部属性值。更多细节请见上一个 <tt>add_edge</tt> 函数。
<hr> -<pre> -void remove_edge(vertex_descriptor u_local, vertex_descriptor v_local, - subgraph& g) -</pre> - Removes the edge <i>(u,v)</i> from the subgraph and from all of the - ancestors of <tt>g</tt> in the subgraph tree. - (Required by <a href="EdgeMutableGraph.html">EdgeMutableGraph</a>.)+<pre>void remove_edge(vertex_descriptor u_local, vertex_descriptor v_local,<br> subgraph& g)<br></pre>从子图 <tt>g</tt> 及 其在子图树中的所有前辈中移除边 <i>(u,v)</i>。(<a href="EdgeMutableGraph.html">边可变图EdgeMutableGraph</a> 的要求)
<hr> -<pre> -void remove_edge(edge_descriptor e_local, subgraph& g) -</pre> - Removes the edge <tt>e</tt> from the subgraph and from all of the - ancestors of <tt>g</tt> in the subgraph tree. - (Required by <a href="EdgeMutableGraph.html">EdgeMutableGraph</a>.)+<pre>void remove_edge(edge_descriptor e_local, subgraph& g)<br></pre>从 子图 <tt>g</tt> 及其在子图树中的所有前辈中移除边 <tt>e</tt>。(<a href="EdgeMutableGraph.html">边可变图EdgeMutableGraph</a> 的要求)
<hr> -<pre> -vertex_descriptor -add_vertex(subgraph& g) -</pre> - Adds a vertex to the subgraph and returns the vertex descriptor - for the new vertex. The vertex is also added to all ancestors of - <tt>g</tt> in the subgraph tree to maintain the subgraph property. - (Required by <a href="VertexMutableGraph.html">VertexMutableGraph</a>.)+<pre>vertex_descriptor<br>add_vertex(subgraph& g)<br></pre>增加一个顶点 到子图中,并返回新顶点的顶点描述符。该顶点同时被增加至 <tt>g</tt> 在子图树中 的所有前辈中,以保持子图特性。(<a href="VertexMutableGraph.html">点可变图 VertexMutableGraph</a> 的要求)
<hr> -<pre> -vertex_descriptor -add_vertex(vertex_descriptor u_global, subgraph& g) -</pre> -Adds the vertex <i>u</i> from the root graph to the subgraph <tt>g</tt>. -(Required by <a href="VertexMutableGraph.html">VertexMutableGraph</a>.)+<pre>vertex_descriptor<br>add_vertex(vertex_descriptor u_global, subgraph& g)<br></pre>将根图中的顶点 <i>u</i> 增加至子图 <tt>g</tt>。 (<a href="VertexMutableGraph.html">点可变图VertexMutableGraph</a> 的要求)
<hr> -<pre> -template <class PropertyTag> -property_map<subgraph, PropertyTag>::type -get(PropertyTag, subgraph& g) - -template <class PropertyTag> -property_map<subgraph, PropertyTag>::const_type -get(PropertyTag, const subgraph& g) -</pre> - Returns the property map object for the vertex or edge property- specified by <tt>PropertyTag</tt>. The <tt>PropertyTag</tt> must match one
- of the properties specified in the graph's <tt>PropertyTag</tt> - template argument. Vertex and edge properties are shared by all - subgraphs, so changes to a property through a local vertex - descriptor for one subgraph will change the property for the - global vertex descriptor, and therefore for all other subgraphs. - However, the key type for a subgraph's property map is a subgraph-local - vertex or edge descriptor. - (Required by <a href="PropertyGraph.html">PropertyGraph</a>.)+<pre>template <class PropertyTag><br>property_map<subgraph, PropertyTag>::type<br>get(PropertyTag, subgraph& g)<br><br>template <class PropertyTag><br>property_map<subgraph, PropertyTag>::const_type<br>get(PropertyTag, const subgraph& g)<br></pre>返回由 +<tt>PropertyTag</tt> 指定的顶点属性或边属性的属性映射对象。 <tt>PropertyTag</tt> 必须与在该图的 <tt>PropertyTag</tt> + 模板参数中所指定的某一个属性相匹配。所有子图共享顶点属性和边属性,所以通过 一个子图的局部顶点描述符修改某个属性,同样会改变全局顶点描述符的属性,进而改 变其它所有子图的属性。不过,子图的属性映射的键类型是子图的局部顶点描述符或局 部边描述符。(<a href="PropertyGraph.html">属性图PropertyGraph</a> 的要求)
<hr> -<pre> -template <class PropertyTag, class Key> -typename property_traits< - typename property_map<subgraph, PropertyTag>::const_type ->::value_type -get(PropertyTag, const subgraph& g, Key k_local) -</pre> - This returns the property value for the key <tt>k_local</tt>, which - is either a local vertex or local edge descriptor. See the above - <tt>get</tt> function - for more information about the propert maps. - (Required by <a href="PropertyGraph.html">PropertyGraph</a>.)+<pre>template <class PropertyTag, class Key><br>typename property_traits<<br> typename property_map<subgraph, PropertyTag>::const_type<br>>::value_type<br>get(PropertyTag, const subgraph& g, Key k_local)<br></pre>返回键 <tt>k_local</tt> 的属性值,该 键是一个局部顶点描述符或局部边描述符。有关属性映射的更多信息,参见前面的 <tt>get</tt> 函数。(<a href="PropertyGraph.html">属性图PropertyGraph</a> 的 要求)
<hr> -<pre> -template <class PropertyTag, class Key, class Value> -void -put(PropertyTag, const subgraph& g, Key k_local, const Value& value) -</pre> - This sets the property value for the key <tt>k_local</tt> to - <tt>value</tt>. <tt>k_local</tt> is either a local vertex or local - edge descriptor. <tt>Value</tt> must be convertible to+<pre>template <class PropertyTag, class Key, class Value><br>void<br>put(PropertyTag, const subgraph& g, Key k_local, const Value& value)<br></pre>将键 <tt>k_local</tt> 的属性值设为 + <tt>value</tt>。<tt>k_local</tt> 是一个局部顶点描述符或局部边描述符。 <tt>Value</tt> 必须可以转换为
<tt>typename property_traits<property_map<adjacency_matrix, - PropertyTag>::type>::value_type</tt>. - (Required by <a href="PropertyGraph.html">PropertyGraph</a>.)+ PropertyTag>::type>::value_type</tt>。(<a href="PropertyGraph.html">属性图PropertyGraph</a> 的要求)
<hr> -<pre> -template <class GraphProperties, class GraphPropertyTag> -typename property_value<GraphProperties, GraphPropertyTag>::type& -get_property(subgraph& g, GraphPropertyTag); -</pre> -Return the property specified by <tt>GraphPropertyTag</tt> that is attached -to the subgraph object <tt>g</tt>. The <tt>property_value</tt> traits class -is defined in <tt>boost/pending/property.hpp</tt>.+<pre>template <class GraphProperties, class GraphPropertyTag><br>typename property_value<GraphProperties, GraphPropertyTag>::type&<br>get_property(subgraph& g, GraphPropertyTag);<br></pre>返回由 <tt>GraphPropertyTag</tt> 所指定的关联至 图对象 <tt>g</tt> 的属性。该 <tt>property_value</tt> traits 类定义于 <tt>boost/pending/property.hpp</tt>。
<hr> -<pre> -template <class GraphProperties, class GraphPropertyTag>-const typename property_value<GraphProperties, GraphPropertyTag>::type&
-get_property(const subgraph& g, GraphPropertyTag); -</pre> -Return the property specified by <tt>GraphPropertyTag</tt> that is -attached to the subgraph object <tt>g</tt>. The <tt>property_value</tt> -traits class is defined in <tt>boost/pending/property.hpp</tt>.+<pre>template <class GraphProperties, class GraphPropertyTag><br>const typename property_value<GraphProperties, GraphPropertyTag>::type&<br>get_property(const subgraph& g, GraphPropertyTag);<br></pre>返回由 <tt>GraphPropertyTag</tt> 所指定的关联至 图对象 <tt>g</tt> 的属性。该 <tt>property_value</tt>
+traits 类定义于 <tt>boost/pending/property.hpp</tt>。 <hr> +</body></html>