Sparksee  6.0.2
RandomWalk Class Reference

RandomWalk class. More...

Inheritance diagram for RandomWalk:
Inheritance graph
Collaboration diagram for RandomWalk:
Collaboration graph

Public Member Functions

 RandomWalk (sparksee::gdb::Session &session, sparksee::gdb::oid_t node)
 Builds the RandomWalk. More...
 
virtual ~RandomWalk ()
 Destructor.
 
virtual void AddEdgeType (sparksee::gdb::type_t type, sparksee::gdb::EdgesDirection dir)
 Allows for traversing edges of the given type. More...
 
virtual void AddAllEdgeTypes (sparksee::gdb::EdgesDirection dir)
 Allows for traversing all edge types of the graph. More...
 
virtual void AddNodeType (sparksee::gdb::type_t type)
 Allows for traversing nodes of the given type. More...
 
virtual void AddAllNodeTypes ()
 Allows for traversing all node types of the graph.
 
virtual void ExcludeNodes (sparksee::gdb::Objects &nodes)
 Set which nodes can't be used. More...
 
virtual void ExcludeEdges (sparksee::gdb::Objects &edges)
 Set which edges can't be used. More...
 
virtual sparksee::gdb::oid_t Next ()
 Gets the next object of the traversal. More...
 
virtual sparksee::gdb::bool_t HasNext ()
 Gets if there are more objects to be traversed. More...
 
virtual sparksee::gdb::int32_t GetCurrentDepth () const
 Returns the depth of the current node. More...
 
void SetEdgeWeightAttributeType (sparksee::gdb::attr_t attr)
 Sets the attribute to use as edge weight. More...
 
void SetDefaultWeight (sparksee::gdb::double64_t weight)
 Sets the default weight for those cases when a given edge does not have a weight attribute set. More...
 
void Reset (sparksee::gdb::oid_t startNode)
 Sets the starting node of the RandomWalk. More...
 
void SetReturnParameter (sparksee::gdb::double64_t val)
 Sets the return parameter of the RandomWalk. More...
 
void SetInOutParameter (sparksee::gdb::double64_t val)
 Sets the In-Out parameter of the RandomWalk. More...
 
void SetSeed (sparksee::gdb::int32_t seed)
 Sets the seed of the random walk. More...
 
virtual void SetMaximumHops (sparksee::gdb::int32_t maxhops)
 Sets the maximum hops restriction. More...
 

Protected Member Functions

void AssertAddedEdges ()
 Check that edges had been added.
 
void AssertAddedNodes ()
 Check that nodes had been added.
 
void AssertEdgeType (sparksee::gdb::type_t edgetype)
 Check that the given edge type is valid.
 
void AssertNodeType (sparksee::gdb::type_t nodetype)
 Check that the given node type is valid.
 
sparksee::gdb::bool_t IsNodeTypeAllowed (sparksee::gdb::oid_t nodeId)
 Check if the given node has an allowed type.
 
sparksee::gdb::bool_t IsNodeExcluded (sparksee::gdb::oid_t node)
 Check if the given node is forbidden.
 
sparksee::gdb::bool_t IsEdgeExcluded (sparksee::gdb::oid_t edge)
 Check if the given edge is forbidden.
 

Protected Attributes

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

Detailed Description

RandomWalk class.

Implements the RandomWalk algorithm

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

Constructor & Destructor Documentation

RandomWalk::RandomWalk ( sparksee::gdb::Session &  session,
sparksee::gdb::oid_t  node 
)

Builds the RandomWalk.

Parameters
session[in] The session to use
node[in] The starting node of the traversal

Member Function Documentation

virtual void RandomWalk::AddAllEdgeTypes ( sparksee::gdb::EdgesDirection  dir)
virtual

Allows for traversing all edge types of the graph.

Parameters
dir[in] Edge direction.

Reimplemented from Traversal.

virtual void RandomWalk::AddEdgeType ( sparksee::gdb::type_t  type,
sparksee::gdb::EdgesDirection  dir 
)
virtual

Allows for traversing edges of the given type.

If the edge type was already added, the existing direction is overwritten

Parameters
type[in] Edge type.
dir[in] Edge direction.

Reimplemented from Traversal.

virtual void RandomWalk::AddNodeType ( sparksee::gdb::type_t  type)
virtual

Allows for traversing nodes of the given type.

Parameters
typeThe node type to add

Reimplemented from Traversal.

virtual void RandomWalk::ExcludeEdges ( sparksee::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.

Reimplemented from Traversal.

virtual void RandomWalk::ExcludeNodes ( sparksee::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.

Reimplemented from Traversal.

virtual sparksee::gdb::int32_t RandomWalk::GetCurrentDepth ( ) const
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.

Implements Traversal.

virtual sparksee::gdb::bool_t RandomWalk::HasNext ( )
virtual

Gets if there are more objects to be traversed.

Returns
TRUE if there are more objects, FALSE otherwise.

Implements Traversal.

virtual sparksee::gdb::oid_t RandomWalk::Next ( )
virtual

Gets the next object of the traversal.

Returns
A node or edge identifier.

Implements Traversal.

void RandomWalk::Reset ( sparksee::gdb::oid_t  startNode)

Sets the starting node of the RandomWalk.

This method resets the RandomWalk.

Exceptions
sparksee::gdb::Error
void RandomWalk::SetDefaultWeight ( sparksee::gdb::double64_t  weight)

Sets the default weight for those cases when a given edge does not have a weight attribute set.

Default: 0.0

Parameters
weight[in] The default weight
void RandomWalk::SetEdgeWeightAttributeType ( sparksee::gdb::attr_t  attr)

Sets the attribute to use as edge weight.

If the multiple edge are set for traversal, this attribute must be of type GLOBAL_TYPE or EDGES_TYPE. Additionally, the attribute must be of type Double. Finally, negative weights are treated as non existing, so the default weight applies.

Parameters
attr[in] The attribute type to use as a weight. Default: InvalidAttribute
void RandomWalk::SetInOutParameter ( sparksee::gdb::double64_t  val)

Sets the In-Out parameter of the RandomWalk.

Parameters
valThe In-Out parameter to set. Default: 1.0
virtual void Traversal::SetMaximumHops ( sparksee::gdb::int32_t  maxhops)
virtualinherited

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.
void RandomWalk::SetReturnParameter ( sparksee::gdb::double64_t  val)

Sets the return parameter of the RandomWalk.

Parameters
valThe return parameter to set. Default: 1.0
void RandomWalk::SetSeed ( sparksee::gdb::int32_t  seed)

Sets the seed of the random walk.

Parameters
seedThe seed to generate the random numbers that drive the random walk

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