Class graph::components

class graph::components

Represents a graph as a series of connected components.

The input graph may consist of many components, they will be separated in the construction.

Public Functions

const std::vector<int> &nodes(int c) const

Get the set of nodes in a component.

size_t size() const

Get the number of connected components in the graph.

size_t num_reserved(int c) const

returns the number of reserved nodes in a component

size_t size(int c) const

Get the size (in nodes) of a component.

const input_graph &component_graph(int c) const

Get a const reference to the graph object of a component.

std::vector<std::vector<int>> component_neighbors(int c) const

Construct a neighborhood list for component c, with reserved nodes as sources.

template<typename T>
bool into_component(const int c, T &nodes_in, std::vector<int> &nodes_out) const

translate nodes from the input graph, to their labels in component c

template<typename T>
void from_component(const int c, T &nodes_in, std::vector<int> &nodes_out) const

translate nodes from labels in component c, back to their original input labels