OR-Tools  8.2
graph_export.h
Go to the documentation of this file.
1 // Copyright 2010-2018 Google LLC
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 // http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13 
14 #ifndef OR_TOOLS_UTIL_GRAPH_EXPORT_H_
15 #define OR_TOOLS_UTIL_GRAPH_EXPORT_H_
16 
17 #include <string>
18 
19 #include "ortools/base/file.h"
20 #include "ortools/base/logging.h"
21 #include "ortools/base/macros.h"
22 
23 namespace operations_research {
24 // ----- Export to graph file -----
25 
26 // This class will allow the creation of a graph representation.
27 // It supports different formats (see GraphFormat).
29  public:
30  // Supported graph formats.
31  enum GraphFormat {
34  };
35 
36  virtual ~GraphExporter();
37 
38  // Write the header of the graph file.
39  virtual void WriteHeader(const std::string& name) = 0;
40 
41  // Write the footer of the graph file.
42  virtual void WriteFooter() = 0;
43 
44  // Write node in GML or DOT format.
45  virtual void WriteNode(const std::string& name, const std::string& label,
46  const std::string& shape,
47  const std::string& color) = 0;
48 
49  // Adds one link in the generated graph.
50  virtual void WriteLink(const std::string& source,
51  const std::string& destination,
52  const std::string& label) = 0;
53 
54  // Creates a graph exporter that will write to file with a given format.
55  static GraphExporter* MakeFileExporter(File* const file,
57 };
58 } // namespace operations_research
59 
60 #endif // OR_TOOLS_UTIL_GRAPH_EXPORT_H_
Definition: base/file.h:32
virtual void WriteNode(const std::string &name, const std::string &label, const std::string &shape, const std::string &color)=0
virtual void WriteLink(const std::string &source, const std::string &destination, const std::string &label)=0
virtual void WriteHeader(const std::string &name)=0
static GraphExporter * MakeFileExporter(File *const file, GraphExporter::GraphFormat format)
const std::string name
Definition: file.cc:141
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...