Skip to content
neta-r edited this page Jan 9, 2021 · 2 revisions

DiGraph

inherit from the abstract class GraphInterface this class represents the directed weighted graph in the repo

Fields and Data Structors:

  • dictionary nodes which represents all the nodes of the graph and their keys. The keys are the vertices' keys, and the values are the vertices itself.
  • Int num_of_ed which represents the total number of edges in the graph being.
  • Int mode_count which represents the number of changes made to the graph.
  • A dictionary edge_in -The keys are the vertices' keys (that the edge is coming into), and the values are dictionaries which includes: keys that are the vertices' keys (that the edge is coming out of), and values that are the edges' weights.
  • A dictionary edge_out -The keys are the vertices' keys (that the edge is coming out of), and the values are dictionaries which includes: keys that are the vertices' keys (that the edge is coming into), and values that are the edges' weights.

Functions:

  • A regular init function.
  • A function that is allowing to add a new vertex to the graph if it's key is not in the graph. Return whether or not the action succeeded.
  • A function that is allowing to remove an exiting vertex from the graph if it's key is in the graph. The action will also disconnect all of the vertex' edges. Return whether or not the action succeeded.
  • A function that is allowing to add a new edge to the graph if the two vertices are not connected. Return whether or not the action succeeded.
  • A function that is allowing to remove an exiting edge from the graph. Return whether or not the action succeeded.
  • A function that is allowing to get a certain vertex by it's key.
  • A function that is allowing to get a dictionary representing all of the vertices in the graph.
  • A function that is allowing to get all of the edged coming in to a certain vertex by it's key.
  • A function that is allowing to get all of the edged coming out from a certain vertex by it's key.
  • A function that is allowing to get the number of the vertices in the graph.
  • A function that is allowing to get the number of the edges in the graph.
  • A function that is allowing to get the number of changed that were made in the graph.
  • A function that is allowing to tell whether two graphs are equals.
  • A function that is allowing to get a representation of the graph.

Menu

Clone this wiki locally