package graph;

/**
 * A colorable graph data type.
 * @param <E> the type of the elements that will be inserted in the graph.
 * @author fpereira.
 *
 */
public interface Graph<E> {
  /**
   * Add an edge from e2 to e1, and from e1 to e2.
   * @param e1 one of the nodes.
   * @param e2 the other node.
   */
  void link(E e1, E e2);

  /**
   * Add a node to the graph.
   * @param e the element that will be added into the graph.
   */
  void add(E e);

  /**
   * Determines if the given element is part of the graph.
   * @param e The element that is being tested for containment.
   * @return true if the element is present in the grpah, and false otherwise.
   */
  boolean contains(E e);

  /**
   * Tells if the two elements are adjacent in the graph.
   * @param e1 the first element.
   * @param e2 the second element.
   * @return true if the elements are adjacent.
   */
  boolean neighbors(E e1, E e2);
}
