Package classycle.graph
Class Vertex
java.lang.Object
classycle.graph.Vertex
- All Implemented Interfaces:
 Comparable<Vertex>
- Direct Known Subclasses:
 AtomicVertex,StrongComponent
The base class for any type of vertex in a directed graph.
  
  A Vertex holds an Attributes object which encapsulates
  all properties of the vertex which are not necessary to know for
  parsing a graph in a GraphProcessor. Only the visited flag will
  be manipulated during parsing.
  
  A Vertex knows the head and tail vertices of all its outgoing
  and incoming arcs. When a head vertex is added by the method
  addOutgoingArcTo(classycle.graph.Vertex) also the corresponding incoming arc is built
  in the head vertex. The same is true the other way around. Note,
  that multi-arcs are not possible. That is, adding an already added
  head/tail vertex again as a head/tail vertex will be ignored.
- Author:
 - Franz-Josef Elmer
 
- 
Constructor Summary
ConstructorsConstructorDescriptionVertex(Attributes attributes) Create a new instance for the specified attributes. - 
Method Summary
Modifier and TypeMethodDescriptionvoidaddIncomingArcTo(Vertex tailVertex) Adds an incoming arc to the specified vertex.voidaddOutgoingArcTo(Vertex headVertex) Adds an outgoing arc to the specified vertex.intReturns the attributes.getHeadVertex(int index) Returns the head vertex of the specified outgoing arc.intReturns the number of incoming arcs.intReturns the number of outgoing arcs.getTailVertex(int index) Returns the tail vertex of the specified outgoing arc.booleanReturns the visited flag.voidreset()Reset this vertex.toString()Returns toString() of the attributes and the number of incoming and outgoing arcs.voidvisit()Marks this instance as visited. 
- 
Constructor Details
- 
Vertex
Create a new instance for the specified attributes. 
 - 
 - 
Method Details
- 
getAttributes
Returns the attributes. - 
getNumberOfOutgoingArcs
public int getNumberOfOutgoingArcs()Returns the number of outgoing arcs. This is equivalent to the number of head vertices. - 
getHeadVertex
Returns the head vertex of the specified outgoing arc. - 
addOutgoingArcTo
Adds an outgoing arc to the specified vertex. Also callsaddIncomingArcTo(classycle.graph.Vertex)for headVertex with this as the argument. Does nothing if headVertex is the head vertex of an already existing outgoing arc.- Parameters:
 headVertex- Head vertex to be added to establish a new outgoing arc. Null is not allowed.
 - 
getNumberOfIncomingArcs
public int getNumberOfIncomingArcs()Returns the number of incoming arcs. This is equivalent to the number of tail vertices. - 
getTailVertex
Returns the tail vertex of the specified outgoing arc. - 
addIncomingArcTo
Adds an incoming arc to the specified vertex. Also callsaddOutgoingArcTo(classycle.graph.Vertex)for tailVertex with this as the argument. Does nothing if tailVertex is the tail vertex of an already existing incoming arc.- Parameters:
 tailVertex- Tail vertex to be added to establish a new incoming arc. Null is not allowed.
 - 
reset
public void reset()Reset this vertex. That is, the visited flag is set to false. - 
visit
public void visit()Marks this instance as visited. That is, the visited flag becomes true. - 
isVisited
public boolean isVisited()Returns the visited flag. - 
toString
Returns toString() of the attributes and the number of incoming and outgoing arcs. - 
compareTo
- Specified by:
 compareToin interfaceComparable<Vertex>
 
 -