Home Reference Source Test Repository
public class | source

TraversalAlgorithm

Extends:

AbstractAlgorithm → TraversalAlgorithm

Class that contains code for running a traversal algorithm.

Constructor Summary

Public Constructor
public

constructor(graph: Graph)

Constructor for TraversalAlgorithm.

Member Summary

Public Members
public
public
public
public

result: *

public

Method Summary

Public Methods
public

hasVisited(object: Node | Edge): boolean

Check if a node or edge has been visited by the algorithm.

public

reset()

Reset the algorithm so that it can be run again.

public
public

visitEdge(edge: Edge)

Visit the specified edge.

public

visitNode(node: Node)

Visit the specified node.

Inherited Summary

From class AbstractAlgorithm
public

graph: *

public

Run the next step of the algorithm.

Public Constructors

public constructor(graph: Graph) source

Constructor for TraversalAlgorithm.

Override:

AbstractAlgorithm#constructor

Params:

NameTypeAttributeDescription
graph Graph

The graph that the algorithm will be run on.

Public Members

public graphState: * source

public hasStarted: boolean source

public isComplete: boolean source

public result: * source

public stepBuilder: * source

Public Methods

public hasVisited(object: Node | Edge): boolean source

Check if a node or edge has been visited by the algorithm.

Params:

NameTypeAttributeDescription
object Node | Edge

The node/edge to be checked.

Return:

boolean

Whether or not the node/edge has been visited.

public reset() source

Reset the algorithm so that it can be run again.

public step(): boolean source

Override:

AbstractAlgorithm#step

Return:

boolean

public visitEdge(edge: Edge) source

Visit the specified edge.

Params:

NameTypeAttributeDescription
edge Edge

The edge to be visited.

public visitNode(node: Node) source

Visit the specified node.

Params:

NameTypeAttributeDescription
node Node

The node to be visited.