OR-Tools
8.0
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).
28
class
GraphExporter
{
29
public
:
30
// Supported graph formats.
31
enum
GraphFormat
{
32
DOT_FORMAT
,
33
GML_FORMAT
,
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
,
56
GraphExporter::GraphFormat
format);
57
};
58
}
// namespace operations_research
59
60
#endif // OR_TOOLS_UTIL_GRAPH_EXPORT_H_
operations_research::GraphExporter::WriteFooter
virtual void WriteFooter()=0
operations_research::GraphExporter::~GraphExporter
virtual ~GraphExporter()
Definition:
graph_export.cc:26
logging.h
macros.h
operations_research
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
Definition:
dense_doubly_linked_list.h:21
operations_research::GraphExporter::GML_FORMAT
@ GML_FORMAT
Definition:
graph_export.h:33
file.h
File
Definition:
base/file.h:32
operations_research::GraphExporter::WriteHeader
virtual void WriteHeader(const std::string &name)=0
operations_research::GraphExporter
Definition:
graph_export.h:28
operations_research::GraphExporter::GraphFormat
GraphFormat
Definition:
graph_export.h:31
operations_research::GraphExporter::MakeFileExporter
static GraphExporter * MakeFileExporter(File *const file, GraphExporter::GraphFormat format)
Definition:
graph_export.cc:154
file
Definition:
file.cc:141
operations_research::GraphExporter::WriteNode
virtual void WriteNode(const std::string &name, const std::string &label, const std::string &shape, const std::string &color)=0
operations_research::GraphExporter::WriteLink
virtual void WriteLink(const std::string &source, const std::string &destination, const std::string &label)=0
operations_research::GraphExporter::DOT_FORMAT
@ DOT_FORMAT
Definition:
graph_export.h:32
name
const std::string name
Definition:
default_search.cc:807
ortools
util
graph_export.h
Generated by
1.8.20