Class implementing an undirected graph. More...
Public Member Functions | |
UG (size_t sz) | |
Create an undirected graph with the specified number of vertices. | |
UG (UG const &other) | |
bool | is_directed () const |
Method used to check if the graph is directed or not. This class always returns false;. | |
edge_iterator | edges_begin () |
Returns an iterator over all the edges of the graph, pointing to the starting edge in the graph. Skips sibling edges (where target < source), to avoid duplicating edges in undirected graph. | |
const_edge_iterator | edges_begin () const |
Returns an iterator over all the edges of the graph, pointing to the starting edge in the graph. Skips sibling edges (where target < source), to avoid duplicating edges in undirected graph. | |
edge_iterator | edges_end () |
Returns an iterator over all the edges of the graph, pointing to one past the ending edge in the graph. Skips sibling edges (where target < source), to avoid duplicating edges in undirected graph. | |
const_edge_iterator | edges_end () const |
Returns an iterator over all the edges of the graph, pointing to one past the ending edge in the graph. Skips sibling edges (where target < source), to avoid duplicating edges in undirected graph. | |
edge_descriptor | add_edge (edge_descriptor const &ed) |
Adds the specified edge in both directions. More... | |
edge_descriptor | add_edge (edge_descriptor const &ed, edge_property const &p) |
Adds the specified edge in both directions, with the given property. More... | |
size_t | get_num_edges (void) const |
Returns the number of undirected edges in the graph. The number of edges is half the number of directed edges in the graph. | |
bool | delete_edge (edge_descriptor const &ed) |
Deletes the specified undirected edge (removes the directed edge and its sibling edge). More... | |
bool | find_edge (edge_descriptor const &ed, vertex_iterator &vi, adj_edge_iterator &ei) |
Finds one of the two edges defining an undirected edge. More... | |
bool | find_edge (edge_descriptor const &ed, const_vertex_iterator &vi, const_adj_edge_iterator &ei) const |
Finds one of the two edges defining an undirected edge. More... | |
void | clear () |
Erase all vertices and edges in the graph, and any associated properties. | |
bool | delete_vertex (vertex_descriptor const &vd) |
Deletes the specified vertex and all edges pointing to it and from it. More... | |
Class implementing an undirected graph.
Traits | A traits class that defines customizable components of graph, such as the descriptor, model, storage, etc. |
edge_descriptor stapl::sequential::UG< Traits >::add_edge | ( | edge_descriptor const & | ed | ) |
Adds the specified edge in both directions.
Undirected graph doesn't allow for self loops; this is consistent with other graph libraries like BGL, LEDA.
ed | The descriptor of the edge to be added. |
edge_descriptor stapl::sequential::UG< Traits >::add_edge | ( | edge_descriptor const & | ed, |
edge_property const & | p | ||
) |
Adds the specified edge in both directions, with the given property.
Undirected graph doesn't allow for self loops; this is consistent with other graph libraries like BGL, LEDA.
ed | The descriptor of the edge to be added. |
bool stapl::sequential::UG< Traits >::delete_edge | ( | edge_descriptor const & | ed | ) |
Deletes the specified undirected edge (removes the directed edge and its sibling edge).
bool stapl::sequential::UG< Traits >::find_edge | ( | edge_descriptor const & | ed, |
vertex_iterator & | vi, | ||
adj_edge_iterator & | ei | ||
) |
Finds one of the two edges defining an undirected edge.
As a rule, we report the edge where source is smaller than the destination.
ed | The descriptor of the edge to be found. |
vi | The output vertex iterator pointing to the source-vertex of the edge. |
ei | The output edge iterator pointing to the specified edge. |
bool stapl::sequential::UG< Traits >::find_edge | ( | edge_descriptor const & | ed, |
const_vertex_iterator & | vi, | ||
const_adj_edge_iterator & | ei | ||
) | const |
Finds one of the two edges defining an undirected edge.
As a rule, we report the edge where source is smaller than the destination.
ed | The descriptor of the edge to be found. |
vi | The output vertex iterator pointing to the source-vertex of the edge. |
ei | The output edge iterator pointing to the specified edge. |
bool stapl::sequential::UG< Traits >::delete_vertex | ( | vertex_descriptor const & | vd | ) |
Deletes the specified vertex and all edges pointing to it and from it.