# HG changeset patch
# User Peter Kovacs <kpeter@inf.elte.hu>
# Date 1222857856 -7200
# Node ID 47fbc814aa31e11f181b22cb79022ad4fa25558c
# Parent d91884dcd572f8f69253ac1d304f0a4a651da76c
Change the parameter order in LGF reader and writer tools
diff --git a/demo/lgf_demo.cc b/demo/lgf_demo.cc
|
a
|
b
|
|
| 44 | 44 | SmartDigraph::Node s, t; |
| 45 | 45 | |
| 46 | 46 | try { |
| 47 | | digraphReader("digraph.lgf", g). // read the directed graph into g |
| | 47 | digraphReader(g, "digraph.lgf"). // read the directed graph into g |
| 48 | 48 | arcMap("capacity", cap). // read the 'capacity' arc map into cap |
| 49 | 49 | node("source", s). // read 'source' node to s |
| 50 | 50 | node("target", t). // read 'target' node to t |
| … |
… |
|
| 60 | 60 | |
| 61 | 61 | std::cout << "We can write it to the standard output:" << std::endl; |
| 62 | 62 | |
| 63 | | digraphWriter(std::cout, g). // write g to the standard output |
| | 63 | digraphWriter(g). // write g to the standard output |
| 64 | 64 | arcMap("capacity", cap). // write cap into 'capacity' |
| 65 | 65 | node("source", s). // write s to 'source' |
| 66 | 66 | node("target", t). // write t to 'target' |
diff --git a/lemon/lgf_reader.h b/lemon/lgf_reader.h
|
a
|
b
|
|
| 390 | 390 | class DigraphReader; |
| 391 | 391 | |
| 392 | 392 | template <typename Digraph> |
| 393 | | DigraphReader<Digraph> digraphReader(std::istream& is, Digraph& digraph); |
| | 393 | DigraphReader<Digraph> digraphReader(Digraph& digraph, |
| | 394 | std::istream& is = std::cin); |
| 394 | 395 | |
| 395 | 396 | template <typename Digraph> |
| 396 | | DigraphReader<Digraph> digraphReader(const std::string& fn, Digraph& digraph); |
| | 397 | DigraphReader<Digraph> digraphReader(Digraph& digraph, const std::string& fn); |
| 397 | 398 | |
| 398 | 399 | template <typename Digraph> |
| 399 | | DigraphReader<Digraph> digraphReader(const char *fn, Digraph& digraph); |
| | 400 | DigraphReader<Digraph> digraphReader(Digraph& digraph, const char *fn); |
| 400 | 401 | |
| 401 | 402 | /// \ingroup lemon_io |
| 402 | 403 | /// |
| … |
… |
|
| 419 | 420 | /// rules. |
| 420 | 421 | /// |
| 421 | 422 | ///\code |
| 422 | | /// DigraphReader<Digraph>(std::cin, digraph). |
| | 423 | /// DigraphReader<Digraph>(digraph, std::cin). |
| 423 | 424 | /// nodeMap("coordinates", coord_map). |
| 424 | 425 | /// arcMap("capacity", cap_map). |
| 425 | 426 | /// node("source", src). |
| … |
… |
|
| 499 | 500 | /// |
| 500 | 501 | /// Construct a directed graph reader, which reads from the given |
| 501 | 502 | /// input stream. |
| 502 | | DigraphReader(std::istream& is, Digraph& digraph) |
| | 503 | DigraphReader(Digraph& digraph, std::istream& is = std::cin) |
| 503 | 504 | : _is(&is), local_is(false), _digraph(digraph), |
| 504 | 505 | _use_nodes(false), _use_arcs(false), |
| 505 | 506 | _skip_nodes(false), _skip_arcs(false) {} |
| … |
… |
|
| 508 | 509 | /// |
| 509 | 510 | /// Construct a directed graph reader, which reads from the given |
| 510 | 511 | /// file. |
| 511 | | DigraphReader(const std::string& fn, Digraph& digraph) |
| | 512 | DigraphReader(Digraph& digraph, const std::string& fn) |
| 512 | 513 | : _is(new std::ifstream(fn.c_str())), local_is(true), _digraph(digraph), |
| 513 | 514 | _use_nodes(false), _use_arcs(false), |
| 514 | 515 | _skip_nodes(false), _skip_arcs(false) {} |
| … |
… |
|
| 517 | 518 | /// |
| 518 | 519 | /// Construct a directed graph reader, which reads from the given |
| 519 | 520 | /// file. |
| 520 | | DigraphReader(const char* fn, Digraph& digraph) |
| | 521 | DigraphReader(Digraph& digraph, const char* fn) |
| 521 | 522 | : _is(new std::ifstream(fn)), local_is(true), _digraph(digraph), |
| 522 | 523 | _use_nodes(false), _use_arcs(false), |
| 523 | 524 | _skip_nodes(false), _skip_arcs(false) {} |
| … |
… |
|
| 547 | 548 | |
| 548 | 549 | private: |
| 549 | 550 | |
| 550 | | friend DigraphReader<Digraph> digraphReader<>(std::istream& is, |
| 551 | | Digraph& digraph); |
| 552 | | friend DigraphReader<Digraph> digraphReader<>(const std::string& fn, |
| 553 | | Digraph& digraph); |
| 554 | | friend DigraphReader<Digraph> digraphReader<>(const char *fn, |
| 555 | | Digraph& digraph); |
| | 551 | friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph, |
| | 552 | std::istream& is); |
| | 553 | friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph, |
| | 554 | const std::string& fn); |
| | 555 | friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph, |
| | 556 | const char *fn); |
| 556 | 557 | |
| 557 | 558 | DigraphReader(DigraphReader& other) |
| 558 | 559 | : _is(other._is), local_is(other.local_is), _digraph(other._digraph), |
| … |
… |
|
| 1180 | 1181 | /// This function just returns a \ref DigraphReader class. |
| 1181 | 1182 | /// \relates DigraphReader |
| 1182 | 1183 | template <typename Digraph> |
| 1183 | | DigraphReader<Digraph> digraphReader(std::istream& is, Digraph& digraph) { |
| 1184 | | DigraphReader<Digraph> tmp(is, digraph); |
| | 1184 | DigraphReader<Digraph> digraphReader(Digraph& digraph, |
| | 1185 | std::istream& is = std::cin) { |
| | 1186 | DigraphReader<Digraph> tmp(digraph, is); |
| 1185 | 1187 | return tmp; |
| 1186 | 1188 | } |
| 1187 | 1189 | |
| … |
… |
|
| 1190 | 1192 | /// This function just returns a \ref DigraphReader class. |
| 1191 | 1193 | /// \relates DigraphReader |
| 1192 | 1194 | template <typename Digraph> |
| 1193 | | DigraphReader<Digraph> digraphReader(const std::string& fn, |
| 1194 | | Digraph& digraph) { |
| 1195 | | DigraphReader<Digraph> tmp(fn, digraph); |
| | 1195 | DigraphReader<Digraph> digraphReader(Digraph& digraph, |
| | 1196 | const std::string& fn) { |
| | 1197 | DigraphReader<Digraph> tmp(digraph, fn); |
| 1196 | 1198 | return tmp; |
| 1197 | 1199 | } |
| 1198 | 1200 | |
| … |
… |
|
| 1201 | 1203 | /// This function just returns a \ref DigraphReader class. |
| 1202 | 1204 | /// \relates DigraphReader |
| 1203 | 1205 | template <typename Digraph> |
| 1204 | | DigraphReader<Digraph> digraphReader(const char* fn, Digraph& digraph) { |
| 1205 | | DigraphReader<Digraph> tmp(fn, digraph); |
| | 1206 | DigraphReader<Digraph> digraphReader(Digraph& digraph, const char* fn) { |
| | 1207 | DigraphReader<Digraph> tmp(digraph, fn); |
| 1206 | 1208 | return tmp; |
| 1207 | 1209 | } |
| 1208 | 1210 | |
| … |
… |
|
| 1210 | 1212 | class GraphReader; |
| 1211 | 1213 | |
| 1212 | 1214 | template <typename Graph> |
| 1213 | | GraphReader<Graph> graphReader(std::istream& is, Graph& graph); |
| | 1215 | GraphReader<Graph> graphReader(Graph& graph, |
| | 1216 | std::istream& is = std::cin); |
| 1214 | 1217 | |
| 1215 | 1218 | template <typename Graph> |
| 1216 | | GraphReader<Graph> graphReader(const std::string& fn, Graph& graph); |
| | 1219 | GraphReader<Graph> graphReader(Graph& graph, const std::string& fn); |
| 1217 | 1220 | |
| 1218 | 1221 | template <typename Graph> |
| 1219 | | GraphReader<Graph> graphReader(const char *fn, Graph& graph); |
| | 1222 | GraphReader<Graph> graphReader(Graph& graph, const char *fn); |
| 1220 | 1223 | |
| 1221 | 1224 | /// \ingroup lemon_io |
| 1222 | 1225 | /// |
| … |
… |
|
| 1283 | 1286 | /// |
| 1284 | 1287 | /// Construct an undirected graph reader, which reads from the given |
| 1285 | 1288 | /// input stream. |
| 1286 | | GraphReader(std::istream& is, Graph& graph) |
| | 1289 | GraphReader(Graph& graph, std::istream& is = std::cin) |
| 1287 | 1290 | : _is(&is), local_is(false), _graph(graph), |
| 1288 | 1291 | _use_nodes(false), _use_edges(false), |
| 1289 | 1292 | _skip_nodes(false), _skip_edges(false) {} |
| … |
… |
|
| 1292 | 1295 | /// |
| 1293 | 1296 | /// Construct an undirected graph reader, which reads from the given |
| 1294 | 1297 | /// file. |
| 1295 | | GraphReader(const std::string& fn, Graph& graph) |
| | 1298 | GraphReader(Graph& graph, const std::string& fn) |
| 1296 | 1299 | : _is(new std::ifstream(fn.c_str())), local_is(true), _graph(graph), |
| 1297 | 1300 | _use_nodes(false), _use_edges(false), |
| 1298 | 1301 | _skip_nodes(false), _skip_edges(false) {} |
| … |
… |
|
| 1301 | 1304 | /// |
| 1302 | 1305 | /// Construct an undirected graph reader, which reads from the given |
| 1303 | 1306 | /// file. |
| 1304 | | GraphReader(const char* fn, Graph& graph) |
| | 1307 | GraphReader(Graph& graph, const char* fn) |
| 1305 | 1308 | : _is(new std::ifstream(fn)), local_is(true), _graph(graph), |
| 1306 | 1309 | _use_nodes(false), _use_edges(false), |
| 1307 | 1310 | _skip_nodes(false), _skip_edges(false) {} |
| … |
… |
|
| 1330 | 1333 | } |
| 1331 | 1334 | |
| 1332 | 1335 | private: |
| 1333 | | friend GraphReader<Graph> graphReader<>(std::istream& is, Graph& graph); |
| 1334 | | friend GraphReader<Graph> graphReader<>(const std::string& fn, |
| 1335 | | Graph& graph); |
| 1336 | | friend GraphReader<Graph> graphReader<>(const char *fn, Graph& graph); |
| | 1336 | friend GraphReader<Graph> graphReader<>(Graph& graph, std::istream& is); |
| | 1337 | friend GraphReader<Graph> graphReader<>(Graph& graph, |
| | 1338 | const std::string& fn); |
| | 1339 | friend GraphReader<Graph> graphReader<>(Graph& graph, const char *fn); |
| 1337 | 1340 | |
| 1338 | 1341 | GraphReader(GraphReader& other) |
| 1339 | 1342 | : _is(other._is), local_is(other.local_is), _graph(other._graph), |
| … |
… |
|
| 2006 | 2009 | /// This function just returns a \ref GraphReader class. |
| 2007 | 2010 | /// \relates GraphReader |
| 2008 | 2011 | template <typename Graph> |
| 2009 | | GraphReader<Graph> graphReader(std::istream& is, Graph& graph) { |
| 2010 | | GraphReader<Graph> tmp(is, graph); |
| | 2012 | GraphReader<Graph> graphReader(Graph& graph, std::istream& is = std::cin) { |
| | 2013 | GraphReader<Graph> tmp(graph, is); |
| 2011 | 2014 | return tmp; |
| 2012 | 2015 | } |
| 2013 | 2016 | |
| … |
… |
|
| 2016 | 2019 | /// This function just returns a \ref GraphReader class. |
| 2017 | 2020 | /// \relates GraphReader |
| 2018 | 2021 | template <typename Graph> |
| 2019 | | GraphReader<Graph> graphReader(const std::string& fn, |
| 2020 | | Graph& graph) { |
| 2021 | | GraphReader<Graph> tmp(fn, graph); |
| | 2022 | GraphReader<Graph> graphReader(Graph& graph, const std::string& fn) { |
| | 2023 | GraphReader<Graph> tmp(graph, fn); |
| 2022 | 2024 | return tmp; |
| 2023 | 2025 | } |
| 2024 | 2026 | |
| … |
… |
|
| 2027 | 2029 | /// This function just returns a \ref GraphReader class. |
| 2028 | 2030 | /// \relates GraphReader |
| 2029 | 2031 | template <typename Graph> |
| 2030 | | GraphReader<Graph> graphReader(const char* fn, Graph& graph) { |
| 2031 | | GraphReader<Graph> tmp(fn, graph); |
| | 2032 | GraphReader<Graph> graphReader(Graph& graph, const char* fn) { |
| | 2033 | GraphReader<Graph> tmp(graph, fn); |
| 2032 | 2034 | return tmp; |
| 2033 | 2035 | } |
| 2034 | 2036 | |
diff --git a/lemon/lgf_writer.h b/lemon/lgf_writer.h
|
a
|
b
|
|
| 352 | 352 | class DigraphWriter; |
| 353 | 353 | |
| 354 | 354 | template <typename Digraph> |
| 355 | | DigraphWriter<Digraph> digraphWriter(std::ostream& os, |
| 356 | | const Digraph& digraph); |
| | 355 | DigraphWriter<Digraph> digraphWriter(const Digraph& digraph, |
| | 356 | std::ostream& os = std::cout); |
| 357 | 357 | |
| 358 | 358 | template <typename Digraph> |
| 359 | | DigraphWriter<Digraph> digraphWriter(const std::string& fn, |
| 360 | | const Digraph& digraph); |
| | 359 | DigraphWriter<Digraph> digraphWriter(const Digraph& digraph, |
| | 360 | const std::string& fn); |
| 361 | 361 | |
| 362 | 362 | template <typename Digraph> |
| 363 | | DigraphWriter<Digraph> digraphWriter(const char *fn, |
| 364 | | const Digraph& digraph); |
| | 363 | DigraphWriter<Digraph> digraphWriter(const Digraph& digraph, |
| | 364 | const char *fn); |
| 365 | 365 | |
| 366 | 366 | /// \ingroup lemon_io |
| 367 | 367 | /// |
| … |
… |
|
| 382 | 382 | /// arc() functions are used to add attribute writing rules. |
| 383 | 383 | /// |
| 384 | 384 | ///\code |
| 385 | | /// DigraphWriter<Digraph>(std::cout, digraph). |
| | 385 | /// DigraphWriter<Digraph>(digraph, std::cout). |
| 386 | 386 | /// nodeMap("coordinates", coord_map). |
| 387 | 387 | /// nodeMap("size", size). |
| 388 | 388 | /// nodeMap("title", title). |
| … |
… |
|
| 452 | 452 | /// |
| 453 | 453 | /// Construct a directed graph writer, which writes to the given |
| 454 | 454 | /// output stream. |
| 455 | | DigraphWriter(std::ostream& is, const Digraph& digraph) |
| 456 | | : _os(&is), local_os(false), _digraph(digraph), |
| | 455 | DigraphWriter(const Digraph& digraph, std::ostream& os = std::cout) |
| | 456 | : _os(&os), local_os(false), _digraph(digraph), |
| 457 | 457 | _skip_nodes(false), _skip_arcs(false) {} |
| 458 | 458 | |
| 459 | 459 | /// \brief Constructor |
| 460 | 460 | /// |
| 461 | 461 | /// Construct a directed graph writer, which writes to the given |
| 462 | 462 | /// output file. |
| 463 | | DigraphWriter(const std::string& fn, const Digraph& digraph) |
| | 463 | DigraphWriter(const Digraph& digraph, const std::string& fn) |
| 464 | 464 | : _os(new std::ofstream(fn.c_str())), local_os(true), _digraph(digraph), |
| 465 | 465 | _skip_nodes(false), _skip_arcs(false) {} |
| 466 | 466 | |
| … |
… |
|
| 468 | 468 | /// |
| 469 | 469 | /// Construct a directed graph writer, which writes to the given |
| 470 | 470 | /// output file. |
| 471 | | DigraphWriter(const char* fn, const Digraph& digraph) |
| | 471 | DigraphWriter(const Digraph& digraph, const char* fn) |
| 472 | 472 | : _os(new std::ofstream(fn)), local_os(true), _digraph(digraph), |
| 473 | 473 | _skip_nodes(false), _skip_arcs(false) {} |
| 474 | 474 | |
| … |
… |
|
| 496 | 496 | |
| 497 | 497 | private: |
| 498 | 498 | |
| 499 | | friend DigraphWriter<Digraph> digraphWriter<>(std::ostream& os, |
| 500 | | const Digraph& digraph); |
| 501 | | friend DigraphWriter<Digraph> digraphWriter<>(const std::string& fn, |
| 502 | | const Digraph& digraph); |
| 503 | | friend DigraphWriter<Digraph> digraphWriter<>(const char *fn, |
| 504 | | const Digraph& digraph); |
| | 499 | friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph, |
| | 500 | std::ostream& os); |
| | 501 | friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph, |
| | 502 | const std::string& fn); |
| | 503 | friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph, |
| | 504 | const char *fn); |
| 505 | 505 | |
| 506 | 506 | DigraphWriter(DigraphWriter& other) |
| 507 | 507 | : _os(other._os), local_os(other.local_os), _digraph(other._digraph), |
| … |
… |
|
| 908 | 908 | /// This function just returns a \ref DigraphWriter class. |
| 909 | 909 | /// \relates DigraphWriter |
| 910 | 910 | template <typename Digraph> |
| 911 | | DigraphWriter<Digraph> digraphWriter(std::ostream& os, |
| 912 | | const Digraph& digraph) { |
| 913 | | DigraphWriter<Digraph> tmp(os, digraph); |
| | 911 | DigraphWriter<Digraph> digraphWriter(const Digraph& digraph, |
| | 912 | std::ostream& os = std::cout) { |
| | 913 | DigraphWriter<Digraph> tmp(digraph, os); |
| 914 | 914 | return tmp; |
| 915 | 915 | } |
| 916 | 916 | |
| … |
… |
|
| 919 | 919 | /// This function just returns a \ref DigraphWriter class. |
| 920 | 920 | /// \relates DigraphWriter |
| 921 | 921 | template <typename Digraph> |
| 922 | | DigraphWriter<Digraph> digraphWriter(const std::string& fn, |
| 923 | | const Digraph& digraph) { |
| 924 | | DigraphWriter<Digraph> tmp(fn, digraph); |
| | 922 | DigraphWriter<Digraph> digraphWriter(const Digraph& digraph, |
| | 923 | const std::string& fn) { |
| | 924 | DigraphWriter<Digraph> tmp(digraph, fn); |
| 925 | 925 | return tmp; |
| 926 | 926 | } |
| 927 | 927 | |
| … |
… |
|
| 930 | 930 | /// This function just returns a \ref DigraphWriter class. |
| 931 | 931 | /// \relates DigraphWriter |
| 932 | 932 | template <typename Digraph> |
| 933 | | DigraphWriter<Digraph> digraphWriter(const char* fn, |
| 934 | | const Digraph& digraph) { |
| 935 | | DigraphWriter<Digraph> tmp(fn, digraph); |
| | 933 | DigraphWriter<Digraph> digraphWriter(const Digraph& digraph, |
| | 934 | const char* fn) { |
| | 935 | DigraphWriter<Digraph> tmp(digraph, fn); |
| 936 | 936 | return tmp; |
| 937 | 937 | } |
| 938 | 938 | |
| … |
… |
|
| 940 | 940 | class GraphWriter; |
| 941 | 941 | |
| 942 | 942 | template <typename Graph> |
| 943 | | GraphWriter<Graph> graphWriter(std::ostream& os, const Graph& graph); |
| | 943 | GraphWriter<Graph> graphWriter(const Graph& graph, |
| | 944 | std::ostream& os = std::cout); |
| 944 | 945 | |
| 945 | 946 | template <typename Graph> |
| 946 | | GraphWriter<Graph> graphWriter(const std::string& fn, const Graph& graph); |
| | 947 | GraphWriter<Graph> graphWriter(const Graph& graph, const std::string& fn); |
| 947 | 948 | |
| 948 | 949 | template <typename Graph> |
| 949 | | GraphWriter<Graph> graphWriter(const char *fn, const Graph& graph); |
| | 950 | GraphWriter<Graph> graphWriter(const Graph& graph, const char *fn); |
| 950 | 951 | |
| 951 | 952 | /// \ingroup lemon_io |
| 952 | 953 | /// |
| … |
… |
|
| 1008 | 1009 | /// |
| 1009 | 1010 | /// Construct a directed graph writer, which writes to the given |
| 1010 | 1011 | /// output stream. |
| 1011 | | GraphWriter(std::ostream& is, const Graph& graph) |
| 1012 | | : _os(&is), local_os(false), _graph(graph), |
| | 1012 | GraphWriter(const Graph& graph, std::ostream& os = std::cout) |
| | 1013 | : _os(&os), local_os(false), _graph(graph), |
| 1013 | 1014 | _skip_nodes(false), _skip_edges(false) {} |
| 1014 | 1015 | |
| 1015 | 1016 | /// \brief Constructor |
| 1016 | 1017 | /// |
| 1017 | 1018 | /// Construct a directed graph writer, which writes to the given |
| 1018 | 1019 | /// output file. |
| 1019 | | GraphWriter(const std::string& fn, const Graph& graph) |
| | 1020 | GraphWriter(const Graph& graph, const std::string& fn) |
| 1020 | 1021 | : _os(new std::ofstream(fn.c_str())), local_os(true), _graph(graph), |
| 1021 | 1022 | _skip_nodes(false), _skip_edges(false) {} |
| 1022 | 1023 | |
| … |
… |
|
| 1024 | 1025 | /// |
| 1025 | 1026 | /// Construct a directed graph writer, which writes to the given |
| 1026 | 1027 | /// output file. |
| 1027 | | GraphWriter(const char* fn, const Graph& graph) |
| | 1028 | GraphWriter(const Graph& graph, const char* fn) |
| 1028 | 1029 | : _os(new std::ofstream(fn)), local_os(true), _graph(graph), |
| 1029 | 1030 | _skip_nodes(false), _skip_edges(false) {} |
| 1030 | 1031 | |
| … |
… |
|
| 1052 | 1053 | |
| 1053 | 1054 | private: |
| 1054 | 1055 | |
| 1055 | | friend GraphWriter<Graph> graphWriter<>(std::ostream& os, |
| 1056 | | const Graph& graph); |
| 1057 | | friend GraphWriter<Graph> graphWriter<>(const std::string& fn, |
| 1058 | | const Graph& graph); |
| 1059 | | friend GraphWriter<Graph> graphWriter<>(const char *fn, |
| 1060 | | const Graph& graph); |
| | 1056 | friend GraphWriter<Graph> graphWriter<>(const Graph& graph, |
| | 1057 | std::ostream& os); |
| | 1058 | friend GraphWriter<Graph> graphWriter<>(const Graph& graph, |
| | 1059 | const std::string& fn); |
| | 1060 | friend GraphWriter<Graph> graphWriter<>(const Graph& graph, |
| | 1061 | const char *fn); |
| 1061 | 1062 | |
| 1062 | 1063 | GraphWriter(GraphWriter& other) |
| 1063 | 1064 | : _os(other._os), local_os(other.local_os), _graph(other._graph), |
| … |
… |
|
| 1510 | 1511 | /// This function just returns a \ref GraphWriter class. |
| 1511 | 1512 | /// \relates GraphWriter |
| 1512 | 1513 | template <typename Graph> |
| 1513 | | GraphWriter<Graph> graphWriter(std::ostream& os, const Graph& graph) { |
| 1514 | | GraphWriter<Graph> tmp(os, graph); |
| | 1514 | GraphWriter<Graph> graphWriter(const Graph& graph, |
| | 1515 | std::ostream& os = std::cout) { |
| | 1516 | GraphWriter<Graph> tmp(graph, os); |
| 1515 | 1517 | return tmp; |
| 1516 | 1518 | } |
| 1517 | 1519 | |
| … |
… |
|
| 1520 | 1522 | /// This function just returns a \ref GraphWriter class. |
| 1521 | 1523 | /// \relates GraphWriter |
| 1522 | 1524 | template <typename Graph> |
| 1523 | | GraphWriter<Graph> graphWriter(const std::string& fn, const Graph& graph) { |
| 1524 | | GraphWriter<Graph> tmp(fn, graph); |
| | 1525 | GraphWriter<Graph> graphWriter(const Graph& graph, const std::string& fn) { |
| | 1526 | GraphWriter<Graph> tmp(graph, fn); |
| 1525 | 1527 | return tmp; |
| 1526 | 1528 | } |
| 1527 | 1529 | |
| … |
… |
|
| 1530 | 1532 | /// This function just returns a \ref GraphWriter class. |
| 1531 | 1533 | /// \relates GraphWriter |
| 1532 | 1534 | template <typename Graph> |
| 1533 | | GraphWriter<Graph> graphWriter(const char* fn, const Graph& graph) { |
| 1534 | | GraphWriter<Graph> tmp(fn, graph); |
| | 1535 | GraphWriter<Graph> graphWriter(const Graph& graph, const char* fn) { |
| | 1536 | GraphWriter<Graph> tmp(graph, fn); |
| 1535 | 1537 | return tmp; |
| 1536 | 1538 | } |
| 1537 | 1539 | |
diff --git a/test/bfs_test.cc b/test/bfs_test.cc
|
a
|
b
|
|
| 144 | 144 | Node s, t; |
| 145 | 145 | |
| 146 | 146 | std::istringstream input(test_lgf); |
| 147 | | digraphReader(input, G). |
| | 147 | digraphReader(G, input). |
| 148 | 148 | node("source", s). |
| 149 | 149 | node("target", t). |
| 150 | 150 | run(); |
diff --git a/test/dfs_test.cc b/test/dfs_test.cc
|
a
|
b
|
|
| 146 | 146 | Node s, t; |
| 147 | 147 | |
| 148 | 148 | std::istringstream input(test_lgf); |
| 149 | | digraphReader(input, G). |
| | 149 | digraphReader(G, input). |
| 150 | 150 | node("source", s). |
| 151 | 151 | node("target", t). |
| 152 | 152 | run(); |
diff --git a/test/dijkstra_test.cc b/test/dijkstra_test.cc
|
a
|
b
|
|
| 142 | 142 | LengthMap length(G); |
| 143 | 143 | |
| 144 | 144 | std::istringstream input(test_lgf); |
| 145 | | digraphReader(input, G). |
| | 145 | digraphReader(G, input). |
| 146 | 146 | arcMap("length", length). |
| 147 | 147 | node("source", s). |
| 148 | 148 | node("target", t). |
diff --git a/test/heap_test.cc b/test/heap_test.cc
|
a
|
b
|
|
| 167 | 167 | Node source; |
| 168 | 168 | |
| 169 | 169 | std::istringstream input(test_lgf); |
| 170 | | digraphReader(input, digraph). |
| | 170 | digraphReader(digraph, input). |
| 171 | 171 | arcMap("capacity", length). |
| 172 | 172 | node("source", source). |
| 173 | 173 | run(); |