Index: demo/lgf_demo.cc
===================================================================
--- demo/lgf_demo.cc	(revision 290)
+++ demo/lgf_demo.cc	(revision 294)
@@ -45,5 +45,5 @@
 
   try {
-    digraphReader("digraph.lgf", g). // read the directed graph into g
+    digraphReader(g, "digraph.lgf"). // read the directed graph into g
       arcMap("capacity", cap).       // read the 'capacity' arc map into cap
       node("source", s).             // read 'source' node to s
@@ -61,5 +61,5 @@
   std::cout << "We can write it to the standard output:" << std::endl;
 
-  digraphWriter(std::cout, g).     // write g to the standard output
+  digraphWriter(g).                // write g to the standard output
     arcMap("capacity", cap).       // write cap into 'capacity'
     node("source", s).             // write s to 'source'
Index: lemon/lgf_reader.h
===================================================================
--- lemon/lgf_reader.h	(revision 291)
+++ lemon/lgf_reader.h	(revision 294)
@@ -393,11 +393,12 @@
 
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(std::istream& is, Digraph& digraph);
+  DigraphReader<Digraph> digraphReader(Digraph& digraph,
+                                       std::istream& is = std::cin);
 
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(const std::string& fn, Digraph& digraph);
+  DigraphReader<Digraph> digraphReader(Digraph& digraph, const std::string& fn);
 
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(const char *fn, Digraph& digraph);
+  DigraphReader<Digraph> digraphReader(Digraph& digraph, const char *fn);
 
   /// \ingroup lemon_io
@@ -422,5 +423,5 @@
   ///
   ///\code
-  /// DigraphReader<Digraph>(std::cin, digraph).
+  /// DigraphReader<Digraph>(digraph, std::cin).
   ///   nodeMap("coordinates", coord_map).
   ///   arcMap("capacity", cap_map).
@@ -503,5 +504,5 @@
     /// Construct a directed graph reader, which reads from the given
     /// input stream.
-    DigraphReader(std::istream& is, Digraph& digraph)
+    DigraphReader(Digraph& digraph, std::istream& is = std::cin)
       : _is(&is), local_is(false), _digraph(digraph),
         _use_nodes(false), _use_arcs(false),
@@ -512,5 +513,5 @@
     /// Construct a directed graph reader, which reads from the given
     /// file.
-    DigraphReader(const std::string& fn, Digraph& digraph)
+    DigraphReader(Digraph& digraph, const std::string& fn)
       : _is(new std::ifstream(fn.c_str())), local_is(true),
         _filename(fn), _digraph(digraph),
@@ -524,5 +525,5 @@
     /// Construct a directed graph reader, which reads from the given
     /// file.
-    DigraphReader(const char* fn, Digraph& digraph)
+    DigraphReader(Digraph& digraph, const char* fn)
       : _is(new std::ifstream(fn)), local_is(true),
         _filename(fn), _digraph(digraph),
@@ -557,10 +558,10 @@
   private:
 
-    friend DigraphReader<Digraph> digraphReader<>(std::istream& is,
-                                                  Digraph& digraph);
-    friend DigraphReader<Digraph> digraphReader<>(const std::string& fn,
-                                                  Digraph& digraph);
-    friend DigraphReader<Digraph> digraphReader<>(const char *fn,
-                                                  Digraph& digraph);
+    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
+                                                  std::istream& is);
+    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
+                                                  const std::string& fn);
+    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
+                                                  const char *fn);
 
     DigraphReader(DigraphReader& other)
@@ -1188,6 +1189,7 @@
   /// \relates DigraphReader
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(std::istream& is, Digraph& digraph) {
-    DigraphReader<Digraph> tmp(is, digraph);
+  DigraphReader<Digraph> digraphReader(Digraph& digraph,
+                                       std::istream& is = std::cin) {
+    DigraphReader<Digraph> tmp(digraph, is);
     return tmp;
   }
@@ -1198,7 +1200,7 @@
   /// \relates DigraphReader
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(const std::string& fn,
-                                       Digraph& digraph) {
-    DigraphReader<Digraph> tmp(fn, digraph);
+  DigraphReader<Digraph> digraphReader(Digraph& digraph,
+                                       const std::string& fn) {
+    DigraphReader<Digraph> tmp(digraph, fn);
     return tmp;
   }
@@ -1209,6 +1211,6 @@
   /// \relates DigraphReader
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(const char* fn, Digraph& digraph) {
-    DigraphReader<Digraph> tmp(fn, digraph);
+  DigraphReader<Digraph> digraphReader(Digraph& digraph, const char* fn) {
+    DigraphReader<Digraph> tmp(digraph, fn);
     return tmp;
   }
@@ -1218,11 +1220,12 @@
 
   template <typename Graph>
-  GraphReader<Graph> graphReader(std::istream& is, Graph& graph);
+  GraphReader<Graph> graphReader(Graph& graph,
+                                 std::istream& is = std::cin);
 
   template <typename Graph>
-  GraphReader<Graph> graphReader(const std::string& fn, Graph& graph);
+  GraphReader<Graph> graphReader(Graph& graph, const std::string& fn);
 
   template <typename Graph>
-  GraphReader<Graph> graphReader(const char *fn, Graph& graph);
+  GraphReader<Graph> graphReader(Graph& graph, const char *fn);
 
   /// \ingroup lemon_io
@@ -1292,5 +1295,5 @@
     /// Construct an undirected graph reader, which reads from the given
     /// input stream.
-    GraphReader(std::istream& is, Graph& graph)
+    GraphReader(Graph& graph, std::istream& is = std::cin)
       : _is(&is), local_is(false), _graph(graph),
         _use_nodes(false), _use_edges(false),
@@ -1301,5 +1304,5 @@
     /// Construct an undirected graph reader, which reads from the given
     /// file.
-    GraphReader(const std::string& fn, Graph& graph)
+    GraphReader(Graph& graph, const std::string& fn)
       : _is(new std::ifstream(fn.c_str())), local_is(true),
         _filename(fn), _graph(graph),
@@ -1313,5 +1316,5 @@
     /// Construct an undirected graph reader, which reads from the given
     /// file.
-    GraphReader(const char* fn, Graph& graph)
+    GraphReader(Graph& graph, const char* fn)
       : _is(new std::ifstream(fn)), local_is(true),
         _filename(fn), _graph(graph),
@@ -1345,8 +1348,8 @@
 
   private:
-    friend GraphReader<Graph> graphReader<>(std::istream& is, Graph& graph);
-    friend GraphReader<Graph> graphReader<>(const std::string& fn,
-                                            Graph& graph);
-    friend GraphReader<Graph> graphReader<>(const char *fn, Graph& graph);
+    friend GraphReader<Graph> graphReader<>(Graph& graph, std::istream& is);
+    friend GraphReader<Graph> graphReader<>(Graph& graph,
+                                            const std::string& fn);
+    friend GraphReader<Graph> graphReader<>(Graph& graph, const char *fn);
 
     GraphReader(GraphReader& other)
@@ -2022,6 +2025,6 @@
   /// \relates GraphReader
   template <typename Graph>
-  GraphReader<Graph> graphReader(std::istream& is, Graph& graph) {
-    GraphReader<Graph> tmp(is, graph);
+  GraphReader<Graph> graphReader(Graph& graph, std::istream& is = std::cin) {
+    GraphReader<Graph> tmp(graph, is);
     return tmp;
   }
@@ -2032,7 +2035,6 @@
   /// \relates GraphReader
   template <typename Graph>
-  GraphReader<Graph> graphReader(const std::string& fn,
-                                       Graph& graph) {
-    GraphReader<Graph> tmp(fn, graph);
+  GraphReader<Graph> graphReader(Graph& graph, const std::string& fn) {
+    GraphReader<Graph> tmp(graph, fn);
     return tmp;
   }
@@ -2043,6 +2045,6 @@
   /// \relates GraphReader
   template <typename Graph>
-  GraphReader<Graph> graphReader(const char* fn, Graph& graph) {
-    GraphReader<Graph> tmp(fn, graph);
+  GraphReader<Graph> graphReader(Graph& graph, const char* fn) {
+    GraphReader<Graph> tmp(graph, fn);
     return tmp;
   }
Index: lemon/lgf_writer.h
===================================================================
--- lemon/lgf_writer.h	(revision 291)
+++ lemon/lgf_writer.h	(revision 294)
@@ -353,14 +353,14 @@
 
   template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(std::ostream& os,
-                                       const Digraph& digraph);
+  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
+                                       std::ostream& os = std::cout);
 
   template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(const std::string& fn,
-                                       const Digraph& digraph);
+  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
+                                       const std::string& fn);
 
   template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(const char *fn,
-                                       const Digraph& digraph);
+  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
+                                       const char *fn);
 
   /// \ingroup lemon_io
@@ -383,5 +383,5 @@
   ///
   ///\code
-  /// DigraphWriter<Digraph>(std::cout, digraph).
+  /// DigraphWriter<Digraph>(digraph, std::cout).
   ///   nodeMap("coordinates", coord_map).
   ///   nodeMap("size", size).
@@ -453,6 +453,6 @@
     /// Construct a directed graph writer, which writes to the given
     /// output stream.
-    DigraphWriter(std::ostream& is, const Digraph& digraph)
-      : _os(&is), local_os(false), _digraph(digraph),
+    DigraphWriter(const Digraph& digraph, std::ostream& os = std::cout)
+      : _os(&os), local_os(false), _digraph(digraph),
         _skip_nodes(false), _skip_arcs(false) {}
 
@@ -461,5 +461,5 @@
     /// Construct a directed graph writer, which writes to the given
     /// output file.
-    DigraphWriter(const std::string& fn, const Digraph& digraph)
+    DigraphWriter(const Digraph& digraph, const std::string& fn)
       : _os(new std::ofstream(fn.c_str())), local_os(true), _digraph(digraph),
         _skip_nodes(false), _skip_arcs(false) {
@@ -471,5 +471,5 @@
     /// Construct a directed graph writer, which writes to the given
     /// output file.
-    DigraphWriter(const char* fn, const Digraph& digraph)
+    DigraphWriter(const Digraph& digraph, const char* fn)
       : _os(new std::ofstream(fn)), local_os(true), _digraph(digraph),
         _skip_nodes(false), _skip_arcs(false) {
@@ -501,10 +501,10 @@
   private:
 
-    friend DigraphWriter<Digraph> digraphWriter<>(std::ostream& os,
-                                                  const Digraph& digraph);
-    friend DigraphWriter<Digraph> digraphWriter<>(const std::string& fn,
-                                                  const Digraph& digraph);
-    friend DigraphWriter<Digraph> digraphWriter<>(const char *fn,
-                                                  const Digraph& digraph);
+    friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph,
+                                                  std::ostream& os);
+    friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph,
+                                                  const std::string& fn);
+    friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph,
+                                                  const char *fn);
 
     DigraphWriter(DigraphWriter& other)
@@ -913,7 +913,7 @@
   /// \relates DigraphWriter
   template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(std::ostream& os,
-                                       const Digraph& digraph) {
-    DigraphWriter<Digraph> tmp(os, digraph);
+  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
+                                       std::ostream& os = std::cout) {
+    DigraphWriter<Digraph> tmp(digraph, os);
     return tmp;
   }
@@ -924,7 +924,7 @@
   /// \relates DigraphWriter
   template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(const std::string& fn,
-                                       const Digraph& digraph) {
-    DigraphWriter<Digraph> tmp(fn, digraph);
+  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
+                                       const std::string& fn) {
+    DigraphWriter<Digraph> tmp(digraph, fn);
     return tmp;
   }
@@ -935,7 +935,7 @@
   /// \relates DigraphWriter
   template <typename Digraph>
-  DigraphWriter<Digraph> digraphWriter(const char* fn,
-                                       const Digraph& digraph) {
-    DigraphWriter<Digraph> tmp(fn, digraph);
+  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
+                                       const char* fn) {
+    DigraphWriter<Digraph> tmp(digraph, fn);
     return tmp;
   }
@@ -945,11 +945,12 @@
 
   template <typename Graph>
-  GraphWriter<Graph> graphWriter(std::ostream& os, const Graph& graph);
+  GraphWriter<Graph> graphWriter(const Graph& graph,
+                                 std::ostream& os = std::cout);
 
   template <typename Graph>
-  GraphWriter<Graph> graphWriter(const std::string& fn, const Graph& graph);
+  GraphWriter<Graph> graphWriter(const Graph& graph, const std::string& fn);
 
   template <typename Graph>
-  GraphWriter<Graph> graphWriter(const char *fn, const Graph& graph);
+  GraphWriter<Graph> graphWriter(const Graph& graph, const char *fn);
 
   /// \ingroup lemon_io
@@ -1013,6 +1014,6 @@
     /// Construct a directed graph writer, which writes to the given
     /// output stream.
-    GraphWriter(std::ostream& is, const Graph& graph)
-      : _os(&is), local_os(false), _graph(graph),
+    GraphWriter(const Graph& graph, std::ostream& os = std::cout)
+      : _os(&os), local_os(false), _graph(graph),
         _skip_nodes(false), _skip_edges(false) {}
 
@@ -1021,5 +1022,5 @@
     /// Construct a directed graph writer, which writes to the given
     /// output file.
-    GraphWriter(const std::string& fn, const Graph& graph)
+    GraphWriter(const Graph& graph, const std::string& fn)
       : _os(new std::ofstream(fn.c_str())), local_os(true), _graph(graph),
         _skip_nodes(false), _skip_edges(false) {
@@ -1031,5 +1032,5 @@
     /// Construct a directed graph writer, which writes to the given
     /// output file.
-    GraphWriter(const char* fn, const Graph& graph)
+    GraphWriter(const Graph& graph, const char* fn)
       : _os(new std::ofstream(fn)), local_os(true), _graph(graph),
         _skip_nodes(false), _skip_edges(false) {
@@ -1061,10 +1062,10 @@
   private:
 
-    friend GraphWriter<Graph> graphWriter<>(std::ostream& os,
-                                            const Graph& graph);
-    friend GraphWriter<Graph> graphWriter<>(const std::string& fn,
-                                            const Graph& graph);
-    friend GraphWriter<Graph> graphWriter<>(const char *fn,
-                                            const Graph& graph);
+    friend GraphWriter<Graph> graphWriter<>(const Graph& graph,
+                                            std::ostream& os);
+    friend GraphWriter<Graph> graphWriter<>(const Graph& graph,
+                                            const std::string& fn);
+    friend GraphWriter<Graph> graphWriter<>(const Graph& graph,
+                                            const char *fn);
 
     GraphWriter(GraphWriter& other)
@@ -1519,6 +1520,7 @@
   /// \relates GraphWriter
   template <typename Graph>
-  GraphWriter<Graph> graphWriter(std::ostream& os, const Graph& graph) {
-    GraphWriter<Graph> tmp(os, graph);
+  GraphWriter<Graph> graphWriter(const Graph& graph,
+                                 std::ostream& os = std::cout) {
+    GraphWriter<Graph> tmp(graph, os);
     return tmp;
   }
@@ -1529,6 +1531,6 @@
   /// \relates GraphWriter
   template <typename Graph>
-  GraphWriter<Graph> graphWriter(const std::string& fn, const Graph& graph) {
-    GraphWriter<Graph> tmp(fn, graph);
+  GraphWriter<Graph> graphWriter(const Graph& graph, const std::string& fn) {
+    GraphWriter<Graph> tmp(graph, fn);
     return tmp;
   }
@@ -1539,6 +1541,6 @@
   /// \relates GraphWriter
   template <typename Graph>
-  GraphWriter<Graph> graphWriter(const char* fn, const Graph& graph) {
-    GraphWriter<Graph> tmp(fn, graph);
+  GraphWriter<Graph> graphWriter(const Graph& graph, const char* fn) {
+    GraphWriter<Graph> tmp(graph, fn);
     return tmp;
   }
Index: test/bfs_test.cc
===================================================================
--- test/bfs_test.cc	(revision 286)
+++ test/bfs_test.cc	(revision 293)
@@ -145,5 +145,5 @@
 
   std::istringstream input(test_lgf);
-  digraphReader(input, G).
+  digraphReader(G, input).
     node("source", s).
     node("target", t).
Index: test/dfs_test.cc
===================================================================
--- test/dfs_test.cc	(revision 286)
+++ test/dfs_test.cc	(revision 293)
@@ -147,5 +147,5 @@
 
   std::istringstream input(test_lgf);
-  digraphReader(input, G).
+  digraphReader(G, input).
     node("source", s).
     node("target", t).
Index: test/dijkstra_test.cc
===================================================================
--- test/dijkstra_test.cc	(revision 286)
+++ test/dijkstra_test.cc	(revision 293)
@@ -143,5 +143,5 @@
 
   std::istringstream input(test_lgf);
-  digraphReader(input, G).
+  digraphReader(G, input).
     arcMap("length", length).
     node("source", s).
Index: test/heap_test.cc
===================================================================
--- test/heap_test.cc	(revision 257)
+++ test/heap_test.cc	(revision 293)
@@ -168,5 +168,5 @@
 
   std::istringstream input(test_lgf);
-  digraphReader(input, digraph).
+  digraphReader(digraph, input).
     arcMap("capacity", length).
     node("source", source).
