Custom algorithm plugin - ns3098/Graph_Visualiser GitHub Wiki
You need Qt to build your plugin.
Instruction
- Download source code of this project
- Open
CustomAlgofolder and openCustomAlgo.prowith Qt. - Edit
customalgo.cppfile and findbool 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
AbstractGraphclass toGraphModelusingGraphModel gm = gr->getGraphModel();. - Convert
GraphModeltoMatrixGS,VectorListGSorRibListGS. - Use
AG_CHANGE_VER_PARAM(AG, ver, param, val)andAG_CHANGE_RIB_PARAM(AG, rib, param, val)to change vertexes and ribs. - Use
resultvariable to display result. - Use
return trueto display message with result orreturn falseto end algorithm.
See examples and Graph Library documentation to write your algorithm.
Build this project and load plugin to Graph Builder.