Namespace graph¶
-
namespace
graph -
class graph
components - #include <graph.hpp>
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 vector<int> &graph::components
nodes(int c) const Get the set of nodes in a component.
-
int graph::components
size() const Get the number of connected components in the graph.
-
int graph::components
num_reserved(int c) const returns the number of reserved nodes in a component
-
int graph::components
size(int c) const¶ Get the size (in nodes) of a component.
-
input_graph &graph::components
component_graph(int c) Get a mutable reference to the graph object of a component.
-
template <typename T>
bool graph::componentsinto_component(const int c, T &nodes_in, vector<int> &nodes_out) const translate nodes from the input graph, to their labels in component c
-
template <typename T>
void graph::componentsfrom_component(const int c, T &nodes_in, vector<int> &nodes_out) translate nodes from labels in component c, back to their original input labels
-
const vector<int> &graph::components
-
class graph
input_graph - #include <graph.hpp>
Represents an undirected graph as a list of edges.
Provides methods to extract those edges into neighbor lists (with options to relabel and produce directed graphs).
As an input to the library this may be a disconnected graph, but when returned from components it is a connected sub graph.
Public Functions
-
graph::input_graph
input_graph() Constructs an empty graph.
-
graph::input_graph
input_graph(int n_v, const vector<int> &aside, const vector<int> &bside)¶ Constructs a graph from the provided edges.
The ends of edge ii are aside[ii] and bside[ii].
- Parameters
n_v: Number of nodes in the graph.aside: List of nodes describing edges.bside: List of nodes describing edges.
-
void graph::input_graph
clear() Remove all edges and nodes from a graph.
-
int graph::input_graph
a(const int i) const Return the nodes on either end of edge
i
-
int graph::input_graph
b(const int i) const Return the nodes on either end of edge
i
-
int graph::input_graph
num_nodes() const Return the size of the graph in nodes.
-
int graph::input_graph
num_edges() const Return the size of the graph in edges.
-
void graph::input_graph
push_back(int ai, int bi) Add an edge to the graph.
-
void graph::input_graph
get_neighbors_sources(vector<vector<int>> &nbrs, const vector<int> &sources) const produce the node->nodelist mapping for our graph, where certain nodes are marked as sources (no incoming edges)
-
void graph::input_graph
get_neighbors_sinks(vector<vector<int>> &nbrs, const vector<int> &sinks) const produce the node->nodelist mapping for our graph, where certain nodes are marked as sinks (no outgoing edges)
-
void graph::input_graph
get_neighbors_sinks_relabel(vector<vector<int>> &nbrs, const vector<int> &sinks, const vector<int> &relabel) const produce the node->nodelist mapping for our graph, where certain nodes are marked as sinks (no outgoing edges), relabeling all nodes along the way
-
void graph::input_graph
get_neighbors_relabel(vector<vector<int>> &nbrs, const vector<int> &relabel) const produce the node->nodelist mapping for our graph, relabeling all nodes along the way
-
void graph::input_graph
get_neighbors(vector<vector<int>> &nbrs) const produce the node->nodelist mapping for our graph
-
graph::input_graph
-
class graph