-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraph.cpp
More file actions
42 lines (29 loc) · 733 Bytes
/
Graph.cpp
File metadata and controls
42 lines (29 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <UGraphviz/Graph.hpp>
#include <UGraphviz/Registry.hpp>
#include <sstream>
#include <cassert>
using namespace Ubpa::UGraphviz;
Graph::Graph(std::string id, bool isDigraph)
: Subgraph{ new Registry, std::move(id) }, isDigraph{ isDigraph } {}
Graph::~Graph() {
delete registry;
}
std::string Graph::Dump() const {
std::stringstream ss;
ss << "strict ";
if (isDigraph)
ss << "di";
ss << Subgraph::Dump(false, isDigraph, 0);
return ss.str();
}
Graph::Graph(Graph&& g) noexcept
: Subgraph{ std::move(g) }, isDigraph{ g.isDigraph }
{
g.registry = nullptr;
}
Graph& Graph::operator=(Graph&& g) noexcept {
Subgraph::operator=(std::move(g));
isDigraph = g.isDigraph;
g.registry = nullptr;
return *this;
}