Package org.graphstream.algorithm
Class LongestPath
java.lang.Object
org.graphstream.algorithm.LongestPath
- All Implemented Interfaces:
Algorithm
public class LongestPath extends Object implements Algorithm
Implementation of longest path algorithm in a DAG (directed acyclic graph) using topologicalSort
- Computational Complexity :
- yet to be calculated
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_WEIGHT_ATTRIBUTE
Default weight attribute -
Constructor Summary
Constructors Constructor Description LongestPath()
-
Method Summary
Modifier and Type Method Description void
compute()
Run the algorithm.String
defaultResult()
org.graphstream.graph.Path
getLongestPath()
gets longest pathList<org.graphstream.graph.Node>
getLongestPathList()
gets sorted list of the longest pathDouble
getLongestPathValue()
get value of longest path if unweighted value = hopsString
getWeightAttribute()
void
init(org.graphstream.graph.Graph theGraph)
Initialization of the algorithm.void
setWeightAttribute(String weightAttribute)
-
Field Details
-
DEFAULT_WEIGHT_ATTRIBUTE
Default weight attribute- See Also:
- Constant Field Values
-
-
Constructor Details
-
LongestPath
public LongestPath()
-
-
Method Details
-
init
public void init(org.graphstream.graph.Graph theGraph)Description copied from interface:Algorithm
Initialization of the algorithm. This method has to be called before theAlgorithm.compute()
method to initialize or reset the algorithm according to the new given graph. -
compute
public void compute()Description copied from interface:Algorithm
Run the algorithm. TheAlgorithm.init(Graph)
method has to be called before computing.- Specified by:
compute
in interfaceAlgorithm
- See Also:
Algorithm.init(Graph)
-
getLongestPathList
gets sorted list of the longest path- Returns:
- sorted list of nodes in longest path
-
getLongestPath
public org.graphstream.graph.Path getLongestPath()gets longest path- Returns:
- longest path
-
defaultResult
-
getLongestPathValue
get value of longest path if unweighted value = hops- Returns:
- value of longest path
-
getWeightAttribute
-
setWeightAttribute
-