lemon/dimacs.h
changeset 472 c46afb3f67a6
parent 388 0a3ec097a76c
child 525 635a8375227d
equal deleted inserted replaced
3:69deebfc2863 4:4a59c9ff2ec2
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     2  *
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library.
     3  * This file is a part of LEMON, a generic C++ optimization library.
     4  *
     4  *
     5  * Copyright (C) 2003-2008
     5  * Copyright (C) 2003-2009
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     8  *
     9  * Permission to use, modify and distribute this software is granted
     9  * Permission to use, modify and distribute this software is granted
    10  * provided that this copyright notice appears in all copies. For
    10  * provided that this copyright notice appears in all copies. For
   332   void writeDimacsMat(std::ostream& os, const Digraph &g,
   332   void writeDimacsMat(std::ostream& os, const Digraph &g,
   333                       std::string comment="") {
   333                       std::string comment="") {
   334     typedef typename Digraph::NodeIt NodeIt;
   334     typedef typename Digraph::NodeIt NodeIt;
   335     typedef typename Digraph::ArcIt ArcIt;
   335     typedef typename Digraph::ArcIt ArcIt;
   336 
   336 
   337     if(!comment.empty()) 
   337     if(!comment.empty())
   338       os << "c " << comment << std::endl;
   338       os << "c " << comment << std::endl;
   339     os << "p mat " << g.nodeNum() << " " << g.arcNum() << std::endl;
   339     os << "p mat " << g.nodeNum() << " " << g.arcNum() << std::endl;
   340 
   340 
   341     typename Digraph::template NodeMap<int> nodes(g);
   341     typename Digraph::template NodeMap<int> nodes(g);
   342     int i = 1;
   342     int i = 1;