Custom algorithm plugin - ns3098/Graph_Visualiser GitHub Wiki
You need Qt to build your plugin.
Instruction
- Download source code of this project
- Open
CustomAlgo
folder and openCustomAlgo.pro
with Qt. - Edit
customalgo.cpp
file 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
AbstractGraph
class toGraphModel
usingGraphModel gm = gr->getGraphModel();
. - Convert
GraphModel
toMatrixGS
,VectorListGS
orRibListGS
. - Use
AG_CHANGE_VER_PARAM(AG, ver, param, val)
andAG_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 orreturn false
to end algorithm.
See examples and Graph Library documentation to write your algorithm.
Build this project and load plugin to Graph Builder.