DexNet 4.7.0
Public Member Functions | Static Public Member Functions
com::sparsity::dex::algorithms::Context Class Reference

Context class. More...

List of all members.

Public Member Functions

void SetMaximumHops (int maxhops, bool include)
 Sets the maximum hops restriction.
com.sparsity.dex.gdb.Objects Compute ()
 Gets the resulting collection of nodes.
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.
void ExcludeEdges (com.sparsity.dex.gdb.Objects edges)
 Set which edges can't be used.
boolean IsClosed ()
 Gets if Context instance has been closed or not.
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.
void Close ()
 Closes the Context instance.
void ExcludeNodes (com.sparsity.dex.gdb.Objects nodes)
 Set which nodes can't be used.
 Context (com.sparsity.dex.gdb.Session s, long node)
 Creates a new instance.

Static Public Member Functions

static com.sparsity.dex.gdb.Objects Compute (com.sparsity.dex.gdb.Session s, long node, com.sparsity.dex.gdb.TypeList nodeTypes, com.sparsity.dex.gdb.TypeList edgeTypes, com.sparsity.dex.gdb.EdgesDirection dir, int maxhops, bool include)
 Helper method to easily compute a context from a node.

Detailed Description

Context class.

It provides a very similar functionality than the Traversal classes. The main difference is Context returns a resulting collection whereas Traversal provides an iterator behaviour.

The user must set which edge types and node types can be used for the traversal. For the edge types, the user may specify how to navigate them:

(i) Just navigate through out-going edges from the current node.

(ii) Just navigate through in-going edges from the current node.

(iii) Navigate through both in-going and out-going edges from the current node.

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

Constructor & Destructor Documentation

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

Creates a new instance.

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

Member Function Documentation

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

Allows for traversing all edge types of the graph.

Parameters:
d[in] Edge direction.
void com::sparsity::dex::algorithms::Context::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.
void com::sparsity::dex::algorithms::Context::AddNodeType ( int  t)

Allows for traversing nodes of the given type.

Parameters:
tnull
void com::sparsity::dex::algorithms::Context::Close ( )

Closes the Context instance.

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

static com.sparsity.dex.gdb.Objects com::sparsity::dex::algorithms::Context::Compute ( com.sparsity.dex.gdb.Session  s,
long  node,
com.sparsity.dex.gdb.TypeList  nodeTypes,
com.sparsity.dex.gdb.TypeList  edgeTypes,
com.sparsity.dex.gdb.EdgesDirection  dir,
int  maxhops,
bool  include 
) [static]

Helper method to easily compute a context from a node.

Parameters:
s[in] Session to get the graph from and perform operation.
node[in] Node to start traversal from.
nodeTypes[in] Allowed node type list. NULL means all node types are allowed.
edgeTypes[in] Allowed edge type list. NULL means all edge types are allowed.
dir[in] Allowed direction for the allowed edge types.
maxhops[in] The maximum hops restriction. It must be positive or zero. Zero, the default value, means unlimited.
include[in] If TRUE, the resulting collection will include those nodes at distance less or equal than the given one, otherwise it will just include those nodes at distance equal than the given one. This parameter just makes sense if maxhops is different from 0; in that case it includes all nodes no matters the distance.
com.sparsity.dex.gdb.Objects com::sparsity::dex::algorithms::Context::Compute ( )

Gets the resulting collection of nodes.

Returns:
The resulting collection of nodes.
void com::sparsity::dex::algorithms::Context::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.
void com::sparsity::dex::algorithms::Context::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.
boolean com::sparsity::dex::algorithms::Context::IsClosed ( )

Gets if Context instance has been closed or not.

See also:
Close()
Returns:
TRUE if the Context instance has been closed, FALSE otherwise.
void com::sparsity::dex::algorithms::Context::SetMaximumHops ( int  maxhops,
bool  include 
)

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.
include[in] If TRUE, the resulting collection will include those nodes at distance less or equal than the given one, otherwise it will just include those nodes at distance equal than the given one. This parameter just makes sense if maxhops is different from 0; in that case it includes all nodes no matters the distance.