DGraph - Stav-Nof/The-Maze-of-Waze-part3 GitHub Wiki
This class represents a directional weighted graph.
The application is based on efficient compact representation.
DGraph class methods:
- getNode- This method gets the key (id) and returns the node.
Note: This method runs at O(1) time. - getEdge- This method gets the source and destination of the edge and returns the edge.
Note: This method runs at O(1) time. - addNode- This method add a new vertices (node) to the graph.
Note: This method runs at O(1) time. Note_2: if you remove a connect vertex, his edges move as well. - connect- This method gets the source, destination and weight vertices of the edge and create new edge. if this edge already exists the function deletes it and create a new edge.
Note: This method runs at O(1) time. - getV- This method return a pointer to all the nodes (vertices) in the graph. Note: This method runs at O(1) time.
- getE- This method return a pointer to all the edges Based on a given node. Note: This method runs at O(1) time.
- removeNode- Delete the node (with the given ID) from the graph, and removes all edges which starts or ends at this node.
Return the data of the removed node (null if none).
Note: This method runs in O(n) time, |V|=n, as all the edges removed. Note_2: if you remove a connect vertex, his edges deleted as well. - removeEdge- Delete the edge from the graph, return the data of the removed edge (null if none).
Note: This method runs at O(1) time. - nodeSize- Return the number of vertices (nodes) in the graph.
Note: This method runs at O(1) time. - edgeSize- Return the number of edges (assuming it is a directed graph).
Note: This method runs at O(1) time. - getMC- Return the Mode Count of how many changes made in the graph.