The GraphAdjMatrix class can be used to represent adjacency matrix based graphs in BRIDGES.
The GraphAdjMatrix class can be used to represent adjacency matrix based graphs in BRIDGES; it takes 2 generic parameters: (1) K, which is an orderable key value used in accessing vertices (in constant time) using a hashmap. This permits data sets that need to be accessed by keys that are strings, and (2) E, an application defined type, and used in the Edge representation. The class is simply a wrapper around the Java Hashmap class and, thus, derives all its operations from it. BRIDGES provides methods to visualize the graph and its contents.
The vertices of the graph are held in a Java hashmap, for near constant time access; this lets us use strings or integral ids for vertices. The edges are accessed by a second hashmap from each vertex, again assuring near constant access time. Each edge contains the terminating vertex id and weight, as defined by the Edge class structure.
Convenience methods are provided to add vertices and edges to the graph. Edges are retrieved by using the dual hashmap, given the vertex ids of the edge.
- Author
- Kalpathi Subramanian, Mihai Mehedint
- See also
- Example tutorial at http://bridgesuncc.github.io/tutorials/Graph_AM.html
|
def | __init__ (self) |
| Constructor. More...
|
|
def | get_data_structure_type (self) |
| This method gets the data structure type. More...
|
|
def | add_vertex (self, k, e) |
| Adds a new vertex to the graph, initializes the adjacency list; user is responsible for checking if the vertex already exists. More...
|
|
def | add_edge (self, src, dest, weight=None) |
| Adds a new edge to the graph, adds it to the index corresponding to the source, destination vertex ids; this version of the method assumes an edge weight of 1 (unweighted graph); user is responsible for checking if the vertices already exist, else an exception is thrown. More...
|
|
def | vertices (self) |
|
def | set_vertex_data (self, src, vertex_data) |
|
def | get_vertex_data (self, src) |
|
def | set_edge_data (self, src, dest, data) |
|
def | get_edge_data (self, src, dest) |
|
def | get_adjacency_matrix (self, key=None) |
| Gets the adjacency matrix. More...
|
|
def | get_link_visualizer (self, src, dest) |
| This is a convenience method to simplify access to the link visualizer; the method assumes the vertex names point to existing vertices, else an exception is thrown. More...
|
|
def | get_visualizer (self, vertex) |
| This is a convenience method to simplify access to the element visualizer; the method assumes the vertex name points to an existing vertice, else an exception is thrown. More...
|
|
def | get_data_structure_representation (self) |
| Get the JSON representation of the the data structure. More...
|
|