DGraph class - Orgamliel7/Ex3- GitHub Wiki

  • DGraph implements the interface graph

The graph is weighted and directed

  1. What is Weighted Graph? A Graph is called weighted graph when it has weighted edges which means there are some cost associated with each edge in graph.

  2. What is directed Graph? A graph that is made up of a set of vertices connected by edges, where the edges have a direction associated with them.

For more information about our data stracture, you can click the links below:

Directed graph

Weighted graph

DGraph functions

  1. getNode(int key) - return the data of the edge (src,dest), null if none.

  2. getEdge(int src, int dest) - Add a new node to the graph with the given node_data.

  3. addNode(node_data n) - The method connect an edge with weight w between node src to node dest.

  4. connect(int src, int dest, double w) - returns a pointer (shallow copy) for the collection representing all the nodes in the graph.

  5. Collection<node_data> getV() - 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).

  6. Collection<edge_data> getE(int node_id) - Delete the node (with the given ID) from the graph & removes all edges which starts/ends at this node.

  7. node_data removeNode(int key) - Delete the edge from the graph.

  8. edge_data removeEdge(int src, int dest) - return the number of vertices (nodes) in the graph.

  9. nodeSize() - return the number of edges (assume directional graph).

  10. edgeSize() - return the Mode Count - for testing changes in the graph.

  11. getMC() - ....

Our data stracture for the graph is

graph

⚠️ **GitHub.com Fallback** ⚠️