Changeset 1181:848b6006941d in lemon0.x
 Timestamp:
 03/02/05 10:51:11 (15 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1589
 Files:

 1 added
 1 edited
Legend:
 Unmodified
 Added
 Removed

doc/quicktour.dox
r1175 r1181 17 17 18 18 19 Some examples are the following :19 Some examples are the following (you will find links next to the code fragments that help to download full demo programs): 20 20 21 21  First we give two examples that show how to instantiate a graph. The 22 22 first one shows the methods that add nodes and edges, but one will 23 23 usually use the second way which reads a graph from a stream (file). 24 25 26 # The following code fragment shows how to fill a graph with data. 27 24 # 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. 28 25 \code 29 30 26 typedef ListGraph Graph; 31 27 typedef Graph::Edge Edge; … … 44 40 for (NodeIt j(g); j!=INVALID; ++j) 45 41 if (i != j) g.addEdge(i, j); 46 47 42 \endcode 48 43 49 # 44 If you want to read more on the LEMON graph structures and concepts, read the page about \ref graphs "graphs". 45 46 # 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 47 in that format (find the documentation of the format on the web). 48 \code 49 Graph g; 50 std::ifstream f("graph.dim"); 51 readDimacs(f, g); 52 \endcode 53 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". 54 50 55 51 56  If you want to solve some transportation problems in a network then … … 54 59 that solves this is the \ref lemon::Dijkstra "LEMON Dijkstra class". 55 60 A simple program using the \ref lemon::Dijkstra "LEMON Dijkstra class" is 56 as follows (we assume that the graph is already given in the memory):61 as follows (we do not include the part that instantiates the graph and the length function): 57 62 58 63 \code 59 64 typedef Graph::EdgeMap<int> LengthMap; 65 Graph G; 66 Node s, t; 67 LengthMap cap(G); 68 ... 69 Dijkstra<Graph, LengthMap> 70 dijkstra_test(G, cap); 71 dijkstra_test.run(s); 60 72 \endcode 61 73
Note: See TracChangeset
for help on using the changeset viewer.