-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconf_model.h
65 lines (47 loc) · 1.79 KB
/
conf_model.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
//
// Created by nick434434 on 19-10-19.
//
#pragma once
#ifndef NUMERICALASSIGNMENTPS2_CONF_MODEL_H
#define NUMERICALASSIGNMENTPS2_CONF_MODEL_H
#include "prob_stuff.h"
#include <boost/graph/undirected_graph.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_traits.hpp>
using std::pair;
// multisetS for OutEdgeList is used to ensure multiple edges are possible
typedef boost::undirected_graph<> UGraph;
typedef boost::property<boost::edge_weight_t, double> EdgeWeightProperty;
typedef boost::adjacency_list<boost::multisetS, boost::vecS, boost::undirectedS, boost::no_property, EdgeWeightProperty> Graph;
// typedef boost:: Matrix;
class ConfigurationModel {
private:
// Base variable for storing generated realization
Graph g;
// Base variable for storing degrees of vertices
vector<long> degrees;
// Number of vertices
long n = 0;
// Temporary variable for constructing realization
vector<pair<long, long>> he = vector<pair<long, long>>();
public:
// Graph distance
double distance = 0;
ConfigurationModel() = default;
explicit ConfigurationModel(long n): n(n), degrees(vector<long>(n, 0)) {}
// template<class Container>
explicit ConfigurationModel(const vector<long>& new_degrees);
~ConfigurationModel();
/*
* Each half-edge has vertex attachment as 2nd elem of pair and reserved first elem for number of paired half-edge
*/
void make_half_edges();
/*
* Connecting half-edges by creating edges in @field g and filling in numbers of paired half-edges
*/
void connect_half_edges();
void clear_realization();
void compute_distance(bool average = false, bool use_johnson = false);
void get_graphviz(const std::string& dot_fname);
};
#endif //NUMERICALASSIGNMENTPS2_CONF_MODEL_H