Graph Interface: Labeling

There are several operations in the Graph interface pertaining to labelling.

Here are four overloaded label methods:

/**
 * Label vertex with object.
 *
 * @param v Vertex position to label.
 * @param l Label object.
 * @throws PositionException If vertex position is invalid.
 */
void label(Vertex<V> v, Object l) throws PositionException;
/**
 * Label edge with object.
 *
 * @param e Edge position to label.
 * @param l Label object.
 * @throws PositionException If edge position is invalid.
 */
void label(Edge<E> e, Object l) throws PositionException;
/**
 * Vertex label.
 *
 * @param v Vertex position to query.
 * @return Label object (or null if none).
 * @throws PositionException If vertex position is invalid.
 */
Object label(Vertex<V> v) throws PositionException;
/**
 * Edge label.
 *
 * @param e Edge position to query.
 * @return Label object (or null if none).
 * @throws PositionException If edge position is invalid.
 */
Object label(Edge<E> e) throws PositionException;

And here is a method that clears all the labels:

/**
 * Clear all labels.
 * All labels are null after this.
 */
void clearLabels();

Notice the label type is Object. This means there is no requirement all labels having the same data type. Moreover, there is no exception thrown when label value is null.