-
Notifications
You must be signed in to change notification settings - Fork 5
/
wgraph.h
115 lines (99 loc) · 3.82 KB
/
wgraph.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
This is wgraph.h
Coxeter version 3.0 Copyright (C) 2002 Fokko du Cloux
See file main.cpp for full copyright notice
*/
#ifndef WGRAPH_H /* guard against multiple inclusions */
#define WGRAPH_H
#include "globals.h"
#include "list.h"
namespace wgraph {
using namespace coxeter;
using namespace list;
};
/******** type declarations *************************************************/
namespace wgraph {
class WGraph;
class OrientedGraph;
typedef Ulong Vertex;
typedef unsigned short Coeff;
typedef List<Coeff> CoeffList;
typedef Vertex Edge;
typedef List<Edge> EdgeList;
};
/******** type definitions **************************************************/
#include "bits.h"
#include "interface.h"
namespace wgraph {
using namespace bits;
using namespace interface;
class OrientedGraph {
private:
List<EdgeList> d_edge;
public:
/* constructors and destructors */
void* operator new(size_t size) {return arena().alloc(size);}
void operator delete(void* ptr)
{return arena().free(ptr,sizeof(OrientedGraph));}
OrientedGraph(const Ulong &n):d_edge(n) {};
~OrientedGraph();
/* accessors */
void cells(Partition& pi, OrientedGraph* P = 0) const;
const EdgeList& edge(const Vertex& x) const; /* inlined */
Vertex firstMinimal(const BitMap& b) const;
void levelPartition(Partition& pi) const;
void print(FILE* file) const;
Ulong size() const; /* inlined */
/* modifiers */
EdgeList& edge(const Vertex& x); /* inlined */
void permute(const Permutation& a);
void reset();
void setSize(const Ulong& n); /* inlined */
};
class WGraph {
private:
OrientedGraph* d_graph;
List<CoeffList> d_coeff;
List<LFlags> d_descent;
public:
/* constructors and destructors */
void* operator new(size_t size) {return arena().alloc(size);}
void operator delete(void* ptr)
{return arena().free(ptr,sizeof(WGraph));}
WGraph(const Ulong &n);
~WGraph();
/* accessors */
const CoeffList& coeffList(const Vertex& x) const; /* inlined */
const LFlags& descent(const Vertex& x) const; /* inlined */
const EdgeList& edge(const Vertex& x) const; /* inlined */
const OrientedGraph& graph() const; /* inlined */
Ulong size() const; /* inlined */
/* modifiers */
CoeffList& coeffList(const Vertex& x); /* inlined */
LFlags& descent(const Vertex& x); /* inlined */
EdgeList& edge(const Vertex& x); /* inlined */
OrientedGraph& graph(); /* inlined */
void reset();
void setSize(const Ulong& n);
/* input/output */
void print(FILE* file, const Interface& I) const;
};
inline const CoeffList& WGraph::coeffList(const Vertex& x) const
{return d_coeff[x];}
inline const LFlags& WGraph::descent(const Vertex& x) const
{return d_descent[x];}
inline const EdgeList& WGraph::edge(const Vertex& x) const
{return d_graph->edge(x);}
inline const OrientedGraph& WGraph::graph() const {return *d_graph;}
inline CoeffList& WGraph::coeffList(const Vertex& x) {return d_coeff[x];}
inline EdgeList& WGraph::edge(const Vertex& x) {return d_graph->edge(x);}
inline Ulong WGraph::size() const {return d_graph->size();}
inline OrientedGraph& WGraph::graph() {return *d_graph;}
inline LFlags& WGraph::descent(const Vertex& x) {return d_descent[x];}
inline const EdgeList& OrientedGraph::edge(const Vertex& x) const
{return d_edge[x];}
inline Ulong OrientedGraph::size() const {return d_edge.size();}
inline EdgeList& OrientedGraph::edge(const Vertex& x) {return d_edge[x];}
inline void OrientedGraph::setSize(const Ulong& n) {d_edge.setSize(n);}
}
#endif