DW_Graph - meytar14/ex2 GitHub Wiki

DW_Graph

Constructor:

Methods:

addNode​(node_data n)- adds a new node to the graph with the given node_data.

connect​(int src, int dest, double w)- Connects an edge with weight w between node src to node dest.

edgeSize()- Returns the number of edges (assume directional graph).

getE​(int node_id)- This method returns a pointer (shallow copy) for the collection representing all the edges getting out of the given node (all the edges starting (source) at the given node).

getEdge​(int src, int dest)- returns the gameClient.data of the edge (src,dest), null if none.

getMC()- Returns the Mode Count - for testing changes in the graph.

getNode​(int key)- returns the node_data by the node_id,

getV()- This method returns a pointer (shallow copy) for the collection representing all the nodes in the graph.

nodeSize()- Returns the number of vertices (nodes) in the graph.

removeEdge​(int src, int dest)- Deletes the edge from the graph, Note: this method should run in O(1) time.

removeNode​(int key)- Deletes the node (with the given ID) from the graph - and removes all edges which starts or ends at this node.