Graph_DS - snir1551/Ex0_OOP GitHub Wiki

class Graph_DS is implements from interface graph

functions of class Graph_DS:

  • getNode(int key) //O(1)

      this method get int key of node_data and return node_data.
    
  • hasEdge(int node1, int node2) //O(1)

      this method get key of node1 and key of node2 and return true if and only if there is an edge between node1 and node2.
    
  • addNode(node_data n) //O(1)

      this method get node_data and add the node_data to the graph.
    
  • connect(int node1, int node2) //O(1)

      This method connect an edge between node1 and node2.
    
  • getV() //O(1)

      This method return a pointer for the collection representing all the nodes in the graph.
    
  • getV(int node_id) //O(1)

      This method return a collection of the all nodes that connected to node_id.
    
  • removeNode(int key) //O(n)

      This method remove node_data and his edges from the graph.
    
  • removeEdge(int node1, int node2) //O(1)

      This method remove edge from the graph.
    
  • nodeSize() //O(1)

      This method return number of the nodes in the graph.
    
  • edgeSize() //O(1)

      This method return the number of the edges in the graph.
    
  • getMC() //O(1)

      This method return number of the changes in the graph.
    
  • toString()

      This method override object and prints our graph like : [node] -> [neighbors of node]