Sparksee
6.0.2
|
SinglePairShortestPathBFS class. More...
Public Member Functions | |
virtual | ~SinglePairShortestPathBFS () |
Destructor. | |
virtual void | Run () |
Executes the algorithm. | |
virtual sparksee::gdb::OIDList * | GetPathAsNodes () |
Gets the shortest path between the source node and the destination node as an ordered set of nodes. More... | |
virtual sparksee::gdb::OIDList * | GetPathAsEdges () |
Gets the shortest path between the source node and the destination node as an ordered set of edges. More... | |
virtual sparksee::gdb::double64_t | GetCost () |
Gets the cost of the shortest path. More... | |
SinglePairShortestPathBFS (sparksee::gdb::Session &session, sparksee::gdb::oid_t src, sparksee::gdb::oid_t dst) | |
Creates a new instance. More... | |
virtual void | CheckOnlyExistence () |
Set that only the path existence must be calculated and not the path itself. More... | |
virtual sparksee::gdb::bool_t | Exists () |
Returns TRUE If a path exists or FALSE otherwise. | |
void | SetMaximumHops (sparksee::gdb::int32_t maxhops) |
Sets the maximum hops restriction. More... | |
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. | |
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... | |
Protected Member Functions | |
void | AssertEdgeType (sparksee::gdb::type_t edgetype) |
Check that the given edge type is valid. | |
void | AssertAddedEdges () |
Check that edges had been added. | |
void | AssertAddedNodes () |
Check that nodes had been added. | |
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. | |
void | AssertNotComputed () |
Check that the shortest path had not been calculated yet. | |
void | AssertComputed () |
Check that the shortest path had been calculated. | |
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::oid_t | source |
Source node. | |
sparksee::gdb::oid_t | destination |
Destination node. | |
sparksee::gdb::OIDList * | pathAsNodes |
Ordered set of node identifiers representing the shortest path. | |
sparksee::gdb::OIDList * | pathAsEdges |
Ordered set of edge identifiers representing the shortest path. More... | |
sparksee::gdb::Session * | sess |
Session. | |
sparksee::gdb::Graph * | graph |
Graph. | |
std::map< sparksee::gdb::type_t, sparksee::gdb::EdgesDirection > | edgeTypes |
Allowed edge types. | |
std::vector< sparksee::gdb::type_t > | nodeTypes |
Allowed node types. | |
sparksee::gdb::int32_t | maxHops |
Maximum hops restriction. More... | |
sparksee::gdb::bool_t | computed |
True if the shortest path has been calculated. | |
sparksee::gdb::Objects * | excludedNodes |
The set of excluded nodes. | |
sparksee::gdb::Objects * | excludedEdges |
The set of excluded edges. | |
sparksee::gdb::bool_t | areAllNodeTypesAllowed |
True if all the node types are allowed. | |
SinglePairShortestPathBFS class.
It solves the single-pair shortest path problem using a BFS-based implementation.
It is a unweighted algorithm, that is it assumes all edges have the same cost.
Check out the 'Algorithms' section in the SPARKSEE User Manual for more details on this.
SinglePairShortestPathBFS::SinglePairShortestPathBFS | ( | sparksee::gdb::Session & | session, |
sparksee::gdb::oid_t | src, | ||
sparksee::gdb::oid_t | dst | ||
) |
Creates a new instance.
session | [in] Session to get the graph from and perform traversal. |
src | [in] Source node. |
dst | [dst] Destination node. |
|
virtualinherited |
Allows for traversing all edge types of the graph.
dir | [in] Edge direction. |
|
virtualinherited |
Allows for traversing edges of the given type.
type | [in] Edge type. |
dir | [in] Edge direction. |
|
virtual |
Set that only the path existence must be calculated and not the path itself.
That method should improve the performance of the algorithm, but a call to GetPathAsNodes or GetPathAsEdges will generate an exception even if the path exists.
|
virtualinherited |
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.
edges | [in] A set of edge identifiers that must be kept intact until the destruction of the class. |
|
virtualinherited |
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.
nodes | [in] A set of node identifiers that must be kept intact until the destruction of the class. |
|
virtual |
Gets the cost of the shortest path.
The cost is the number of hops of the shortest path.
Implements SinglePairShortestPath.
|
virtual |
Gets the shortest path between the source node and the destination node as an ordered set of edges.
Implements SinglePairShortestPath.
|
virtual |
Gets the shortest path between the source node and the destination node as an ordered set of nodes.
Implements SinglePairShortestPath.
|
inherited |
Sets the maximum hops restriction.
All paths longer than the maximum hops restriction will be ignored.
maxhops | [in] The maximum hops restriction. It must be positive or zero. Zero, the default value, means unlimited. |
|
protectedinherited |
Maximum hops restriction.
It must be positive or zero. Zero means unlimited.
|
protectedinherited |
Ordered set of edge identifiers representing the shortest path.
May be computed lazily when requested from the pathAsNodes.