Package classycle.graph

# Class LongestWalkProcessor

java.lang.Object
classycle.graph.GraphProcessor
classycle.graph.LongestWalkProcessor

public class LongestWalkProcessor extends GraphProcessor
Calculates for each vertex the longest walk. This processor assumes that the graph has no cycles.

Author:
  Franz-Josef Elmer

## Constructor Summary

Constructors
Constructor
Description
`LongestWalkProcessor()`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`finishProcessing(Vertex[] graph)`
Finishes processing by sorting the result in accordance with the walk length.
`protected void`
`initializeProcessing(Vertex[] graph)`
Does nothing.
`protected void`
`processAfter(Vertex vertex)`
Deactivate the specified vertex.
`protected void`
`processArc(Vertex tail, Vertex head)`
Processes arc from `tail` to `head`.
`protected void`
`processBefore(Vertex vertex)`
Resets the specified vertex.

### Methods inherited from class classycle.graph.GraphProcessor

`deepSearchFirst, process`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### LongestWalkProcessor

public LongestWalkProcessor()

## Method Details

### initializeProcessing

protected void initializeProcessing(Vertex[] graph)
Does nothing.

Specified by:
  `initializeProcessing` in class `GraphProcessor`

### processBefore

protected void processBefore(Vertex vertex)
Resets the specified vertex.

Specified by:
  `processBefore` in class `GraphProcessor`
Parameters:
  `vertex` - Vertex to be processed.
Throws:
  `IllegalArgumentException` - if `vertex` is not an instance of `StrongComponent`.

### processArc

protected void processArc(Vertex tail, Vertex head)
Processes arc from `tail` to `head`. Calculates the longest walk of `tail`.

Specified by:
  `processArc` in class `GraphProcessor`
Parameters:
  `tail` - Tail vertex of the arc.
  `head` - Head vertex of the arc.
Throws:
  `IllegalArgumentException` - if both vertices are not instances of `StrongComponent` or if `head` is visited and active which indicates a cycle in the graph.

### processAfter

protected void processAfter(Vertex vertex)
Deactivate the specified vertex.

Specified by:
  `processAfter` in class `GraphProcessor`
Parameters:
  `vertex` - Vertex to be processed.
Throws:
  `IllegalArgumentException` - if `vertex` is not an instance of `StrongComponent`.

### finishProcessing

protected void finishProcessing(Vertex[] graph)
Finishes processing by sorting the result in accordance with the walk length.

Specified by:
  `finishProcessing` in class `GraphProcessor`