Custom algorithm plugin - ns3098/Graph_Visualiser GitHub Wiki

You need Qt to build your plugin.


  1. Download source code of this project
  2. Open CustomAlgo folder and open with Qt.
  3. Edit customalgo.cpp file and find bool CustomAlgo::run(AbstractGraph *gr, int sver) function

Class have algoParams variable. It contains:

struct plugParams{
    TvertexInfo vi; // standard vertex params
    TribInfo ri;    // standard merge params
    int sleepTime;  // animation speed

Function use:

  • Using resetGraph(gr, "#9CCC65", "#000000"); you can set one color for all vertexes (#9CCC65) and merges (#000000).
  • Using asleep() macro you can make animation.
  • Convert AbstractGraph class to GraphModel using GraphModel gm = gr->getGraphModel();.
  • Convert GraphModel to MatrixGS, VectorListGS or RibListGS.
  • Use AG_CHANGE_VER_PARAM(AG, ver, param, val) and AG_CHANGE_RIB_PARAM(AG, rib, param, val) to change vertexes and ribs.
  • Use result variable to display result.
  • Use return true to display message with result or return false to end algorithm.

See examples and Graph Library documentation to write your algorithm.

Build this project and load plugin to Graph Builder.