@Override public boolean equals(Object o){
  if (o instanceof Graph) {
    return string.equals(o.toString());
  }
  return false;
}

@ Override public boolean equals ( Object o ) { if ( o instanceof Graph ) { return string . equals ( o . toString ( ) ) ; } return false ; }
returns true if the object is a graph with the same content .
