# HG changeset patch
# User alpar
# Date 1122383713 0
# Node ID 8f1c317ebeb43ea969af42bb5358035d8741850b
# Parent 1a8630f2e9440077616aadbf3fa957221afa1c0d
Doc improvements
diff -r 1a8630f2e944 -r 8f1c317ebeb4 demo/graph_to_eps_demo.cc
--- a/demo/graph_to_eps_demo.cc Mon Jul 25 11:17:23 2005 +0000
+++ b/demo/graph_to_eps_demo.cc Tue Jul 26 13:15:13 2005 +0000
@@ -20,10 +20,11 @@
///
/// This demo program shows examples how to use the function \ref
/// graphToEps(). It takes no input but simply creates six
-/// .eps files demonstrating how to draw directed/undirected
-/// graphs, how to handle parallel egdes, how to change the properties
-/// (like color, shape, size, title etc.) of nodes and edges
-/// individually using appropriate \ref maps-page "graphmaps".
+/// .eps files demonstrating the capability of \ref
+/// graphToEps(), and showing how to draw directed/undirected graphs,
+/// how to handle parallel egdes, how to change the properties (like
+/// color, shape, size, title etc.) of nodes and edges individually
+/// using appropriate \ref maps-page "graphmapfactory".
#include
diff -r 1a8630f2e944 -r 8f1c317ebeb4 doc/groups.dox
--- a/doc/groups.dox Mon Jul 25 11:17:23 2005 +0000
+++ b/doc/groups.dox Tue Jul 26 13:15:13 2005 +0000
@@ -164,7 +164,7 @@
graph structures and helper classes used to implement these.
*/
-/**
+/* --- Unused group
@defgroup experimental Experimental Structures and Algorithms
This group contains some Experimental structures and algorithms.
The stuff here is subject to change.
diff -r 1a8630f2e944 -r 8f1c317ebeb4 lemon/bits/alteration_notifier.h
--- a/lemon/bits/alteration_notifier.h Mon Jul 25 11:17:23 2005 +0000
+++ b/lemon/bits/alteration_notifier.h Tue Jul 26 13:15:13 2005 +0000
@@ -20,13 +20,13 @@
#include
#include
-///\ingroup graphmaps
+///\ingroup graphmapfactory
///\file
///\brief Observer registry for graph alteration observers.
namespace lemon {
- /// \addtogroup graphmaps
+ /// \addtogroup graphmapfactory
/// @{
/// \brief Registry class to register objects observes alterations in
diff -r 1a8630f2e944 -r 8f1c317ebeb4 lemon/bits/array_map.h
--- a/lemon/bits/array_map.h Mon Jul 25 11:17:23 2005 +0000
+++ b/lemon/bits/array_map.h Tue Jul 26 13:15:13 2005 +0000
@@ -20,7 +20,7 @@
#include
#include
-///\ingroup graphmaps
+///\ingroup graphmapfactory
///\file
///\brief Graph maps that construates and destruates
///their elements dynamically.
@@ -28,7 +28,7 @@
namespace lemon {
- /// \addtogroup graphmaps
+ /// \addtogroup graphmapfactory
/// @{
/// The ArrayMap template class is graph map structure what
diff -r 1a8630f2e944 -r 8f1c317ebeb4 lemon/bits/default_map.h
--- a/lemon/bits/default_map.h Mon Jul 25 11:17:23 2005 +0000
+++ b/lemon/bits/default_map.h Tue Jul 26 13:15:13 2005 +0000
@@ -21,14 +21,14 @@
#include
#include
-///\ingroup graphmaps
+///\ingroup graphmapfactory
///\file
///\brief Graph maps that construct and destruct
///their elements dynamically.
namespace lemon {
-/// \addtogroup graphmaps
+/// \addtogroup graphmapfactory
/// @{
/** The ArrayMap template class is graph map structure what
diff -r 1a8630f2e944 -r 8f1c317ebeb4 lemon/bits/map_iterator.h
--- a/lemon/bits/map_iterator.h Mon Jul 25 11:17:23 2005 +0000
+++ b/lemon/bits/map_iterator.h Tue Jul 26 13:15:13 2005 +0000
@@ -22,13 +22,13 @@
#include
#include
-///\ingroup graphmaps
+///\ingroup graphmapfactory
///\file
///\brief Iterators on the maps.
namespace lemon {
- /// \addtogroup graphmaps
+ /// \addtogroup graphmapfactory
/// @{
/** The base class all of the map iterators.
diff -r 1a8630f2e944 -r 8f1c317ebeb4 lemon/bits/vector_map.h
--- a/lemon/bits/vector_map.h Mon Jul 25 11:17:23 2005 +0000
+++ b/lemon/bits/vector_map.h Tue Jul 26 13:15:13 2005 +0000
@@ -24,13 +24,13 @@
#include
#include
-///\ingroup graphmaps
+///\ingroup graphmapfactory
///\file
///\brief Vector based graph maps.
namespace lemon {
- /// \addtogroup graphmaps
+ /// \addtogroup graphmapfactory
/// @{
/// The VectorMap template class is graph map structure what
diff -r 1a8630f2e944 -r 8f1c317ebeb4 lemon/max_matching.h
--- a/lemon/max_matching.h Mon Jul 25 11:17:23 2005 +0000
+++ b/lemon/max_matching.h Tue Jul 26 13:15:13 2005 +0000
@@ -97,32 +97,88 @@
///Runs Edmonds' algorithm for sparse graphs (number of edges <
///2*number of nodes), and a heuristical Edmonds' algorithm with a
///heuristic of postponing shrinks for dense graphs.
- inline void run();
+ void run() {
+ if ( countUndirEdges(g) < HEUR_density*countNodes(g) ) {
+ greedyMatching();
+ runEdmonds(0);
+ } else runEdmonds(1);
+ }
+
///Runs Edmonds' algorithm.
///If heur=0 it runs Edmonds' algorithm. If heur=1 it runs
///Edmonds' algorithm with a heuristic of postponing shrinks,
///giving a faster algorithm for dense graphs.
- void runEdmonds( int heur );
+ void runEdmonds( int heur = 1 ) {
+
+ for(NodeIt v(g); v!=INVALID; ++v)
+ position.set(v,C);
+
+ typename Graph::template NodeMap ear(g,INVALID);
+ //undefined for the base nodes of the blossoms (i.e. for the
+ //representative elements of UFE blossom) and for the nodes in C
+
+ typename UFE::MapType blossom_base(g);
+ UFE blossom(blossom_base);
+ typename UFE::MapType tree_base(g);
+ UFE tree(tree_base);
+ //If these UFE's would be members of the class then also
+ //blossom_base and tree_base should be a member.
+
+ for(NodeIt v(g); v!=INVALID; ++v) {
+ if ( position[v]==C && _mate[v]==INVALID ) {
+ blossom.insert(v);
+ tree.insert(v);
+ position.set(v,D);
+ if ( heur == 1 ) lateShrink( v, ear, blossom, tree );
+ else normShrink( v, ear, blossom, tree );
+ }
+ }
+ }
+
///Finds a greedy matching starting from the actual matching.
///Starting form the actual matching stored, it finds a maximal
///greedy matching.
- void greedyMatching();
+ void greedyMatching() {
+ for(NodeIt v(g); v!=INVALID; ++v)
+ if ( _mate[v]==INVALID ) {
+ for( IncEdgeIt e(g,v); e!=INVALID ; ++e ) {
+ Node y=g.runningNode(e);
+ if ( _mate[y]==INVALID && y!=v ) {
+ _mate.set(v,y);
+ _mate.set(y,v);
+ break;
+ }
+ }
+ }
+ }
///Returns the size of the actual matching stored.
///Returns the size of the actual matching stored. After \ref
///run() it returns the size of a maximum matching in the graph.
- int size() const;
+ int size() const {
+ int s=0;
+ for(NodeIt v(g); v!=INVALID; ++v) {
+ if ( _mate[v]!=INVALID ) {
+ ++s;
+ }
+ }
+ return s/2;
+ }
+
///Resets the actual matching to the empty matching.
///Resets the actual matching to the empty matching.
///
- void resetMatching();
+ void resetMatching() {
+ for(NodeIt v(g); v!=INVALID; ++v)
+ _mate.set(v,INVALID);
+ }
///Returns the mate of a node in the actual matching.
@@ -284,44 +340,6 @@
template
- void MaxMatching::run() {
- if ( countUndirEdges(g) < HEUR_density*countNodes(g) ) {
- greedyMatching();
- runEdmonds(0);
- } else runEdmonds(1);
- }
-
-
- template
- void MaxMatching::runEdmonds( int heur=1 ) {
-
- for(NodeIt v(g); v!=INVALID; ++v)
- position.set(v,C);
-
- typename Graph::template NodeMap ear(g,INVALID);
- //undefined for the base nodes of the blossoms (i.e. for the
- //representative elements of UFE blossom) and for the nodes in C
-
- typename UFE::MapType blossom_base(g);
- UFE blossom(blossom_base);
- typename UFE::MapType tree_base(g);
- UFE tree(tree_base);
- //If these UFE's would be members of the class then also
- //blossom_base and tree_base should be a member.
-
- for(NodeIt v(g); v!=INVALID; ++v) {
- if ( position[v]==C && _mate[v]==INVALID ) {
- blossom.insert(v);
- tree.insert(v);
- position.set(v,D);
- if ( heur == 1 ) lateShrink( v, ear, blossom, tree );
- else normShrink( v, ear, blossom, tree );
- }
- }
- }
-
-
- template
void MaxMatching::lateShrink(Node v, typename Graph::template NodeMap& ear,
UFE& blossom, UFE& tree) {
@@ -460,38 +478,6 @@
}
template
- void MaxMatching::greedyMatching() {
- for(NodeIt v(g); v!=INVALID; ++v)
- if ( _mate[v]==INVALID ) {
- for( IncEdgeIt e(g,v); e!=INVALID ; ++e ) {
- Node y=g.runningNode(e);
- if ( _mate[y]==INVALID && y!=v ) {
- _mate.set(v,y);
- _mate.set(y,v);
- break;
- }
- }
- }
- }
-
- template
- int MaxMatching::size() const {
- int s=0;
- for(NodeIt v(g); v!=INVALID; ++v) {
- if ( _mate[v]!=INVALID ) {
- ++s;
- }
- }
- return s/2;
- }
-
- template
- void MaxMatching::resetMatching() {
- for(NodeIt v(g); v!=INVALID; ++v)
- _mate.set(v,INVALID);
- }
-
- template
bool MaxMatching::noShrinkStep(Node x,
typename Graph::template
NodeMap& ear,