Package classycle.graph
Class LongestWalkProcessor
java.lang.Object
classycle.graph.GraphProcessor
classycle.graph.LongestWalkProcessor
Calculates for each vertex the longest walk. This processor assumes
that the graph has no cycles.
- Author:
- Franz-Josef Elmer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidfinishProcessing(Vertex[] graph) Finishes processing by sorting the result in accordance with the walk length.protected voidinitializeProcessing(Vertex[] graph) Does nothing.protected voidprocessAfter(Vertex vertex) Deactivate the specified vertex.protected voidprocessArc(Vertex tail, Vertex head) Processes arc from tail to head.protected voidprocessBefore(Vertex vertex) Resets the specified vertex.Methods inherited from class classycle.graph.GraphProcessor
deepSearchFirst, process
-
Constructor Details
-
LongestWalkProcessor
public LongestWalkProcessor()
-
-
Method Details
-
initializeProcessing
Does nothing.- Specified by:
initializeProcessingin classGraphProcessor
-
processBefore
Resets the specified vertex.- Specified by:
processBeforein classGraphProcessor- Parameters:
vertex- Vertex to be processed.- Throws:
IllegalArgumentException- if vertex is not an instance ofStrongComponent.
-
processArc
Processes arc from tail to head. Calculates the longest walk of tail.- Specified by:
processArcin classGraphProcessor- Parameters:
tail- Tail vertex of the arc.head- Head vertex of the arc.- Throws:
IllegalArgumentException- if both vertices are not instances ofStrongComponentor if head is visited and active which indicates a cycle in the graph.
-
processAfter
Deactivate the specified vertex.- Specified by:
processAfterin classGraphProcessor- Parameters:
vertex- Vertex to be processed.- Throws:
IllegalArgumentException- if vertex is not an instance ofStrongComponent.
-
finishProcessing
Finishes processing by sorting the result in accordance with the walk length.- Specified by:
finishProcessingin classGraphProcessor
-