SmartBpGraph is a simple and fast bipartite graph implementation. It is also quite memory efficient but at the price that it does not support node and edge deletion (except for the Snapshot feature).
This type fully conforms to the BpGraph concept and it also provides some additional functionalities. Most of its member functions and nested classes are documented only in the concept class.
This class provides constant time counting for nodes, edges and arcs.
#include <lemon/smart_graph.h>
Inherits BpGraphExtender< Base >.
Classes | |
class | Snapshot |
Class to make a snapshot of the graph and to restore it later. More... | |
Public Member Functions | |
SmartBpGraph () | |
Constructor. More... | |
RedNode | addRedNode () |
Add a new red node to the graph. More... | |
BlueNode | addBlueNode () |
Add a new blue node to the graph. More... | |
Edge | addEdge (RedNode u, BlueNode v) |
Add a new edge to the graph. More... | |
bool | valid (Node n) const |
Node validity check. More... | |
bool | valid (Edge e) const |
Edge validity check. More... | |
bool | valid (Arc a) const |
Arc validity check. More... | |
void | clear () |
Clear the graph. More... | |
void | reserveNode (int n) |
Reserve memory for nodes. More... | |
void | reserveEdge (int m) |
Reserve memory for edges. More... | |
Private Member Functions | |
SmartBpGraph (const SmartBpGraph &) | |
Graphs are not copy constructible. Use GraphCopy instead. | |
void | operator= (const SmartBpGraph &) |
Assignment of a graph to another one is not allowed. Use GraphCopy instead. | |
|
inline |
Constructor.
|
inline |
This function adds a red new node to the graph.
|
inline |
This function adds a blue new node to the graph.
|
inline |
This function adds a new edge to the graph between nodes u
and v
with inherent orientation from node u
to node v
.
|
inline |
This function gives back true
if the given node is valid, i.e. it is a real node of the graph.
|
inline |
This function gives back true
if the given edge is valid, i.e. it is a real edge of the graph.
|
inline |
This function gives back true
if the given arc is valid, i.e. it is a real arc of the graph.
|
inline |
This function erases all nodes and arcs from the graph.
|
inline |
Using this function, it is possible to avoid superfluous memory allocation: if you know that the graph you want to build will be large (e.g. it will contain millions of nodes and/or edges), then it is worth reserving space for this amount before starting to build the graph.
|
inline |
Using this function, it is possible to avoid superfluous memory allocation: if you know that the graph you want to build will be large (e.g. it will contain millions of nodes and/or edges), then it is worth reserving space for this amount before starting to build the graph.