demo/hello_lemon.cc
author Peter Kovacs <kpeter@inf.elte.hu>
Sun, 14 Feb 2010 22:19:50 +0100
changeset 27 b453a59230c8
parent 16 ed4c8506e151
child 36 199a65b64d90
permissions -rw-r--r--
Rework and extend the section of basic concepts
kpeter@5
     1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
kpeter@5
     2
 *
kpeter@5
     3
 * This file is a part of LEMON, a generic C++ optimization library.
kpeter@5
     4
 *
kpeter@20
     5
 * Copyright (C) 2003-2009
kpeter@5
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
kpeter@5
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
kpeter@5
     8
 *
kpeter@5
     9
 * Permission to use, modify and distribute this software is granted
kpeter@5
    10
 * provided that this copyright notice appears in all copies. For
kpeter@5
    11
 * precise terms see the accompanying LICENSE file.
kpeter@5
    12
 *
kpeter@5
    13
 * This software is provided "AS IS" with no warranty of any kind,
kpeter@5
    14
 * express or implied, and with no claim as to its suitability for any
kpeter@5
    15
 * purpose.
kpeter@5
    16
 *
kpeter@5
    17
 */
kpeter@5
    18
kpeter@5
    19
///\file
kpeter@16
    20
///\brief Simple "Hello World!" program for LEMON.
kpeter@5
    21
///
kpeter@16
    22
/// Simple "Hello World!" program for LEMON.
kpeter@5
    23
/// \include hello_lemon.cc
kpeter@5
    24
kpeter@5
    25
#include <iostream>
kpeter@5
    26
#include <lemon/list_graph.h>
kpeter@5
    27
kpeter@5
    28
int main()
kpeter@5
    29
{
kpeter@16
    30
  typedef lemon::ListDigraph Graph;
kpeter@16
    31
  Graph g;
kpeter@5
    32
kpeter@16
    33
  Graph::Node u = g.addNode();
kpeter@16
    34
  Graph::Node v = g.addNode();
kpeter@16
    35
  Graph::Arc  e = g.addArc(u, v);
kpeter@5
    36
kpeter@16
    37
  std::cout << "Hello World! This is LEMON library here." << std::endl;
kpeter@16
    38
  std::cout << "We have a directed graph with "
kpeter@16
    39
            << countNodes(g) << " nodes and "
kpeter@16
    40
            << countArcs(g) << " arc." << std::endl;
kpeter@5
    41
kpeter@5
    42
  return 0;
kpeter@5
    43
}