dyng
DynamicGraphLayout
|
Templated class for representing a static graph and its layout. More...
#include <graph.h>
Public Types | |
using | node_edges = std::unordered_map< node_id, edge_id > |
Typedef to simplify return type of the method edges_at_node(). | |
Public Member Functions | |
graph (const graph< NodeType, EdgeType > &other) | |
graph< NodeType, EdgeType > & | operator= (const graph< NodeType, EdgeType > &other) |
graph (graph< NodeType, EdgeType > &&other) | |
graph< NodeType, EdgeType > & | operator= (graph< NodeType, EdgeType > &&other) |
const std::vector< NodeType > & | nodes () const |
Returns const reference to the vector of all nodes in the graph. | |
std::vector< NodeType > & | nodes () |
Returns reference to the vector of all nodes in the graph. More... | |
const std::vector< EdgeType > & | edges () const |
Returns const reference to the vector of all edges in the graph. | |
std::vector< EdgeType > & | edges () |
Returns reference to the vector of all edges in the graph. More... | |
const NodeType & | node_at (node_id id) const |
Returns reference to node of given id. More... | |
NodeType & | node_at (node_id id) |
Returns reference to node of given id. More... | |
const EdgeType & | edge_at (edge_id id) const |
Returns reference to edge of given id. More... | |
EdgeType & | edge_at (edge_id id) |
Returns reference to edge of given id. More... | |
unsigned | node_index (node_id id) const |
Returns the index of a node corresponding to its position in nodes(). More... | |
unsigned | edge_index (edge_id id) const |
Returns the index of an edge corresponding to its position in edges(). More... | |
template<typename Function > | |
void | remove_edges_if (Function function) |
template<typename Function > | |
void | remove_nodes_if (Function function) |
void | remove_edge (edge_id id) |
Removes a single edge. More... | |
void | remove_node (node_id id) |
Removes a single node. More... | |
NodeType & | push_node (NodeType node) |
Adds a new node to the graph. | |
template<typename ... Args> | |
NodeType & | emplace_node (Args &&... args) |
Constructs a new node and adds it to the graph. | |
EdgeType & | push_edge (EdgeType edge) |
Adds a new edge to the graph. | |
template<typename ... Args> | |
EdgeType & | emplace_edge (Args &&... args) |
Constructs a new edge and adds it to the graph. | |
void | clear_edges () |
Removes all edges. | |
void | clear_nodes () |
Removes all nodes. | |
bool | node_exists (node_id id) const |
Returns whether a node of a given id exists. | |
bool | edge_exists (edge_id id) const |
Returns whether an edge of a given id exists. More... | |
bool | edge_exists (node_id one, node_id two) const |
const node_edges & | edges_at_node (node_id node) const |
Returns a container containing all edges adjacent to a given node. More... | |
Templated class for representing a static graph and its layout.
(Described in section 6.1.4 – as the alias 'graph_state')
NodeType | Type of the node. |
EdgeType | Type of the edge. |
|
inline |
Returns reference to edge of given id.
std::out_of_range | If edge of id doesn't exist. |
|
inline |
Returns reference to edge of given id.
std::out_of_range | If edge of id doesn't exist. |
|
inline |
Returns whether an edge of a given id exists.
|
inline |
Returns whether or not there is an edge between two nodes identified by node_id one
and two
.
Note: edge_exists(a, b) is equivalent to edge_exists(b, a).
std::out_of_range | If either one or two doesn't exist. |
|
inline |
Returns the index of an edge corresponding to its position in edges().
std::out_of_range | If edge of id doesn't exist. |
|
inline |
Returns reference to the vector of all edges in the graph.
You should not add/remove any elements to/from the vector (use coresponding graph methods instead).
|
inline |
Returns a container containing all edges adjacent to a given node.
The container node_edges is a map of node ids to edge ids.
std::out_of_range | If one doesn't exist. |
|
inline |
Returns reference to node of given id.
std::out_of_range | If node of id doesn't exist. |
|
inline |
Returns reference to node of given id.
std::out_of_range | If node of id doesn't exist. |
|
inline |
Returns the index of a node corresponding to its position in nodes().
std::out_of_range | If node of id doesn't exist. |
|
inline |
Returns reference to the vector of all nodes in the graph.
You should not add/remove any elements to/from the vector (use coresponding methods instead).
|
inline |
Removes a single edge.
Has the same complexity as remove_edges_if().
invalid_graph | If the edge does not exist. |
|
inline |
Removes all edges for which parameter function returns true. This methods needs to make sure all internal structures remain consistent which makes it very inefficient.
function | Expected signature: 'bool(const EdgeType&)'. |
|
inline |
Removes a single node.
Has the same complexity as remove_nodes_if().
invalid_graph | If the node does not exist. |
|
inline |
Removes all nodes for which parameter function returns true. This methods needs to make sure all internal structures remain consistent which makes it very inefficient.
function | Expected signature: 'bool(const NodeType&)'. |