-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode_6coloring.js
More file actions
37 lines (27 loc) · 790 Bytes
/
Copy pathnode_6coloring.js
File metadata and controls
37 lines (27 loc) · 790 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
// Copyright: https://mit-license.org/
#include "assert.js"
#include "util.js"
#include "gauss-jordan.js"
#include "undirected_graph.js"
assert.assert(process.argv.length > 2);
var dual = (process.argv.length > 3);
var adj = parse2file(process.argv[2]);
var G = from_adjacency_list(adj);
assert.assert(is_embedding(G));
var pent = pentagons(G);
console.log(pent.length + " pentagons for graph");
var D = dual_graph(G);
console.log(pentagons(D).length + " pentagons for dual graph");
if (n_vertices(G) <= 100) {
print_graph(dual ? D : G, dual ? "dual graph: " : "graph: ")
}
console.log("6-coloring of", dual ? "dual" : "", "graph")
if (dual) {
G = D;
}
var col = six_coloring(G);
var str = ""
forall_vertices(G, function (v) {
str += col[v];
});
console.log(str);