[Lemon-commits] Peter Kovacs: Minor improvements
Lemon HG
hg at lemon.cs.elte.hu
Mon Feb 22 19:46:53 CET 2010
details: http://lemon.cs.elte.hu/hg/lemon-tutorial/rev/72867897fcba
changeset: 50:72867897fcba
user: Peter Kovacs <kpeter [at] inf.elte.hu>
date: Mon Feb 22 13:00:14 2010 +0100
description:
Minor improvements
diffstat:
algorithms.dox | 2 +-
graphs.dox | 14 +++++---------
lp.dox | 8 +++++---
undir_graphs.dox | 7 +++++--
4 files changed, 16 insertions(+), 15 deletions(-)
diffs (104 lines):
diff --git a/algorithms.dox b/algorithms.dox
--- a/algorithms.dox
+++ b/algorithms.dox
@@ -196,7 +196,7 @@
The original sample code could also use the class interface as follows.
\code
- Dijkstra<ListDigraph> dijktra(g, length);
+ Dijkstra<ListDigraph> dijkstra(g, length);
dijkstra.distMap(dist);
dijsktra.init();
dijkstra.addSource(u);
diff --git a/graphs.dox b/graphs.dox
--- a/graphs.dox
+++ b/graphs.dox
@@ -81,27 +81,23 @@
provides faster item iteration than \ref ListDigraph and \ref
SmartDigraph, especially using \ref concepts::Digraph::OutArcIt
"OutArcIt" iterators, since its arcs are stored in an appropriate order.
-However, it only provides \ref StaticDigraph::build() "build()" and
-\ref \ref StaticDigraph::clear() "clear()" functions and does not
-support any other modification of the digraph.
+However, you can neither add nor delete arcs or nodes, the graph
+has to be built at once and other modifications are not supported.
\ref FullDigraph is an efficient implementation of a directed full graph.
-This structure is also completely static, so you can neither add nor delete
-arcs or nodes, moreover, the class needs constant space in memory.
+This structure is also completely static and it needs constant space
+in memory.
[SEC]sec_graph_types[SEC] Undirected Graph Structures
The general undirected graph classes, \ref ListGraph and \ref SmartGraph
have similar implementations as their directed variants.
-Therefore, \ref SmartDigraph is more efficient, but \ref ListGraph provides
+Therefore, \ref SmartGraph is more efficient, but \ref ListGraph provides
more functionality.
-
In addition to these general structures, LEMON also provides special purpose
undirected graph types for handling \ref FullGraph "full graphs",
\ref GridGraph "grid graphs" and \ref HypercubeGraph "hypercube graphs".
-They all static structures, i.e. they do not allow distinct item additions
-or deletions, the graph has to be built at once.
[TRAILER]
*/
diff --git a/lp.dox b/lp.dox
--- a/lp.dox
+++ b/lp.dox
@@ -65,9 +65,9 @@
lp.obj(10 * x1 + 6 * x2);
lp.solve();
- cout << "Objective function value: " << lp.primal() << endl;
- cout << "x1 = " << lp.primal(x1) << endl;
- cout << "x2 = " << lp.primal(x2) << endl;
+ std::cout << "Objective function value: " << lp.primal() << std::endl;
+ std::cout << "x1 = " << lp.primal(x1) << std::endl;
+ std::cout << "x2 = " << lp.primal(x2) << std::endl;
\endcode
\ref LpBase::Col "Lp::Col" type represents the variables in the LP problems,
@@ -110,6 +110,8 @@
lp.max();
lp.obj(o);
lp.solve();
+
+ std::cout << "Max flow value: " << lp.primal() << std::endl;
\endcode
[TRAILER]
diff --git a/undir_graphs.dox b/undir_graphs.dox
--- a/undir_graphs.dox
+++ b/undir_graphs.dox
@@ -131,6 +131,8 @@
[SEC]sec_undir_graph_algs[SEC] Undirected Graph Algorihtms
+\todo This subsection is under construction.
+
If you would like to design an electric network minimizing the total length
of wires, then you might be looking for a minimum spanning tree in an
undirected graph.
@@ -138,7 +140,7 @@
Let us suppose that the network is stored in a \ref ListGraph object \c g
with a cost map \c cost. We create a \c bool valued edge map \c tree_map or
-a vector \c tree_vector for stroing the tree that is found by the algorithm.
+a vector \c tree_vector for storing the tree that is found by the algorithm.
After that, we could call the \ref kruskal() function. It gives back the weight
of the minimum spanning tree and \c tree_map or \c tree_vector
will contain the found spanning tree.
@@ -167,7 +169,8 @@
// Kruskal algorithm with edge vector
std::vector<ListGraph::Edge> tree_vector;
std::cout << "The weight of the minimum spanning tree is "
- << kruskal(g, cost_map, tree_vector) << std::endl;
+ << kruskal(g, cost_map, std::back_inserter(tree_vector))
+ << std::endl;
// Print the results
std::cout << "Edges of the tree: " << std::endl;
More information about the Lemon-commits
mailing list