-
Notifications
You must be signed in to change notification settings - Fork 0
/
graph_ordered_points.h
95 lines (74 loc) · 2.59 KB
/
graph_ordered_points.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
Copyright (c) 2009, Stefano Maggiolo and Nicola Pagani.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
Binary format specifications (for small graph, with chars instead of
ints):
A graph is composed of:
Type | B | Repetitions | Meaning
uchar | 1 | 1 | K (valid from 1)
uchar | 1 | 1 | M (valid from 0)
uchar | 1 | K | g (from 0 to K-1)
uchar | 1 | M | mo (from 0 to M-1)
uchar | 1 | K | l (from 0 to K-1)
uchar | 1 | (K-2)*(K-1)/2 | a (row by row)
Tot: (K^2 + K + 2M + 6) / 2 bytes
A file is composed of:
Type | B | Repetitions | Meaning
uchar | 1 | 1 | Magic (1)
Graph | ... | # | the graphs
uchar | 1 | 1 | Endoffile (0)
*/
#ifndef GRAPH_ORDERED_POINTS_H
#define GRAPH_ORDERED_POINTS_H
#include <algorithm>
#include <vector>
#include <map>
#include <cstdio>
#include "graph.h"
#ifdef START_LAPACK_COMPUTATION
#include <lapackpp/laslv.h>
#include <cmath>
#define EPSILON 0.00000000001
#endif
#ifdef USE_NAUTY
#define MAXN 32
#include <cassert>
#include "nauty/nauty.h"
#include "nauty/naututil.h"
#endif
using namespace std;
class GraphOrderedPoints : public Graph
{
public:
GraphOrderedPoints(int G = -1, int M = -1, int K = -1);
GraphOrderedPoints(const Graph& graph);
GraphOrderedPoints(const GraphOrderedPoints& graph);
GraphOrderedPoints(FILE* f);
bool Equal(GraphOrderedPoints& g2);
#ifdef USE_NAUTY
bool EqualNauty(GraphOrderedPoints& g2);
void ComputeDreadnaut(void);
#endif
bool EqualPermutations(GraphOrderedPoints& g2);
// In which component are the marked points.
vector< int > mo;
void PrintBinary(FILE* f) const;
protected:
};
void Graph2GraphOrderedPointsBT(int x,
map< int, int >& c,
GraphOrderedPoints& h,
vector< GraphOrderedPoints >& ret);
vector< GraphOrderedPoints >& Graph2GraphOrderedPoints(Graph& g);
#endif