DexNet 4.7.0
Public Member Functions
com::sparsity::dex::algorithms::TraversalDFS Class Reference

Depth-First Search (DFS) implementation of Traversal. More...

Inheritance diagram for com::sparsity::dex::algorithms::TraversalDFS:
Inheritance graph
Collaboration diagram for com::sparsity::dex::algorithms::TraversalDFS:
Collaboration graph

List of all members.

Public Member Functions

void AddAllNodeTypes ()
 Allows for traversing all node types of the graph.
void AddAllEdgeTypes (com.sparsity.dex.gdb.EdgesDirection d)
 Allows for traversing all edge types of the graph.
bool HasNext ()
 Gets if there are more objects to be traversed.
void ExcludeNodes (com.sparsity.dex.gdb.Objects nodes)
 Set which nodes can't be used.
long Next ()
 Gets the next object of the traversal.
 TraversalDFS (com.sparsity.dex.gdb.Session s, long node)
 Creates a new instance.
void AddEdgeType (int t, com.sparsity.dex.gdb.EdgesDirection d)
 Allows for traversing edges of the given type.
void AddNodeType (int t)
 Allows for traversing nodes of the given type.
int GetCurrentDepth ()
 Returns the depth of the current node.
void SetMaximumHops (int maxhops)
 Sets the maximum hops restriction.
void ExcludeEdges (com.sparsity.dex.gdb.Objects edges)
 Set which edges can't be used.
boolean IsClosed ()
 Gets if Traversal instance has been closed or not.
void Close ()
 Closes the Traversal instance.

Detailed Description

Depth-First Search (DFS) implementation of Traversal.

Starting from a source or root node, it visits as far as possible along each branch before backtracking.

Author:
Sparsity Technologies http://www.sparsity-technologies.com

Constructor & Destructor Documentation

com::sparsity::dex::algorithms::TraversalDFS::TraversalDFS ( com.sparsity.dex.gdb.Session  s,
long  node 
)

Creates a new instance.

Parameters:
s[in] Session to get the graph from and perform traversal.
node[in] Node to start traversal from.

Member Function Documentation

void com::sparsity::dex::algorithms::TraversalDFS::AddAllEdgeTypes ( com.sparsity.dex.gdb.EdgesDirection  d)

Allows for traversing all edge types of the graph.

Parameters:
d[in] Edge direction.

Reimplemented from com::sparsity::dex::algorithms::Traversal.

void com::sparsity::dex::algorithms::TraversalDFS::AddEdgeType ( int  t,
com.sparsity.dex.gdb.EdgesDirection  d 
)

Allows for traversing edges of the given type.

Parameters:
t[in] Edge type.
d[in] Edge direction.

Reimplemented from com::sparsity::dex::algorithms::Traversal.

void com::sparsity::dex::algorithms::TraversalDFS::AddNodeType ( int  t)

Allows for traversing nodes of the given type.

Parameters:
tnull

Reimplemented from com::sparsity::dex::algorithms::Traversal.

void com::sparsity::dex::algorithms::Traversal::Close ( ) [inherited]

Closes the Traversal instance.

It must be called to ensure the integrity of all data.

void com::sparsity::dex::algorithms::TraversalDFS::ExcludeEdges ( com.sparsity.dex.gdb.Objects  edges)

Set which edges can't be used.

This will replace any previously specified set of excluded edges. Should only be used to exclude the usage of specific edges from allowed edge types because it's less efficient than not allowing an edge type.

Parameters:
edges[in] A set of edge identifiers that must be kept intact until the destruction of the class.

Reimplemented from com::sparsity::dex::algorithms::Traversal.

void com::sparsity::dex::algorithms::TraversalDFS::ExcludeNodes ( com.sparsity.dex.gdb.Objects  nodes)

Set which nodes can't be used.

This will replace any previously specified set of excluded nodes. Should only be used to exclude the usage of specific nodes from allowed node types because it's less efficient than not allowing a node type.

Parameters:
nodes[in] A set of node identifiers that must be kept intact until the destruction of the class.

Reimplemented from com::sparsity::dex::algorithms::Traversal.

int com::sparsity::dex::algorithms::TraversalDFS::GetCurrentDepth ( )

Returns the depth of the current node.

That is, it returns the depth of the node returned in the last call to Next().

Returns:
The depth of the current node.

Reimplemented from com::sparsity::dex::algorithms::Traversal.

bool com::sparsity::dex::algorithms::TraversalDFS::HasNext ( )

Gets if there are more objects to be traversed.

Returns:
TRUE if there are more objects, FALSE otherwise.

Reimplemented from com::sparsity::dex::algorithms::Traversal.

boolean com::sparsity::dex::algorithms::Traversal::IsClosed ( ) [inherited]

Gets if Traversal instance has been closed or not.

See also:
Close()
Returns:
TRUE if the Traversal instance has been closed, FALSE otherwise.
long com::sparsity::dex::algorithms::TraversalDFS::Next ( )

Gets the next object of the traversal.

Returns:
A node or edge identifier.

Reimplemented from com::sparsity::dex::algorithms::Traversal.

void com::sparsity::dex::algorithms::TraversalDFS::SetMaximumHops ( int  maxhops)

Sets the maximum hops restriction.

All paths longer than the maximum hops restriction will be ignored.

Parameters:
maxhops[in] The maximum hops restriction. It must be positive or zero. Zero, the default value, means unlimited.

Reimplemented from com::sparsity::dex::algorithms::Traversal.