Bridges-C++
3.4.5-dev1-6-g935685a
Bridges(C++ API)
|
This class provides methods to represent adjacency matrix based graphs. More...
#include <GraphAdjMatrix.h>
Public Member Functions | |
virtual const string | getDStype () const override |
virtual | ~GraphAdjMatrix () |
GraphAdjMatrix ()=default | |
GraphAdjMatrix (const GraphAdjMatrix &)=delete | |
GraphAdjMatrix & | operator= (const GraphAdjMatrix &)=delete |
void | addVertex (const K &k, const E1 &e=E1()) |
void | addEdge (const K &src, const K &dest, const unsigned int &wt) |
const unordered_map< K, unordered_map< K, int > > & | getMatrix () const |
const unordered_map< K, int > & | getMatrix (K key) const |
unordered_map< K, Element< E1 > * > * | getVertices () |
const Element< E1 > * | getVertex (const K &key) const |
Element< E1 > * | getVertex (const K &key) |
E1 | getVertexData (const K &src) |
void | setVertexData (const K &vID, const E1 &data) |
E2 const & | getEdgeData (const K &src, const K &dest) const |
void | setEdgeData (const K &src, const K &dest, const E2 &data) |
Loads edge information. More... | |
ElementVisualizer * | getVisualizer (const K &k) |
LinkVisualizer * | getLinkVisualizer (const K &k1, const K &k2) |
Public Member Functions inherited from bridges::datastructure::DataStructure | |
virtual | ~DataStructure ()=default |
This class provides methods to represent adjacency matrix based graphs.
The class is simply a wrapper around the C++ STL unordered_map class and thus derives all its operations from it. Given the use of operator overloading, the adjacency matrix implementation is almost identical to a normal array representation, except that any ordered type can be used to index into the matrix.
Since the adjacency matrix typically contains only a numerical value, we keep edge specific information in a separate map using a generic parameter for the type.
Generic Parameters: K that is used as an index, E1 information specific to graph vertices E2 information specific to graph edges
There is a tutorial about Graph Adjacency Matrix : https://bridgesuncc.github.io/tutorials/Graph_AM.html
|
inlinevirtual |
|
default |
|
delete |
|
inline |
Sets the weight of the edge from "src" to "dest", to "wt". This will overwrite the existing edge weight.
src | The key of the source Vertex |
dest | The key of the destination Vertex |
wt | The weight of the edge |
out_of_range | If "src" or "dest" is non-existent within this graph |
|
inline |
Adds a vertex of key "k" and value "e" to the graph. Sets all of its edges to be of weight 0.
k | Vertex key |
e | Vertex data |
|
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 |
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 adjacency matrix
|
inline |
Return the adjacency matrix row at Key key
key | The input key value that identifies the row being retrieved |
|
inline |
Return the vertex correspondingto key "key"
|
inline |
Return the vertex correspondingto key "key" - const version
|
inline |
Gets vertex data for a graph vertex
src | The key of the source vertex |
|
inline |
Return the graph vertices
|
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 |
|
delete |
|
inline |
Loads edge information.
src | The key of the source Vertex |
dest | The key of the destination Vertex |
data | data to associate with the edge |
|
inline |
Loads vertex specific information for a graph vertex
vID | vertex key |
data | data to associate with the vertex |