Skip to content
Unick Soft edited this page Dec 26, 2020 · 4 revisions

IAlgorithm is inherited from IAlgorithmEngine and IAlgorithmResult.

IAlgorithmEngine

IAlgorithmEngine is used to pass parameters and calculate result.

  • GetFullName() - return full name if algorithm.

  • GetShortName() - return short name of algorithm.

  • EnumParameter(IndexType index, AlgorithmParam* outParamInfo) - enumerate parameters. Return true if parameter with index exists. Also it fill AlgorithmParam.

  • SetParameter(const AlgorithmParam* param) - program passes parameter value for algorithm calculation using this method. See more about AlgorithmParam.

  • SetGraph(const IGraph* pGraph) - program passes graph to alorithm using this method.

  • Calculate() - program call this method and algorithm calculates retuls in this method. It should return true if calcualtion was success.

  • SetAlgorithmFactory(const IAlgorithmFactory* pAlgorithmFactory) - program passes algorithm factory. Algoritm can create other algorithm for calculating.

  • IsSupportMultiGraph() - return true if algorithm supports calcualtion for multigraph.

IAlgorithmResult

IAlgorithmResult is used to create report of algorithm calculation.

  • GetHightlightNodesCount() - return number of hightlight hodes. For example: nodes in needed path.

  • GetHightlightNode(IndexType index) - return NodeId of hightlight node by index. Indexes are from 0 to GetHightlightNodesCount() - 1.

  • GetHightlightEdgesCount() - return number of hightlight edges. For example: edges in needed path.

  • GetHightlightEdge(IndexType index) - return EdgeId of hightlight edge by index. Indexes are from 0 to GetHightlightEdgesCount() - 1.

  • GetResultCount() - return number of results. Usually it returns 1. For example length of shortpath.

  • GetResult(IndexType index) - return AlgorithmResult by index. Indexes are from 0 to GetResultCount() - 1.

  • GetNodeProperty(ObjectId object, IndexType index, AlgorithmResult* param) - return true, if Node has additional property by index. Result is AlgorithmResult. If property doesn't exist, it will return false.

  • GetNodePropertyName(IndexType index) - return name of node property. Value of property you can get using GetNodeProperty.

  • GetEdgeProperty(const NodesEdge& object, IndexType index, AlgorithmResult* param) - return true, if Edge has additional property by index. Result is AlgorithmResult. If property doesn't exist, it will return false.

  • GetEdgePropertyName(IndexType index) - return name of edge property. Value of property you can get using GetEdgeProperty.

Clone this wiki locally