![]() |
Bridges-C++
3.1.1
Bridges(C++API)
|
#include <Element.h>
This class provides methods to represent adjacency list based graphs.
The class is simply a wrapper around the C++ STL unordered_map class and thus derives all its operations from it.
| K | used as an index to retrieve vertices, |
| E1 | data type used to store vertex specific information, |
| E2 | data type used to store edge specific information |
There is a tutorial about Graph Adjacency List : http://bridgesuncc.github.io/tutorials/Graph_AL.html
Classes | |
| class | constVertexElementSet_listhelper |
| This is a helper class to return sets of vertices ina way that are iterable with range for loops. Students should not have to use this directly. More... | |
| class | KeySet_helper |
| This is a helper class to return sets of vertices ina way that are iterable with range for loops. Students should not have to use this directly. More... | |
| class | VertexElementSet_listhelper |
| This is a helper class to return sets of vertices in a way that are iterable with range for loops. Students should have to use this directly. More... | |
Public Member Functions | |
| GraphAdjList ()=default | |
| GraphAdjList (GraphAdjList &&gr)=default | |
| virtual | ~GraphAdjList () override |
| virtual const string | getDStype () const override |
| void | addVertex (const K &k, const E1 &e=E1()) |
| void | addEdge (const K &src, const K &dest, const E2 &data=E2()) |
| add an edge with data. More... | |
| const E1 & | getVertexData (const K &src) & |
| void | setVertexData (const K &vertID, E1 const &data) |
| E2 & | getEdgeData (const K &src, const K &dest) |
| E2 const & | getEdgeData (const K &src, const K &dest) const |
| void | setEdgeData (const K &src, const K &dest, E2 &data) |
| unordered_map< K, Element< E1 > * > * | getVertices () |
| const unordered_map< K, Element< E1 > * > * | getVertices () const |
| const Element< E1 > * | getVertex (const K &key) const |
| Element< E1 > * | getVertex (const K &key) |
| const unordered_map< K, SLelement< Edge< K, E2 > > * > & | getAdjacencyList () const |
| SLelement< Edge< K, E2 > > * | getAdjacencyList (const K &k) |
| const SLelement< Edge< K, E2 > > * | getAdjacencyList (const K &k) const |
| ElementVisualizer * | getVisualizer (const K &k) |
| LinkVisualizer * | getLinkVisualizer (const K &k1, const K &k2) |
| void | forceLargeVisualization (bool f) |
| void | forceSmallVisualization (bool f) |
| KeySet_helper | keySet () const |
| SLelement< Edge< K, E2 > >::SLelement_listhelper | outgoingEdgeSetOf (K const &k) |
| SLelement< Edge< K, E2 > >::SLelement_constlisthelper | outgoingEdgeSetOf (K const &k) const |
| VertexElementSet_listhelper | vertexSet () |
| returns a set of vertices (Element<E>) that conforms to STL list interface. That means we can use range for More... | |
| constVertexElementSet_listhelper | vertexSet () const |
| returns a set of vertices (Element<E>) that conforms to STL list interface. That means we can use range for More... | |
Public Member Functions inherited from bridges::datastructure::DataStructure | |
| virtual | ~DataStructure ()=default |
|
default |
|
default |
|
inlineoverridevirtual |
|
inline |
add an edge with data.
Note that this function adds the edge regardless of the contents of the adjacency list; its the user's responsibility to ensure there are no duplicates and ensure consistency.
| src | The key of the source Vertex |
| dest | The key of the destination Vertex |
| data | The edge data |
| out_of_range | If "src" or "dest" is non-existent within this graph |
| bad_alloc | If allocation of a graph adjacency list item failed |
|
inline |
Adds a vertex of key "k" and value "e" to the graph, and initializes its adjacency list; If this key already exists then this will not create a new vertex.
| k | The vertex key |
| e | The vertex data |
|
inline |
|
inline |
|
inline |
Return the adjacency list
|
inline |
Returns adjacency list of a vertex with name k
| k | The key of the source vertex |
| out_of_range | If key is non-existent within this graph |
|
inline |
Returns adjacency list of a vertex with name k - const version
| k | The key of the source vertex |
| out_of_range | If key is non-existent within this graph |
|
inlineoverridevirtual |
Implements bridges::datastructure::DataStructure.
|
inline |
Gets edge data for the edge from "src" to "dest"
| src | The key of the source Vertex |
| dest | The key of the destination Vertex |
|
inline |
Gets edge data for the edge from "src" to "dest" - const version
| src | The key of the source Vertex |
| dest | The key of the destination Vertex |
|
inline |
Returns the link visualizer corresponding to two graph nodes with an existing link; error returned if no link exists.
| k1 | The key of the link source vertex |
| k2 | The key of the link destination vertex |
|
inline |
Return the vertex corresponding to a key
|
inline |
Return the requested vertex corresponding to a key - non-const version
|
inline |
Gets vertex data for a graph vertex
| src | The key of the source vertex |
|
inline |
Return the graph nodes
|
inline |
Return the graph nodes - const version
|
inline |
Returns the visualizer corresponding to a graph vertex; convenient method to set attributes of the graph vertex
| k | The key of the graph vertex |
|
inline |
returns a set of all keys (read only) that conforms to STL list interface. That means we can use range for
|
inline |
|
inline |
|
inline |
Loads edge specific information for the edge from "src" to "dest"
| src | The key of the source Vertex |
| dest | The key of the destination Vertex |
| data | edge data |
|
inline |
Loads vertex specific information for a graph vertex
| vertID | The key of Vertex |
| data | data to set |
|
inline |
returns a set of vertices (Element<E>) that conforms to STL list interface. That means we can use range for
|
inline |
returns a set of vertices (Element<E>) that conforms to STL list interface. That means we can use range for
1.8.13