|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81869 - in trunk/libs/graph: doc example
From: jewillco_at_[hidden]
Date: 2012-12-11 22:38:49
Author: jewillco
Date: 2012-12-11 22:38:48 EST (Tue, 11 Dec 2012)
New Revision: 81869
URL: http://svn.boost.org/trac/boost/changeset/81869
Log:
Re-added incident edges example from documentation; fixed undirected_adjacency_list.expected to match current code; fixed link to undirected.cpp example in documentation; fixes #7787
Text files modified:
trunk/libs/graph/doc/graph_concepts.html | 2 +-
trunk/libs/graph/example/undirected_adjacency_list.cpp | 18 +++++++++++++-----
trunk/libs/graph/example/undirected_adjacency_list.expected | 2 ++
3 files changed, 16 insertions(+), 6 deletions(-)
Modified: trunk/libs/graph/doc/graph_concepts.html
==============================================================================
--- trunk/libs/graph/doc/graph_concepts.html (original)
+++ trunk/libs/graph/doc/graph_concepts.html 2012-12-11 22:38:48 EST (Tue, 11 Dec 2012)
@@ -396,7 +396,7 @@
demonstrates using the <TT>out_edges()</TT>, <TT>source()</TT>, and
<TT>target()</TT> with an undirected graph. The source code for this
example and the following one can be found in <a
-href="../example/undirected.cpp"><TT>examples/undirected.cpp</TT></a>.
+href="../example/undirected_adjacency_list.cpp"><TT>example/undirected_adjacency_list.cpp</TT></a>.
<P>
<PRE>
Modified: trunk/libs/graph/example/undirected_adjacency_list.cpp
==============================================================================
--- trunk/libs/graph/example/undirected_adjacency_list.cpp (original)
+++ trunk/libs/graph/example/undirected_adjacency_list.cpp 2012-12-11 22:38:48 EST (Tue, 11 Dec 2012)
@@ -26,12 +26,12 @@
add_edge(zero, two, undigraph);
add_edge(one, two, undigraph);
- std::cout << "out_edges(0): ";
+ std::cout << "out_edges(0):";
for (boost::tie(out, out_end) = out_edges(zero, undigraph); out != out_end; ++out)
- std::cout << *out;
- std::cout << std::endl << "in_edges(0): ";
+ std::cout << ' ' << *out;
+ std::cout << std::endl << "in_edges(0):";
for (boost::tie(in, in_end) = in_edges(zero, undigraph); in != in_end; ++in)
- std::cout << *in;
+ std::cout << ' ' << *in;
std::cout << std::endl;
}
@@ -91,6 +91,14 @@
#endif
std::cout << "weight[(u,v)] = " << get(weight, e1) << std::endl;
std::cout << "weight[(v,u)] = " << get(weight, e2) << std::endl;
+
+ std::cout << "the edges incident to v: ";
+ typename boost::graph_traits<UndirectedGraph>::out_edge_iterator e, e_end;
+ typename boost::graph_traits<UndirectedGraph>::vertex_descriptor
+ s = vertex(0, undigraph);
+ for (boost::tie(e, e_end) = out_edges(s, undigraph); e != e_end; ++e)
+ std::cout << "(" << source(*e, undigraph)
+ << "," << target(*e, undigraph) << ")" << std::endl;
}
@@ -103,7 +111,7 @@
typedef adjacency_list < vecS, vecS, directedS,
no_property, Weight > DirectedGraph;
undirected_graph_demo1 < UndirectedGraph > ();
- undirected_graph_demo2 < UndirectedGraph > ();
directed_graph_demo < DirectedGraph > ();
+ undirected_graph_demo2 < UndirectedGraph > ();
return 0;
}
Modified: trunk/libs/graph/example/undirected_adjacency_list.expected
==============================================================================
--- trunk/libs/graph/example/undirected_adjacency_list.expected (original)
+++ trunk/libs/graph/example/undirected_adjacency_list.expected 2012-12-11 22:38:48 EST (Tue, 11 Dec 2012)
@@ -1,3 +1,5 @@
+out_edges(0): (0,1) (0,2)
+in_edges(0): (1,0) (2,0)
in a directed graph is (u,v) == (v,u) ? 0
weight[(u,v)] = 1.2
weight[(v,u)] = 2.4
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk