OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be found | |
3 // in the LICENSE file. | |
4 | |
5 #include "webgtt/algorithms.h" | |
6 | |
7 #include <sstream> | |
8 #include <vector> | |
9 | |
10 #include "webgtt/graph.h" | |
11 | |
12 namespace webgtt { | |
13 | |
14 std::string GetColoring(const graph::Graph& input_graph) { | |
15 std::vector<int> vertex_colors = input_graph.GetColoring(); | |
16 // Format the message to be sent back to the browser. | |
17 std::ostringstream answer; | |
18 for (size_t i = 0; i < vertex_colors.size(); ++i) { | |
19 answer << vertex_colors[i]; | |
20 if (i != vertex_colors.size() - 1) { | |
21 answer << ','; | |
22 } | |
23 } | |
24 return answer.str(); | |
25 } | |
26 | |
27 } // namespace webgtt | |
OLD | NEW |