2. The Algorithm class.
Prev | Chapter 6. Plug-ins development | Next

## 2. The Algorithm class.

The class Algorithm is the class from which your algorithm will inherits if you want to write a more general algorithm. Instead of modifying just a specific property, it can be used to modify the entire graph. In this section, we will list all its members to have a global overview on what we can use to develop such a plug-in.

### Public members

Following is a list of all public members :

- `Algorithm (AlgorithmContext context)` :

  The constructor is the right place to declare the parameters needed by the algorithm.

  `addParameter<DoubleProperty>("metric", paramHelp[0], 0, false);`

  And to declare the algorithm dependencies.

  `addDependency<Algorithm>("Quotient Clustering", "1.0");`

- `~Algorithm ()` :

  Destructor of the class.

- `bool run ()` :

  This is the main method :

  - It will be called out if the pre-condition method (bool check (..)) returned true.

  - It is the starting point of your algorithm.

  The returned value must be true if your algorithm succeeded.

- `bool check (std::string)` :

  This method can be used to check what you need about topological properties of the graph, metric properties on graph elements or anything else.

The methods below, will be redefined in our plugin (See section plug-in skeleton).

### Protected members

Following is a list of all protected members :

- `Graph* graph` :

  This graph is the one given in parameters, the one on which the algorithm will be applied.

- `PluginProgress* pluginProgress` :

  The class PluginProgress can be used to have an interaction between the user and our algorithm. See the section called “The PluginProgress class.” for more details.

- `DataSet* dataSet` :

  This member contains all the parameters needed to run the algorithm. The class DataSet is a container which allows insertion of values of different types. The inserted data must have a copy-constructor well done. See the section called DataSet for more details.

Prev | Up | Next
Chapter 6. Plug-ins development | Home | 3. Import plug-ins