|
NuriKit v0.1.0b2
|
Class for very sparse graphs, especially designed for the molecular graphs. More...
#include <nuri/core/graph/graph.h>
Classes | |
| struct | StoredEdge |
Public Types | |
| using | node_data_type = NT |
| using | edge_data_type = ET |
| using | iterator = internal::NodeIterator<Graph, false> |
| using | node_iterator = iterator |
| using | const_iterator = internal::NodeIterator<Graph, true> |
| using | const_node_iterator = const_iterator |
| using | NodeRef = internal::NodeWrapper<Graph, false> |
| using | ConstNodeRef = internal::NodeWrapper<Graph, true> |
| using | edge_iterator = internal::EdgeIterator<Graph, false> |
| using | const_edge_iterator = internal::EdgeIterator<Graph, true> |
| using | EdgeRef = internal::EdgeWrapper<Graph, false> |
| using | ConstEdgeRef = internal::EdgeWrapper<Graph, true> |
| using | adjacency_iterator = internal::AdjIterator<Graph, false> |
| using | const_adjacency_iterator = internal::AdjIterator<Graph, true> |
| using | AdjRef = internal::AdjWrapper<Graph, false> |
| using | ConstAdjRef = internal::AdjWrapper<Graph, true> |
Public Member Functions | |
| Graph ()=default | |
| Graph (const Graph &)=default | |
| Graph (Graph &&) noexcept=default | |
| Graph & | operator= (const Graph &)=default |
| Graph & | operator= (Graph &&) noexcept=default |
| ~Graph () noexcept=default | |
| Graph (int num_nodes) | |
Create a graph with num_nodes nodes. | |
| Graph (int num_nodes, const NT &data) | |
Create a graph with num_nodes nodes, each initialized with data. | |
| bool | empty () const |
| int | size () const |
| int | num_nodes () const |
| bool | edge_empty () const |
| int | num_edges () const |
| int | degree (int id) const |
| void | reserve (int num_nodes) |
| void | reserve_edges (int num_edges) |
| int | add_node (const NT &data) |
| Add a node to the graph. | |
| int | add_node (NT &&data) noexcept |
| Add a node to the graph. | |
| template<class Iterator, internal::enable_if_compatible_iter_t< Iterator, NT > = 0> | |
| int | add_nodes (Iterator begin, Iterator end) |
| Add multiple nodes to the graph. | |
| int | add_edge (int src, int dst, const ET &data) |
| Add an edge to the graph. | |
| int | add_edge (int src, int dst, ET &&data) noexcept |
| Add an edge to the graph. | |
| template<class Iterator, internal::enable_if_compatible_iter_t< Iterator, StoredEdge > = 0> | |
| int | add_edges (Iterator begin, Iterator end) |
| Add multiple edges to the graph. | |
| NodeRef | operator[] (int id) |
| ConstNodeRef | operator[] (int id) const |
| NodeRef | node (int id) |
| ConstNodeRef | node (int id) const |
| NT & | node_data (int id) |
| const NT & | node_data (int id) const |
| void | clear () |
| NodesErased | erase_nodes (const_iterator begin, const_iterator end) |
| Erase nodes and all its associated edge(s) from the graph. | |
| template<class UnaryPred> | |
| NodesErased | erase_nodes (const_iterator begin, const_iterator end, UnaryPred pred) |
| Erase matching nodes and all its associated edge(s) from the graph. | |
| template<class Iterator, class = internal::enable_if_compatible_iter_t<Iterator, int>> | |
| NodesErased | erase_nodes (Iterator begin, Iterator end) |
| Erase nodes and all its associated edge(s) from the graph. | |
| iterator | begin () |
| iterator | end () |
| const_iterator | begin () const |
| const_iterator | end () const |
| const_iterator | cbegin () const |
| const_iterator | cend () const |
| EdgeRef | edge (int id) |
| ConstEdgeRef | edge (int id) const |
| NodeRef | edge_src (int id) |
| ConstNodeRef | edge_src (int id) const |
| NodeRef | edge_dst (int id) |
| ConstNodeRef | edge_dst (int id) const |
| ET & | edge_data (int id) |
| const ET & | edge_data (int id) const |
| edge_iterator | find_edge (int src, int dst) |
| Find an edge between two nodes. | |
| const_edge_iterator | find_edge (int src, int dst) const |
| Find an edge between two nodes. | |
| edge_iterator | find_edge (ConstNodeRef src, ConstNodeRef dst) |
| Find an edge between two nodes. | |
| const_edge_iterator | find_edge (ConstNodeRef src, ConstNodeRef dst) const |
| Find an edge between two nodes. | |
| void | clear_edges () |
| Remove all edges from the graph. | |
| void | erase_edge (int id) |
| Erase an edge from the graph. | |
| bool | erase_edge_between (int src, int dst) |
| Erase an edge from the graph between two nodes. | |
| bool | erase_edge_between (ConstNodeRef src, ConstNodeRef dst) |
| Erase an edge from the graph between two nodes. | |
| std::pair< int, std::vector< int > > | erase_edges (const_edge_iterator begin, const_edge_iterator end) |
| Erase edges from the graph. | |
| template<class UnaryPred> | |
| std::pair< int, std::vector< int > > | erase_edges (const_edge_iterator begin, const_edge_iterator end, UnaryPred pred) |
| Erase matching edges from the graph. | |
| template<class Iterator, class = internal::enable_if_compatible_iter_t<Iterator, int>> | |
| std::pair< int, std::vector< int > > | erase_edges (Iterator begin, Iterator end) |
| Erase edges from the graph. | |
| internal::EdgesWrapper< Graph, false > | edges () |
| internal::EdgesWrapper< Graph, true > | edges () const |
| internal::EdgesWrapper< Graph, true > | cedges () const |
| edge_iterator | edge_begin () |
| edge_iterator | edge_end () |
| const_edge_iterator | edge_begin () const |
| const_edge_iterator | edge_end () const |
| const_edge_iterator | edge_cbegin () const |
| const_edge_iterator | edge_cend () const |
| adjacency_iterator | find_adjacent (int src, int dst) |
| Find an adjacency entry between two nodes. | |
| const_adjacency_iterator | find_adjacent (int src, int dst) const |
| Find an adjacency entry between two nodes. | |
| adjacency_iterator | find_adjacent (ConstNodeRef src, ConstNodeRef dst) |
| Find an adjacency entry between two nodes. | |
| const_adjacency_iterator | find_adjacent (ConstNodeRef src, ConstNodeRef dst) const |
| Find an adjacency entry between two nodes. | |
| adjacency_iterator | adj_begin (int nid) |
| adjacency_iterator | adj_end (int nid) |
| const_adjacency_iterator | adj_begin (int nid) const |
| const_adjacency_iterator | adj_end (int nid) const |
| const_adjacency_iterator | adj_cbegin (int nid) const |
| const_adjacency_iterator | adj_cend (int nid) const |
| template<class GraphLike> | |
| void | merge (const GraphLike &other) |
| Merge another graph-like object into this graph. | |
Friends | |
| class | Subgraph< NT, ET, false > |
| class | Subgraph< NT, ET, true > |
Class for very sparse graphs, especially designed for the molecular graphs.
| NT | node data type. |
| ET | edge data type. |
For all time complexity specifications, \(V\) denotes the number of nodes (vertices) and \(E\) denotes the number of edges. If present, \(N\) is the size of the user-supplied range (such as an iterator range; see, e.g., erase_nodes()).
| using nuri::Graph< NT, ET >::adjacency_iterator = internal::AdjIterator<Graph, false> |
| using nuri::Graph< NT, ET >::AdjRef = internal::AdjWrapper<Graph, false> |
| using nuri::Graph< NT, ET >::const_adjacency_iterator = internal::AdjIterator<Graph, true> |
| using nuri::Graph< NT, ET >::const_edge_iterator = internal::EdgeIterator<Graph, true> |
| using nuri::Graph< NT, ET >::const_iterator = internal::NodeIterator<Graph, true> |
| using nuri::Graph< NT, ET >::const_node_iterator = const_iterator |
| using nuri::Graph< NT, ET >::ConstAdjRef = internal::AdjWrapper<Graph, true> |
| using nuri::Graph< NT, ET >::ConstEdgeRef = internal::EdgeWrapper<Graph, true> |
| using nuri::Graph< NT, ET >::ConstNodeRef = internal::NodeWrapper<Graph, true> |
| using nuri::Graph< NT, ET >::edge_data_type = ET |
| using nuri::Graph< NT, ET >::edge_iterator = internal::EdgeIterator<Graph, false> |
| using nuri::Graph< NT, ET >::EdgeRef = internal::EdgeWrapper<Graph, false> |
| using nuri::Graph< NT, ET >::iterator = internal::NodeIterator<Graph, false> |
| using nuri::Graph< NT, ET >::node_data_type = NT |
| using nuri::Graph< NT, ET >::node_iterator = iterator |
| using nuri::Graph< NT, ET >::NodeRef = internal::NodeWrapper<Graph, false> |
|
default |
|
default |
|
defaultnoexcept |
|
defaultnoexcept |
|
inline |
Create a graph with num_nodes nodes.
| num_nodes | The number of nodes in the graph. All node data will be default-constructed. |
|
inline |
Create a graph with num_nodes nodes, each initialized with data.
| num_nodes | The number of nodes in the graph. |
| data | The data to copy-initialize each node with. |
|
inline |
Add an edge to the graph.
| src | The source node id. |
| dst | The destination node id. |
| data | The data to copy-construct the edge with. |
src or dst is out of range, src equals dst, or an edge between src and dst already exists, the behavior is undefined.
|
inlinenoexcept |
Add an edge to the graph.
| src | The source node id. |
| dst | The destination node id. |
| data | The data to move-construct the edge with. |
src or dst is out of range, src equals dst, or an edge between src and dst already exists, the behavior is undefined.
|
inline |
Add multiple edges to the graph.
| Iterator | The type of the iterator for edges. Must be dereferenceable to a value type implicitly convertible to StoredEdge. |
| begin | The beginning of the range of edges to be added. |
| end | The end of the range of edges to be added. |
|
inline |
Add a node to the graph.
| data | The data to copy-construct the node with. |
|
inlinenoexcept |
Add a node to the graph.
| data | The data to move-construct the node with. |
|
inline |
Add multiple nodes to the graph.
| Iterator | The type of the iterator. Must be dereferenceable to a value type implicitly convertible to NT. |
| begin | The beginning of the range of nodes to be added. |
| end | The end of the range of nodes to be added. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Remove all edges from the graph.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Erase an edge from the graph.
| id | The id of the edge to be erased. |
id is out of range, the behavior is undefined.
|
inline |
Erase an edge from the graph between two nodes.
| src | The source node, interchangeable with dst. |
| dst | The destination node, interchangeable with src. |
src or dst does not belong to this graph, the behavior is undefined. | bool nuri::Graph< NT, ET >::erase_edge_between | ( | int | src, |
| int | dst ) |
Erase an edge from the graph between two nodes.
| src | The source node, interchangeable with dst. |
| dst | The destination node, interchangeable with src. |
src or dst is out of range, the behavior is undefined.
|
inline |
Erase edges from the graph.
| begin | The beginning of the range of nodes to be erased. |
| end | The end of the range of nodes to be erased. |
begin, end`)` is out of range, the behavior is undefined. | std::pair< int, std::vector< int > > nuri::Graph< NT, ET >::erase_edges | ( | const_edge_iterator | begin, |
| const_edge_iterator | end, | ||
| UnaryPred | pred ) |
Erase matching edges from the graph.
| UnaryPred | A unary predicate that takes a ConstEdgeRef and returns bool. |
| begin | The beginning of the range of edges to be erased. |
| end | The end of the range of edges to be erased. |
| pred | A unary predicate that takes a ConstEdgeRef and returns true if the edge should be erased. |
begin, end`)` is out of range, the behavior is undefined. | std::pair< int, std::vector< int > > nuri::Graph< NT, ET >::erase_edges | ( | Iterator | begin, |
| Iterator | end ) |
Erase edges from the graph.
| Iterator | An iterator type that dereferences to a value compatible with int. |
| begin | The beginning of the range of edge ids to be erased. |
| end | The end of the range of edge ids to be erased. |
begin, end`)` references an invalid edge id, the behavior is undefined.
|
inline |
Erase nodes and all its associated edge(s) from the graph.
| begin | The beginning of the range of nodes to be erased. |
| end | The end of the range of nodes to be erased. |
begin, end`)` is out of range, the behavior is undefined. | NodesErased nuri::Graph< NT, ET >::erase_nodes | ( | const_iterator | begin, |
| const_iterator | end, | ||
| UnaryPred | pred ) |
Erase matching nodes and all its associated edge(s) from the graph.
| UnaryPred | A unary predicate that takes a ConstNodeRef and returns bool. |
| begin | The beginning of the range of nodes to be erased. |
| end | The end of the range of nodes to be erased. |
| pred | A unary predicate that takes a ConstNodeRef and returns true if the node should be erased. |
begin, end`)` is out of range, the behavior is undefined. | NodesErased nuri::Graph< NT, ET >::erase_nodes | ( | Iterator | begin, |
| Iterator | end ) |
Erase nodes and all its associated edge(s) from the graph.
| Iterator | An iterator type that dereferences to a value compatible with int. |
| begin | The beginning of the range of node ids to be erased. |
| end | The end of the range of node ids to be erased. |
begin, end`)` points to an invalid node id, the behavior is undefined.
|
inline |
Find an adjacency entry between two nodes.
| src | The source node. |
| dst | The destination node. |
src. src or dst does not belong to this graph, the behavior is undefined.
|
inline |
Find an adjacency entry between two nodes.
| src | The source node. |
| dst | The destination node. |
src. src or dst does not belong to this graph, the behavior is undefined.
|
inline |
Find an adjacency entry between two nodes.
| src | The source node id. |
| dst | The destination node id. |
src. src or dst is out of range, the behavior is undefined.
|
inline |
Find an adjacency entry between two nodes.
| src | The source node id. |
| dst | The destination node id. |
src. src or dst is out of range, the behavior is undefined.
|
inline |
Find an edge between two nodes.
| src | The source node. |
| dst | The destination node. |
src or dst does not belong to this graph, the behavior is undefined.
|
inline |
Find an edge between two nodes.
| src | The source node. |
| dst | The destination node. |
src or dst does not belong to this graph, the behavior is undefined.
|
inline |
Find an edge between two nodes.
| src | The source node id. |
| dst | The destination node id. |
src or dst is out of range, the behavior is undefined.
|
inline |
Find an edge between two nodes.
| src | The source node id. |
| dst | The destination node id. |
src or dst is out of range, the behavior is undefined.
|
inline |
Merge another graph-like object into this graph.
| GraphLike | The type of the graph-like object to be merged. |
| other | The graph to be merged. |
other, respectively. The actual time complexity may vary depending on the implementation of the graph-like object.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
default |
|
defaultnoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
|
friend |