graph

Structs

Graph

struct Graph : public ioh::common::HasRepr

Abstraction of graph data.

Subclassed by ioh::problem::submodular::pwt::TTPGraph

Public Functions

inline Graph(const Meta &meta)

Constructor from meta data.

inline Graph(const std::string &definition)

Constructor from string.

inline virtual std::string repr() const override

String representation.

inline fs::path path(const std::string &file) const

Load method.

The path of one of the graph’s files: in the data directory for a built-in graph, otherwise in the directory of its definitions file. Throws ioh::data::data_error when it does not exist.

inline virtual void load()
inline int dimension()

Accessor for dimension, loads the graph if it is not loaded.

Public Members

Meta meta

Meta data.

std::vector<std::vector<std::pair<int, double>>> adjacency_list

Adjacency list.

std::vector<std::tuple<int, int, double>> edges

Edge list.

std::vector<double> edge_weights

Edge weights.

std::vector<double> vertex_weights

Vertex weights.

std::vector<double> constraint_weights

Constraint weights.

std::vector<double> constraint_variances
double chance_cons
bool loaded = false

Flag to denoted wheter the graph has been loaded in memory.

std::mutex load_mutex

Held while the graph is loaded, so that it is loaded once, also when problems are created in parallel.

Meta

struct Meta

Graph meta data.

Public Members

std::string edge_file

File with edge data.

std::string edge_weights

file with edge weights

std::string vertex_weights

File with vertex weights.

std::string constraint_weights

File with constraint weights.

std::string constraint_variances

File with constraint variances.

fs::path root

The directory of the files: that of the definitions file for a graph loaded from one, empty for the built-in graphs, whose files are in the data directory (see ioh::data::root)

bool is_edge = false

Edge type.

bool digraph = false

Fixed chance constraint.

Is digraph

double constraint_limit = std::numeric_limits<double>::infinity()

Maximum value of the constraint.

int n_vertices = 0

The number of vertices.

Public Static Functions

static inline Meta from_string(const std::string &definition)

Load a graph from a string.