Traversal Class Reference
[Algorithms]

Traversal class. More...

Inheritance diagram for Traversal:

Inheritance graph

List of all members.

Public Member Functions

virtual void AddEdgeType (dex::gdb::type_t t, dex::gdb::EdgesDirection d)
 Allows for traversing edges of the given type.
virtual void AddAllEdgeTypes (dex::gdb::EdgesDirection d)
 Allows for traversing all edge types of the graph.
virtual void AddNodeType (dex::gdb::type_t t)
 Allows for traversing nodes of the given type.
virtual void AddAllNodeTypes ()
 Allows for traversing all node types of the graph.
virtual void ExcludeNodes (dex::gdb::Objects &nodes)
 Set which nodes can't be used.
virtual void ExcludeEdges (dex::gdb::Objects &edges)
 Set which edges can't be used.
virtual dex::gdb::oid_t Next ()=0
 Gets the next object of the traversal.
virtual dex::gdb::bool_t HasNext ()=0
 Gets if there are more objects to be traversed.
virtual dex::gdb::int32_t GetCurrentDepth () const =0
 Returns the depth of the current node.
virtual void SetMaximumHops (dex::gdb::int32_t maxhops)
 Sets the maximum hops restriction.
virtual ~Traversal ()
 Destructor.

Protected Member Functions

 Traversal (dex::gdb::Session &s, dex::gdb::oid_t node)
 Creates a new instance.
void AssertAddedEdges ()
 Check that edges had been added.
void AssertAddedNodes ()
 Check that nodes had been added.
void AssertEdgeType (dex::gdb::type_t edgetype)
 Check that the given edge type is valid.
void AssertNodeType (dex::gdb::type_t nodetype)
 Check that the given node type is valid.
dex::gdb::bool_t IsNodeTypeAllowed (dex::gdb::oid_t nodeId)
 Check if the given node has an allowed type.
dex::gdb::bool_t IsNodeExcluded (dex::gdb::oid_t node)
 Check if the given node is forbidden.
dex::gdb::bool_t IsEdgeExcluded (dex::gdb::oid_t edge)
 Check if the given edge is forbidden.

Protected Attributes

dex::gdb::Session * sess
 Session.
dex::gdb::Graph * graph
 Graph.
dex::gdb::oid_t src
 Source node of the traversal.
std::map< dex::gdb::type_t,
dex::gdb::EdgesDirection
edgeTypes
 Allowed edge types.
std::vector< dex::gdb::type_tnodeTypes
 Allowed node types.
dex::gdb::int32_t maxHops
 Maximum number of hops allowed.
dex::gdb::Objects * excludedNodes
 The set of excluded nodes.
dex::gdb::Objects * excludedEdges
 The set of excluded edges.


Detailed Description

Traversal class.

Any class implementing this abstract class can be used to traverse a graph.

Once the instance has been created and the allowed node and edge types has been set, it can be used as an iterator, retrieving the next object identifier of the traversal until there are no more.

Check out the 'Algorithms' section in the DEX User Manual for more details on this.

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

Constructor & Destructor Documentation

Traversal::Traversal ( dex::gdb::Session &  s,
dex::gdb::oid_t  node 
) [protected]

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

virtual void Traversal::AddEdgeType ( dex::gdb::type_t  t,
dex::gdb::EdgesDirection  d 
) [virtual]

Allows for traversing edges of the given type.

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

virtual void Traversal::AddAllEdgeTypes ( dex::gdb::EdgesDirection  d  )  [virtual]

Allows for traversing all edge types of the graph.

Parameters:
d [in] Edge direction.

virtual void Traversal::ExcludeNodes ( dex::gdb::Objects &  nodes  )  [virtual]

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.

virtual void Traversal::ExcludeEdges ( dex::gdb::Objects &  edges  )  [virtual]

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.

virtual dex::gdb::oid_t Traversal::Next (  )  [pure virtual]

Gets the next object of the traversal.

Returns:
A node or edge identifier.

Implemented in TraversalBFS, and TraversalDFS.

virtual dex::gdb::bool_t Traversal::HasNext (  )  [pure virtual]

Gets if there are more objects to be traversed.

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

Implemented in TraversalBFS, and TraversalDFS.

virtual dex::gdb::int32_t Traversal::GetCurrentDepth (  )  const [pure virtual]

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.

Implemented in TraversalBFS, and TraversalDFS.

virtual void Traversal::SetMaximumHops ( dex::gdb::int32_t  maxhops  )  [virtual]

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.


The documentation for this class was generated from the following file:

Generated on Tue Jul 16 12:10:32 2013 for Dex by  doxygen 1.5.6