Class graph::input_graph

class graphinput_graph

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_graphinput_graph()

Constructs an empty graph.

graph::input_graphinput_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_graphclear()

Remove all edges and nodes from a graph.

int graph::input_grapha(const int i) const

Return the nodes on either end of edge i

int graph::input_graphb(const int i) const

Return the nodes on either end of edge i

int graph::input_graphnum_nodes() const

Return the size of the graph in nodes.

int graph::input_graphnum_edges() const

Return the size of the graph in edges.

void graph::input_graphpush_back(int ai, int bi)

Add an edge to the graph.

void graph::input_graphget_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_graphget_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_graphget_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_graphget_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_graphget_neighbors(vector<vector<int>> &nbrs) const

produce the node->nodelist mapping for our graph