fr.inria.opengve.bridge.interfaces
Interface Path<V,E extends Link<V>>


public interface Path<V,E extends Link<V>>

A path in a Graph is a sequence of vertices such that from each of its vertices there is an Link to the successor vertex. There is two specific vertices called end or terminal vertices of the path. The other vertices in the path are internal vertices. This interface make some restrictions on the representing path :

Author:
fabrice.peix@sophia.inria.fr

Method Summary
 void concat(E e)
          Concat the edge e to this path.
 void concat(Path<V,E> p)
          Concat the path p to this path.
 boolean contains(E e)
          Tell if this path contain the edge e.
 boolean contains(V v)
          Tell if this path contain the vertex o.
 java.util.Iterator<E> edgeIterator(V v)
          Give an iterator on the Link of the path.
 E[] getEdges(V v)
          Give the Link connected to one vertex.
 V[] getEnds()
          Give the ends of the path.
 V getFirstVertex()
          Return the first vertex of an oriented Path.
 V getLastVertex()
          Return the last vertex of an oriented Path.
 boolean isDirected()
          Say if this path is oriented.
 boolean isEnd(V v)
          Determine if a vertex is an end of this path.
 int length()
          Give the length (number of edges) of this path.
 void remove(E e)
          Remove one Link from this Path.
 void remove(V v)
          Remove one vertex from a this path.
 java.util.Iterator<V> vertexIterator(V v)
          Give an iterator on the vertex of the path.
 

Method Detail

getEnds

V[] getEnds()
Give the ends of the path.

Returns:
A two elements array containing the ends of the path.

getEdges

E[] getEdges(V v)
Give the Link connected to one vertex.

Parameters:
v - A vertex
Returns:
A two elements array containing the one or two edge connected to the vertex. Throw an exeption if o not blonging to this path.
Throws:
java.lang.IllegalArgumentException

concat

void concat(Path<V,E> p)
            throws java.lang.RuntimeException
Concat the path p to this path. One ends of p must be the same as one ends of this path.

Parameters:
p - The path that we concat to this path.
Throws:
java.lang.RuntimeException - if the two paths don't share one of their ends.

concat

void concat(E e)
            throws java.lang.RuntimeException
Concat the edge e to this path. One ends of e must be the same as one ends of this path.

Parameters:
e - The edge that we concat to this path.
Throws:
java.lang.RuntimeException - if the this path and the given edge don't share one of their ends or if e is a loop.

remove

void remove(V v)
            throws java.lang.RuntimeException
Remove one vertex from a this path. Note that this vertex must be one of the ends of this path.

Parameters:
v - The vertex to suppress.
Throws:
java.lang.RuntimeException - If the givem vertex is not one ends of this path.

remove

void remove(E e)
            throws java.lang.RuntimeException
Remove one Link from this Path. Note that the Link must be an ending Link, in other word the Link must contains one of the ends of this Path.

Parameters:
e - The edge to suppress.
Throws:
java.lang.RuntimeException - If the given edge is not an ending edge of this path.

contains

boolean contains(V v)
Tell if this path contain the vertex o.

Parameters:
v - The vertex.
Returns:
true if this path contains o and false otherwise.

contains

boolean contains(E e)
Tell if this path contain the edge e.

Parameters:
e - The edge.
Returns:
true if this path contains e and false otherwise.

length

int length()
Give the length (number of edges) of this path.

Returns:
The length of this path (number of edge).

isEnd

boolean isEnd(V v)
Determine if a vertex is an end of this path.

Parameters:
v - a vertex.
Returns:
true if v is one of the ends of this Path.

edgeIterator

java.util.Iterator<E> edgeIterator(V v)
                                                   throws java.lang.RuntimeException
Give an iterator on the Link of the path. The first edge return contains o.

Parameters:
v - One of the ends of this Path if is not directed and any vertices belonging this Path otherwise.
Returns:
An iterator on the edges of the path.
Throws:
java.lang.RuntimeException - if this opath is undirected and the given vertex is not one end of this path.

vertexIterator

java.util.Iterator<V> vertexIterator(V v)
                                     throws java.lang.RuntimeException
Give an iterator on the vertex of the path.

Parameters:
v - One of the ends of this Path if is not oriented and any vertices belonging this Path otherwise.
Returns:
An iterator on the vertices of this Path.
Throws:
java.lang.RuntimeException - if this opath is undirected and the given vertex is not one end of this path.

isDirected

boolean isDirected()
Say if this path is oriented.

Returns:
true<\code> if the path is directed and false<\code> otherwise.

getFirstVertex

V getFirstVertex()
Return the first vertex of an oriented Path. If this path is not oriented this method throw an exeption.

Returns:
The first vertex of this path.
Throws:
java.lang.UnsupportedOperationException - if this path is undirected.

getLastVertex

V getLastVertex()
Return the last vertex of an oriented Path. If this path is not oriented this method throw an exeption.

Returns:
The first vertex of this path.
Throws:
java.lang.UnsupportedOperationException - if this path is undirected.


Copyright © 2009 INRIA (Projet Mascotte). All Rights Reserved.