doc/quicktour.dox
changeset 1181 848b6006941d
parent 1175 6205eebd62fc
child 1183 8f623d1833a7
     1.1 --- a/doc/quicktour.dox	Mon Feb 28 13:03:36 2005 +0000
     1.2 +++ b/doc/quicktour.dox	Wed Mar 02 09:51:11 2005 +0000
     1.3 @@ -16,17 +16,13 @@
     1.4  
     1.5  
     1.6  
     1.7 -Some examples are the following:
     1.8 +Some examples are the following (you will find links next to the code fragments that help to download full demo programs):
     1.9  
    1.10  - First we give two examples that show how to instantiate a graph. The
    1.11  first one shows the methods that add nodes and edges, but one will
    1.12  usually use the second way which reads a graph from a stream (file).
    1.13 -
    1.14 -
    1.15 --# The following code fragment shows how to fill a graph with data.
    1.16 -
    1.17 +-# The following code fragment shows how to fill a graph with data. It creates a complete graph on 4 nodes. The type Listgraph is one of the LEMON graph types: the typedefs in the beginning are for convenience and we will supppose them later as well.
    1.18   \code
    1.19 -
    1.20    typedef ListGraph Graph;
    1.21    typedef Graph::Edge Edge;
    1.22    typedef Graph::InEdgeIt InEdgeIt;
    1.23 @@ -43,20 +39,36 @@
    1.24    for (NodeIt i(g); i!=INVALID; ++i)
    1.25      for (NodeIt j(g); j!=INVALID; ++j)
    1.26        if (i != j) g.addEdge(i, j);
    1.27 -
    1.28   \endcode 
    1.29  
    1.30 - -#
    1.31 +If you want to read more on the LEMON graph structures and concepts, read the page about \ref graphs "graphs". 
    1.32 +
    1.33 +-# The following code shows how to read a graph from a stream (e.g. a file). LEMON supports the DIMACS file format: it can read a graph instance from a file 
    1.34 +in that format (find the documentation of the format on the web). 
    1.35 +\code
    1.36 +Graph g;
    1.37 +std::ifstream f("graph.dim");
    1.38 +readDimacs(f, g);
    1.39 +\endcode
    1.40 +One can also store network (graph+capacity on the edges) instances and other things in DIMACS format: to see the details read the documentation of the \ref dimacs.h "Dimacs file format reader".
    1.41 +
    1.42  
    1.43  - If you want to solve some transportation problems in a network then 
    1.44  you will want to find shortest paths between nodes of a graph. This is 
    1.45  usually solved using Dijkstra's algorithm. A utility
    1.46  that solves this is  the \ref lemon::Dijkstra "LEMON Dijkstra class".
    1.47  A simple program using the \ref lemon::Dijkstra "LEMON Dijkstra class" is
    1.48 -as follows (we assume that the graph is already given in the memory):
    1.49 +as follows (we do not include the part that instantiates the graph and the length function):
    1.50  
    1.51  \code
    1.52 -
    1.53 +  typedef Graph::EdgeMap<int> LengthMap;
    1.54 +  Graph G;
    1.55 +  Node s, t;
    1.56 +  LengthMap cap(G);
    1.57 +	...
    1.58 +  Dijkstra<Graph, LengthMap> 
    1.59 +	dijkstra_test(G, cap);
    1.60 +  dijkstra_test.run(s);
    1.61  \endcode
    1.62  
    1.63  - If you want to design a network and want to minimize the total length