BoostGraphWrapper.h 87 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020
  1. #ifndef BOOSTGRAPHWRAPPER_H
  2. #define BOOSTGRAPHWRAPPER_H
  3. #include <GraphLayoutLibrary_global.h>
  4. #include <Common/GraphType.h>
  5. #include <Common/GeometryHelper.h>
  6. #include <boost/graph/connected_components.hpp>
  7. #include <boost/graph/biconnected_components.hpp>
  8. #include <boost/graph/smallest_last_ordering.hpp>
  9. #include <boost/graph/topological_sort.hpp>
  10. #include <QtCore/qmath.h>
  11. #include <boost/exception/get_error_info.hpp>
  12. #include <LayoutUtilities/CommonLayoutConstants.h>
  13. #include <LayoutException/LayoutExceptionConstants.h>
  14. #include <LayoutException/LayoutMemoryException.h>
  15. #include <QDebug>
  16. using namespace std;
  17. typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info;
  18. //To Do: Later move MACROS to separate header file
  19. #define DELETE_AND_SET_NULL(objectPointer)\
  20. if(objectPointer != NULL)\
  21. {\
  22. delete objectPointer;\
  23. objectPointer = NULL;\
  24. }
  25. #define PGL_VERTEX_INDEX(vertex,graph) \
  26. get(vertex_index,graph,vertex)
  27. #define PGL_PRINT_VERTEX_ORDER( graph , mapVertexOrder , GraphType) \
  28. cout << "Vertex Order: "; \
  29. BGL_FORALL_VERTICES(BGL_CAT(v,__LINE__) , graph , GraphType) \
  30. cout << mapVertexOrder[BGL_CAT(v,__LINE__)] << " "; \
  31. cout << endl;
  32. //For Vertex Ordering
  33. enum ShiftDirection { LeftDirection = 1000, RightDirection = 1001 };
  34. //Map vertex descriptor to order
  35. #define PGL_MAP_VERTEX_ORDER(mapVertexOrder,graph) \
  36. property_map<SubGraph , std::size_t VertexProperties::*>::type \
  37. mapVertexOrder(get(&VertexProperties::iOrder , graph));
  38. //Map vertex descriptor to its bundled property
  39. #define PGL_MAP_VERTEX_BUNDLED_PROPERTY(mapVertexProperty, PropertyType , PropertyName , graphObject) \
  40. property_map<SubGraph , PropertyType VertexProperties::*>::type \
  41. mapVertexProperty(get(&VertexProperties::PropertyName , graphObject));
  42. //Swap vertex order values
  43. #define PGL_SWAP_VERTEX_ORDER(v1 , v2 , mapVertexOrder) \
  44. mapVertexOrder[v1] = mapVertexOrder[v1] ^ mapVertexOrder[v2]; \
  45. mapVertexOrder[v2] = mapVertexOrder[v1] ^ mapVertexOrder[v2]; \
  46. mapVertexOrder[v1] = mapVertexOrder[v1] ^ mapVertexOrder[v2];
  47. //Map graph property
  48. #define PGL_MAP_GRAPH_REF_PROPERTY(mapGraphRefPropertyName , gGraph)\
  49. boost::ref_property_map<SubGraph*, GraphProperties>\
  50. mapGraphRefPropertyName(boost::get_property(gGraph,graph_custom_prop));
  51. //To Do: later compartment class
  52. /**
  53. * A structure to store comprtment layout.
  54. */
  55. struct LayoutCompartment{
  56. int x,y; /*!< coordinates of location */
  57. int height; /*!< Height */
  58. int width; /*!< Width */
  59. };
  60. /**
  61. * @brief The BoostGraphWrapper class
  62. *
  63. * The wrapper class around Boost graphs. Provides methods to access and manipulte properties of the graph.
  64. */
  65. class GRAPHLAYOUTLIBRARYSHARED_EXPORT BoostGraphWrapper
  66. {
  67. private:
  68. SubGraph m_Graph; /*!< Instance of Boost graph */
  69. public:
  70. /** @name Creators
  71. * The methods under this section are responsible for constructing
  72. * an instance of type BoostGraphWrapper.
  73. */
  74. //@{
  75. /**
  76. Constructs new object of type BoostGraphWrapper
  77. */
  78. BoostGraphWrapper();
  79. /**
  80. Constructs new object of type BoostGraphWrapper
  81. @param graph
  82. Object of boost graph type
  83. */
  84. BoostGraphWrapper(SubGraph graph);
  85. //@}
  86. /** @name Modifiers
  87. * The methods under this section are responsible for modifying
  88. * an instance of type BoostGraphWrapper.
  89. */
  90. //@{
  91. //Add Vertex
  92. //for m_Graph
  93. /**
  94. This function adds new vertex in the wrapper member graph.
  95. @pre
  96. -# gInputGraph != NULL
  97. @param none
  98. @return vertexdescriptor
  99. @throw none
  100. */
  101. VertexDescriptor addVertex();
  102. //for m_Graph
  103. /**
  104. This function adds provided vertex in the wrapper member graph.
  105. @pre none
  106. @param none
  107. @return vertexdescriptor
  108. @throw none
  109. */
  110. VertexDescriptor addVertex(VertexDescriptor& vertex);
  111. /**
  112. This function adds new vertex in the provided graph.
  113. @pre
  114. -# subgraph != NULL
  115. @param subgraph
  116. reference to input graph
  117. @return vertexdescriptor
  118. @throw none
  119. */
  120. VertexDescriptor addVertex(SubGraph& subgraph);
  121. /**
  122. This functions adds provided vertex in the provided graph.
  123. @pre
  124. -# subgraph != NULL
  125. @param subgraph
  126. reference to input graph
  127. @param vertex
  128. reference to vertex
  129. @return vertexdescriptor
  130. @throw none
  131. */
  132. VertexDescriptor addVertex(VertexDescriptor& vertex , SubGraph& subgraph);
  133. /**
  134. This function adds a vertex (node) of specified type
  135. @pre
  136. -# subgraph != NULL
  137. -# enVertexType should be valid
  138. @param subgraph
  139. reference to input graph.
  140. @param enVertexType
  141. type of vertex from available types.
  142. @return VertexDescriptor
  143. @throw none
  144. */
  145. VertexDescriptor addVertex(SubGraph &subgraph , LayoutEnum::NodeType enVertexType);
  146. //Add Edge
  147. //for m_Graph
  148. /**
  149. This function adds edge between provided source and target vertices in the wrapper member graph.
  150. @pre none
  151. @param vertex1
  152. reference of source vertex.
  153. @param vertex2
  154. reference of target vertex.
  155. @return edgedescriptor and bool pair
  156. @throw none
  157. */
  158. EdgeBoolPair addEdge(VertexDescriptor& vertex1,VertexDescriptor& vertex2);
  159. /**
  160. This function adds edge between provided source and target vertices in the provided graph.
  161. @pre none
  162. @param vertex1
  163. reference of source vertex.
  164. @param vertex2
  165. reference of target vertex.
  166. @param subgraph
  167. referecne to graph
  168. @return edgedescriptor and bool pair
  169. @throw none
  170. */
  171. EdgeBoolPair addEdge(VertexDescriptor& vertex1,VertexDescriptor& vertex2,
  172. SubGraph& subgraph);
  173. /**
  174. This function adds edge between provided source and target vertices in the wrapper member graph.
  175. @pre
  176. -# subgraph != NULL
  177. -# enEdgeType should be valid type
  178. @param vertex1
  179. reference of source vertex.
  180. @param vertex2
  181. reference of target vertex.
  182. @param subgraph
  183. referecne to graph
  184. @param enEdgeType
  185. type of edge from available types
  186. @return edgedescriptor and bool pair
  187. @throw none
  188. */
  189. EdgeBoolPair addEdge(VertexDescriptor& vertex1,VertexDescriptor& vertex2,
  190. SubGraph& subgraph, LayoutEnum::EdgeType enEdgeType);
  191. /**
  192. This function deletes provided edge from provided graph.
  193. @pre
  194. -# gGraph != NULL
  195. @param eEdge
  196. reference of edge
  197. @param subgraph
  198. referecne to graph
  199. @return none
  200. @throw none
  201. */
  202. void removeEdge(EdgeDescriptor& eEdge , SubGraph& gGraph);
  203. /**
  204. This function deletes provided edge from wrapper member graph.
  205. @pre
  206. -# gGraph != NULL
  207. @param eEdge
  208. reference to edge
  209. @return none
  210. @throw none
  211. */
  212. void removeEdge(EdgeDescriptor& eEdge);
  213. /**
  214. This function deletes edge between provided source and target vertices from provided graph.
  215. @pre
  216. -# gGraph != NULL
  217. @param vSource
  218. reference to vSource
  219. @param vTarget
  220. reference to vTarget
  221. @param gGraph
  222. reference to gGraph
  223. @return none
  224. @throw none
  225. */
  226. void removeEdge(VertexDescriptor& vSource , VertexDescriptor& vTarget , SubGraph& gGraph);
  227. /**
  228. This function deletes edge between provided source and target vertices from wrapeer member graph.
  229. @pre none
  230. @param vSource
  231. reference to vSource
  232. @param vTarget
  233. reference to vTarget
  234. @return none
  235. @throw none
  236. */
  237. void removeEdge(VertexDescriptor& vSource , VertexDescriptor& vTarget);
  238. //Subgraph
  239. /**
  240. This function creates empty subgraph under the hierarchy of wrapper member graph.
  241. @pre none
  242. @param none
  243. @return reference to subgraph
  244. @throw none
  245. */
  246. SubGraph& addSubgraph();
  247. /**
  248. This function creates empty subgraph under the hierarchy of provided graph.
  249. @pre
  250. -# subgraph != NULL
  251. @param subgraph
  252. reference to subgraph
  253. @return reference to subgraph
  254. @throw none
  255. */
  256. SubGraph& addSubgraph(SubGraph& subgraph);
  257. /**
  258. This function sets vertex id for provided vertex to vertex property of provided graph.
  259. @pre
  260. -# subgraph != NULL
  261. @pre
  262. -# sId should not be empty
  263. @param vertex
  264. reference to subgraph
  265. @param vertex
  266. reference to vertex
  267. @param sId
  268. id for the vertex
  269. @return none
  270. @throw none
  271. */
  272. void setVertexId(VertexDescriptor& vertex, SubGraph& subgraph, QString sId);
  273. /**
  274. This function sets vertex id for provided vertex to vertex property of wrapper member graph.
  275. @pre
  276. -# subgraph != NULL
  277. @pre
  278. -# sId should not be empty
  279. @param vertex
  280. reference to vertex
  281. @param sId
  282. id for the vertex
  283. @return none
  284. @throw none
  285. */
  286. void setVertexId(VertexDescriptor& vertex , QString sId);
  287. /**
  288. This function sets height for provided vertex to vertex property of provided graph.
  289. @pre
  290. -# subgraph != NULL
  291. @param vertex
  292. reference to vertex
  293. @param subgraph
  294. reference to subgraph
  295. @param iHeight
  296. height of vertex
  297. @return none
  298. @throw none
  299. */
  300. void setVertexHeight(VertexDescriptor& vertex, SubGraph& subgraph , int iHeight);
  301. /**
  302. This function sets height for provided vertex to vertex property of wrapper member graph.
  303. @pre
  304. -# subgraph != NULL
  305. @param vertex
  306. reference to vertex
  307. @param iHeight
  308. height of vertex
  309. @return none
  310. @throw none
  311. */
  312. void setVertexHeight(VertexDescriptor& vertex , int iHeight);
  313. /**
  314. This function sets width for provided vertex to vertex property of provided graph.
  315. @pre
  316. -# subgraph != NULL
  317. @param vertex
  318. reference to vertex
  319. @param subgraph
  320. reference to subgraph
  321. @param iWidth
  322. width of vertex
  323. @return none
  324. @throw none
  325. */
  326. void setVertexWidth(VertexDescriptor& vertex, SubGraph& subgraph , int iWidth);
  327. /**
  328. This function sets width for provided vertex to vertex property of wrapper member graph.
  329. @pre none
  330. @param vertex
  331. reference to vertex
  332. @param iWidth
  333. width of vertex
  334. @return none
  335. @throw none
  336. */
  337. void setVertexWidth(VertexDescriptor& vertex , int iWidth);
  338. /**
  339. This function writes left x coordinate for provided vertex to vertex property of wrapper member graph.
  340. @pre none
  341. @param vertex
  342. reference to vertex
  343. @param iLeftCoordX
  344. value of left coordinate X
  345. @return none
  346. @throw none
  347. */
  348. void setVertexLeftCoordX(VertexDescriptor& vertex , int iLeftCoordX);
  349. /**
  350. This function writes left x coordinate for provided vertex to vertex property of provided graph.
  351. @pre
  352. -# subgraph != NULL
  353. @param vertex
  354. reference to vertex
  355. @param subgraph
  356. reference to subgraph
  357. @param iLeftCoordX
  358. value of left coordinate X
  359. @return none
  360. @throw none
  361. */
  362. void setVertexLeftCoordX(VertexDescriptor& vertex, SubGraph& subgraph , int iLeftCoordX);
  363. /**
  364. This function writes left y coordinate for provided vertex to vertex property of wrapper member graph.
  365. @pre none
  366. @param vertex
  367. reference to vertex
  368. @param subgraph
  369. reference to subgraph
  370. @param iLeftCoordY
  371. value of left coordinate Y
  372. @return none
  373. @throw none
  374. */
  375. void setVertexLeftCoordY(VertexDescriptor& vertex, SubGraph& subgraph , int iLeftCoordY);
  376. /**
  377. This function writes left y coordinate for provided vertex to vertex property of wrapper member graph.
  378. @pre none
  379. @param vertex
  380. reference to vertex
  381. @param iLeftCoordY
  382. value of left coordinate Y
  383. @return none
  384. @throw none
  385. */
  386. void setVertexLeftCoordY(VertexDescriptor& vertex, int iLeftCoordY);
  387. /**
  388. This function writes center x coordinate for provided vertex to vertex property of wrapper member graph.
  389. @pre none
  390. @param vertex
  391. reference to vertex
  392. @param iCoordX
  393. value of center coordinate X
  394. @return none
  395. @throw none
  396. */
  397. void setVertexCenterCoordX(VertexDescriptor& vertex , int iCoordX);
  398. /**
  399. This function writes center x coordinate for provided vertex to vertex property of provided graph.
  400. @pre
  401. -# subgraph != NULL
  402. @param vertex
  403. reference to vertex
  404. @param subgraph
  405. reference to subgraph
  406. @param iCoordX
  407. value of center coordinate X
  408. @return none
  409. @throw none
  410. */
  411. void setVertexCenterCoordX(VertexDescriptor& vertex, SubGraph& subgraph , int iCoordX);
  412. /**
  413. This function writes center y coordinate for provided vertex to vertex property of provided graph.
  414. @pre
  415. -# subgraph != NULL
  416. @param vertex
  417. reference to vertex
  418. @param subgraph
  419. reference to subgraph
  420. @param iCoordY
  421. value of center coordinate Y
  422. @return none
  423. @throw none
  424. */
  425. void setVertexCenterCoordY(VertexDescriptor& vertex, SubGraph& subgraph , int iCoordY);
  426. /**
  427. This function writes center y coordinate for provided vertex to vertex property of wrapper member graph.
  428. @pre none
  429. @param vertex
  430. reference to vertex
  431. @param iCoordY
  432. value of center coordinate y
  433. @return none
  434. @throw none
  435. */
  436. void setVertexCenterCoordY(VertexDescriptor& vertex, int iCoordY);
  437. /**
  438. This function writes whether provided vertex is invisible or not to vertex property of provided graph.
  439. @pre
  440. -# subgraph != NULL
  441. @param vertex
  442. reference to vertex
  443. @param subgraph
  444. reference to subgraph
  445. @param bIsInvisible
  446. boolean whether the vertex is visible type or not
  447. @return none
  448. @throw none
  449. */
  450. void setVertexIsInvisible(VertexDescriptor& vertex, SubGraph& subgraph , bool bIsInvisible);
  451. /**
  452. This function writes whether provided vertex is invisible or not to vertex property of wrapper member graph.
  453. @pre none
  454. @param vertex
  455. reference to vertex
  456. @param bIsInvisible
  457. boolean whether the vertex is visible type or not
  458. @return none
  459. @throw none
  460. */
  461. void setVertexIsInvisible(VertexDescriptor& vertex , bool bIsInvisible);
  462. /**
  463. This function writes whether provided vertex is invisible or not to vertex property of provided graph.
  464. @pre
  465. -# subgraph != NULL
  466. @param vertex
  467. reference to vertex
  468. @param subgraph
  469. reference to subgraph
  470. @param bIsExpandable
  471. boolean whether the vertex is expandable type or not
  472. @return none
  473. @throw none
  474. */
  475. void setVertexExpandable(VertexDescriptor& vertex, SubGraph& subgraph , bool bIsExpandable);
  476. /**
  477. This function writes whether provided vertex is expandable or not to vertex property of wrapper member graph.
  478. @pre none
  479. @param vertex
  480. reference to vertex
  481. @param bIsExpandable
  482. boolean whether the vertex is epandable type or not
  483. @return none
  484. @throw none
  485. */
  486. void setVertexExpandable(VertexDescriptor& vertex , bool bIsExpandable);
  487. /**
  488. This function writes treewidth in the vertex property of provided graph.
  489. @pre
  490. -# subgraph != NULL
  491. @param vertex
  492. reference to vertex
  493. @param subgraph
  494. reference to subgraph
  495. @param iTreeWidth
  496. tree width in integer
  497. @return none
  498. @throw none
  499. */
  500. void setVertexTreeWidth(VertexDescriptor& vertex, SubGraph& subgraph , int iTreeWidth);
  501. /**
  502. This function writes treewidth in the vertex property of wrapper member graph.
  503. @pre none
  504. @param vertex
  505. reference to vertex
  506. @param iTreeWidth
  507. value of the treewidth
  508. @return none
  509. @throw none
  510. */
  511. void setVertexTreeWidth(VertexDescriptor& vertex,int iTreeWidth);
  512. /**
  513. This function writes distance from root in the vertex property of provided graph.
  514. @pre
  515. -# subgraph != NULL
  516. @param vertex
  517. reference to vertex
  518. @param subgraph
  519. reference to subgraph
  520. @param iDistanceFromRoot
  521. distance from root in integer
  522. @return none
  523. @throw none
  524. */
  525. void setVertexDistanceFromRoot(VertexDescriptor& vertex, SubGraph& subgraph , int iDistanceFromRoot);
  526. /**
  527. This function writes distance from root in the vertex property of wrapper member graph.
  528. @pre none
  529. @param vertex
  530. reference to vertex
  531. @param iDistanceFromRoot
  532. value of the distance from root.
  533. @return none
  534. @throw none
  535. */
  536. void setVertexDistanceFromRoot(VertexDescriptor& vertex , int iDistanceFromRoot);
  537. //int iRank;
  538. /**
  539. This function writes rank of vertex in the vertex property of provided graph.
  540. @pre
  541. -# subgraph != NULL
  542. @param vertex
  543. reference to vertex
  544. @param subgraph
  545. reference to subgraph
  546. @param iRank
  547. rank of vertex in integer
  548. @return none
  549. @throw none
  550. */
  551. void setVertexRank(VertexDescriptor& vertex, SubGraph& subgraph , int iRank);
  552. /**
  553. This function writes vertex rank in the vertex property of wrapper member graph.
  554. @pre none
  555. @param vertex
  556. reference to vertex
  557. @param iRank
  558. value of the vertex rank.
  559. @return none
  560. @throw none
  561. */
  562. void setVertexRank(VertexDescriptor& vertex , int iRank);
  563. //int iPosition;
  564. /**
  565. This function writes horizontal position of vertex in the vertex property of provided graph.
  566. @pre
  567. -# subgraph != NULL
  568. @param vertex
  569. reference to vertex
  570. @param subgraph
  571. reference to subgraph
  572. @param iHorizontalPosition
  573. horizontal position of vertex in integer
  574. @return none
  575. @throw none
  576. */
  577. void setVertexHorizontalPosition(VertexDescriptor& vertex, SubGraph& subgraph , int iHorizontalPosition);
  578. /**
  579. This function writes vertex horizontal position in the vertex property of wrapper member graph.
  580. @pre none
  581. @param vertex
  582. reference to vertex
  583. @param iHorizontalPosition
  584. value of the horizontal position.
  585. @return none
  586. @throw none
  587. */
  588. void setVertexHorizontalPosition(VertexDescriptor& vertex , int iHorizontalPosition);
  589. //Barrycenter Weight
  590. //double dBarryCenter;
  591. /**
  592. This function writes barry center of vertex in the vertex property of provided graph.
  593. @pre
  594. -# subgraph != NULL
  595. @param vertex
  596. reference to vertex
  597. @param subgraph
  598. reference to subgraph
  599. @param dBarryCenter
  600. barry center of vertex in integer
  601. @return none
  602. @throw none
  603. */
  604. void setVertexBarryCenter(VertexDescriptor& vertex, SubGraph& subgraph , double dBarryCenter);
  605. /**
  606. This function writes vertex barry center value in the vertex property of wrapper member graph.
  607. @pre none
  608. @param vertex
  609. reference to vertex
  610. @param dBarryCenter
  611. value of the barry center.
  612. @return none
  613. @throw none
  614. */
  615. void setVertexBarryCenter(VertexDescriptor& vertex , double dBarryCenter);
  616. void setVertexTreeLeftX(VertexDescriptor& vertex, SubGraph& subgraph , int iTreeLeftX);
  617. void setVertexTreeLeftX(VertexDescriptor& vertex , int iTreeLeftX);
  618. //Node type
  619. //NodeType enVertexType;
  620. /**
  621. This function writes type of vertex in the vertex property of provided graph.
  622. @pre
  623. -# subgraph != NULL
  624. @param vertex
  625. reference to vertex
  626. @param subgraph
  627. reference to subgraph
  628. @param enVertexType
  629. type of vertex
  630. @return none
  631. @throw none
  632. */
  633. void setVertexType(VertexDescriptor& vertex , SubGraph& subgraph , LayoutEnum::NodeType enVertexType);
  634. /**
  635. This function writes vertex type in the vertex property of wrapper member graph.
  636. @pre none
  637. @param vertex
  638. reference to vertex
  639. @param enVertexType
  640. type of vertex from available types
  641. @return none
  642. @throw none
  643. */
  644. void setVertexType(VertexDescriptor& vertex , LayoutEnum::NodeType enVertexType);
  645. void setVertexVisited(VertexDescriptor& vertex , SubGraph& subgraph , bool bVisited);
  646. void setVertexVisited(VertexDescriptor& vertex , bool bVisited);
  647. /**
  648. This function writes topological order of vertex in the vertex property of provided graph.
  649. @pre
  650. -# subgraph != NULL
  651. @param vertex
  652. reference to vertex
  653. @param subgraph
  654. reference to subgraph
  655. @param iTopologicalOrder
  656. topological order of vertex in integer
  657. @return none
  658. @throw none
  659. */
  660. void setVertexTopologicalOrder(int iTopologicalOrder , VertexDescriptor& vertex, SubGraph& subgraph);
  661. /**
  662. This function writes vertex topological order in the vertex property of wrapper member graph.
  663. @pre none
  664. @param vertex
  665. reference to vertex
  666. @param iTopologicalOrder
  667. topological order of vertex in integer
  668. @return none
  669. @throw none
  670. */
  671. void setVertexTopologicalOrder(int iTopologicalOrder , VertexDescriptor& vertex);
  672. /**
  673. This function writes id of edge in the edge property of provided graph.
  674. @pre
  675. -# subgraph != NULL
  676. @param edge
  677. reference to edge
  678. @param subgraph
  679. reference to subgraph
  680. @param sId
  681. id of edge
  682. @return none
  683. @throw none
  684. */
  685. void setEdgeId(EdgeDescriptor& edge, SubGraph& subgraph, QString sId);
  686. /**
  687. This function writes edge id in the edge property of wrapper member graph.
  688. @pre none
  689. @param edge
  690. reference to edge
  691. @param sId
  692. id of edge
  693. @return none
  694. @throw none
  695. */
  696. void setEdgeId(EdgeDescriptor& edge , QString sId);
  697. void setEdgeIndex(EdgeDescriptor& edge, SubGraph& subgraph, std::size_t iEdgeIndex);
  698. void setEdgeIndex(EdgeDescriptor& edge , std::size_t iEdgeIndex);
  699. /**
  700. This function writes type of edge direction in the edge property of provided graph.
  701. @pre
  702. -# subgraph != NULL
  703. @param edge
  704. reference to edge
  705. @param subgraph
  706. reference to subgraph
  707. @param bBidirectional
  708. type of edge direction
  709. @return none
  710. @throw none
  711. */
  712. void setEdgeBidirectional(EdgeDescriptor& edge, SubGraph& subgraph , bool bBidirectional);
  713. /**
  714. This function writes type of edge direction in the edge property of wrapper member graph.
  715. @pre none
  716. @param edge
  717. reference to edge
  718. @param bBidirectional
  719. type of edge direction
  720. @return none
  721. @throw none
  722. */
  723. void setEdgeBidirectional(EdgeDescriptor& edge , bool bBidirectional);
  724. /**
  725. This function writes type of edge invisible in the edge property of provided graph.
  726. @pre
  727. -# subgraph != NULL
  728. @param edge
  729. reference to edge
  730. @param subgraph
  731. reference to subgraph
  732. @param bIsInvisible
  733. type of edge invisible
  734. @return none
  735. @throw none
  736. */
  737. void setEdgeIsInvisible(EdgeDescriptor& edge, SubGraph& subgraph , bool bIsInvisible);
  738. /**
  739. This function writes type of edge invisible in the edge property of wrapper member graph.
  740. @pre none
  741. @param edge
  742. reference to edge
  743. @param bIsInvisible
  744. type of edge invisible
  745. @return none
  746. @throw none
  747. */
  748. void setEdgeIsInvisible(EdgeDescriptor& edge , bool bIsInvisible);
  749. void setEdgeVisited(EdgeDescriptor& edge , SubGraph& subgraph , bool bVisited);
  750. void setEdgeVisited(EdgeDescriptor& edge , bool bVisited);
  751. //Edge Type
  752. void setEdgeType(EdgeDescriptor eEdge, SubGraph &subgraph, LayoutEnum::EdgeType enEdgeType);
  753. void setEdgeType(EdgeDescriptor eEdge, LayoutEnum::EdgeType enEdgeType);
  754. /**
  755. This function writes type of edge reversed in the edge property of provided graph.
  756. @pre
  757. -# subgraph != NULL
  758. @param edge
  759. reference to edge
  760. @param subgraph
  761. reference to subgraph
  762. @param bReversed
  763. type of edge reversed
  764. @return none
  765. @throw none
  766. */
  767. void setEdgeReversed(EdgeDescriptor& edge , SubGraph& subgraph , bool bReversed);
  768. /**
  769. This function writes type of edge reversed in the edge property of wrapper member graph.
  770. @pre none
  771. @param edge
  772. reference to edge
  773. @param bReversed
  774. type of edge reversed
  775. @return none
  776. @throw none
  777. */
  778. void setEdgeReversed(EdgeDescriptor& edge , bool bReversed);
  779. /**
  780. This function writes if edge is conflicted/crossing with another edge in the edge property of provided graph.
  781. @pre
  782. -# subgraph != NULL
  783. @param edge
  784. reference to edge
  785. @param subgraph
  786. reference to subgraph
  787. @param bIsConflicted
  788. writes if edge is conflicted/crossing with another edge or not
  789. @return none
  790. @throw none
  791. */
  792. void setEdgeIsConflicted(EdgeDescriptor& edge, SubGraph& subgraph , bool bIsConflicted);
  793. /**
  794. This function writes if edge is conflicted/crossing with another edge in the edge property of wrapper member graph.
  795. @pre none
  796. @param edge
  797. reference to edge
  798. @param bIsConflicted
  799. if edge is conflicted/crossing with another edge or not
  800. @return none
  801. @throw none
  802. */
  803. void setEdgeIsConflicted(EdgeDescriptor& edge , bool bIsConflicted);
  804. //Bend points
  805. /**
  806. This function prepares list of bend points objects into edge properties of provided graph.
  807. *
  808. * @pre
  809. * -# gGraph != NULL
  810. *
  811. * @param bendPointRef
  812. * reference to bendpoints containing x and y coordinate
  813. *
  814. * @return none
  815. *
  816. * @throw none
  817. */
  818. void addBendPoint(BendPoints* bendPointRef , EdgeDescriptor eEdge , SubGraph& gGraph);
  819. /**
  820. This function sets id to provided graph
  821. *
  822. * @pre
  823. * -# gSubgraph != NULL
  824. * -# sId should not be empty.
  825. *
  826. * @param gSubgraph
  827. * reference to graph
  828. *
  829. * @param sId
  830. * id of a graph
  831. *
  832. * @return none
  833. *
  834. * @throw none
  835. */
  836. void setGraphId(QString sId , SubGraph& gSubgraph);
  837. /**
  838. This function sets id to wrapper member graph
  839. *
  840. * @pre
  841. * -# sId should not be empty.
  842. *
  843. * @param sId
  844. * id of a graph
  845. *
  846. * @return none
  847. *
  848. * @throw none
  849. */
  850. void setGraphId(QString sId);
  851. /**
  852. This function sets index of this provided graph.
  853. *
  854. * @pre
  855. * -# gSubgraph != NULL
  856. *
  857. * @param gSubgraph
  858. * reference to graph
  859. *
  860. * @return none
  861. *
  862. * @throw none
  863. */
  864. void setGraphDummyNodeIndex(std::size_t iDummyNodeIndex , SubGraph& gSubgraph);
  865. /**
  866. This function sets index of this wrapper member graph.
  867. *
  868. * @pre none
  869. *
  870. * @param iDummyNodeIndex
  871. * value of index to be set
  872. *
  873. * @return none
  874. *
  875. * @throw none
  876. */
  877. void setGraphDummyNodeIndex(std::size_t iDummyNodeIndex);
  878. /**
  879. This function sets left x coordinate to provided graph
  880. *
  881. * @pre
  882. * -# gSubgraph != NULL
  883. *
  884. * @param gSubgraph
  885. * reference to subgraph
  886. *
  887. * @param iLeftCoordX
  888. * value of left coordinate to be set
  889. *
  890. * @return none
  891. *
  892. * @throw none
  893. */
  894. void setGraphLeftTopCoordX(int iLeftTopCoordX , SubGraph& gSubgraph);
  895. /**
  896. This function sets left x coordinate to wrapper member graph
  897. *
  898. * @pre none
  899. *
  900. * @param iLeftCoordX
  901. * value of left coordinate to be set
  902. *
  903. * @return none
  904. *
  905. * @throw none
  906. */
  907. void setGraphLeftTopCoordX(int iLeftTopCoordX);
  908. /**
  909. This function sets top y coordinate to provided graph
  910. *
  911. * @pre
  912. * -# gSubgraph != NULL
  913. *
  914. * @param gSubgraph
  915. * reference to subgraph
  916. *
  917. * @param iLeftCoordX
  918. * value of left coordinate to be set
  919. *
  920. * @return none
  921. *
  922. * @throw none
  923. */
  924. void setGraphLeftTopCoordY(int iLeftTopCoordY , SubGraph& gSubgraph);
  925. /**
  926. This function sets top y coordinate to wrapper member graph
  927. *
  928. * @pre none
  929. *
  930. * @param iLeftCoordY
  931. * value of left y coordinate to be set
  932. *
  933. * @return none
  934. *
  935. * @throw none
  936. */
  937. void setGraphLeftTopCoordY(int iLeftTopCoordY);
  938. /**
  939. This function sets center x coordinate to provided graph
  940. *
  941. * @pre
  942. * -# gSubgraph != NULL
  943. *
  944. * @param gSubgraph
  945. * reference to subgraph
  946. *
  947. * @param iCenterCoordX
  948. * value of center x coordinate to be set
  949. *
  950. * @return none
  951. *
  952. * @throw none
  953. */
  954. void setGraphCenterCoordX(int iCenterCoordX , SubGraph& gSubgraph);
  955. /**
  956. This function sets center x coordinate to wrapper member graph
  957. *
  958. * @pre none
  959. *
  960. * @param iCenterCoordX
  961. * value of center x coordinate to be set
  962. *
  963. * @return none
  964. *
  965. * @throw none
  966. */
  967. void setGraphCenterCoordX(int iCenterCoordX);
  968. /**
  969. This function sets center y coordinate to provided graph
  970. *
  971. * @pre
  972. * -# gSubgraph != NULL
  973. *
  974. * @param gSubgraph
  975. * reference to subgraph
  976. *
  977. * @param iCenterCoordY
  978. * value of center y coordinate to be set
  979. *
  980. * @return none
  981. *
  982. * @throw none
  983. */
  984. void setGraphCenterCoordY(int iCenterCoordY , SubGraph& gSubgraph);
  985. /**
  986. This function sets center y coordinate to wrapper member graph
  987. *
  988. * @pre none
  989. *
  990. * @param iCenterCoordY
  991. * value of center y coordinate to be set
  992. *
  993. * @return none
  994. *
  995. * @throw none
  996. */
  997. void setGraphCenterCoordY(int iCenterCoordY);
  998. /**
  999. This function sets radius to provided graph
  1000. *
  1001. * @pre
  1002. * -# gSubgraph != NULL
  1003. *
  1004. * @param gSubgraph
  1005. * reference to subgraph
  1006. *
  1007. * @param dRadius
  1008. * value of radius to be set
  1009. *
  1010. * @return none
  1011. *
  1012. * @throw none
  1013. */
  1014. void setGraphRadius(double dRadius, SubGraph& gSubgraph);
  1015. /**
  1016. This function sets radius to wrapper member graph
  1017. *
  1018. * @pre none
  1019. *
  1020. * @param dRadius
  1021. * value of radius to be set
  1022. *
  1023. * @return none
  1024. *
  1025. * @throw none
  1026. */
  1027. void setGraphRadius(double dRadius);
  1028. /**
  1029. This function sets height to provided graph
  1030. *
  1031. * @pre
  1032. * -# gSubgraph != NULL
  1033. *
  1034. * @param gSubgraph
  1035. * reference to subgraph
  1036. *
  1037. * @param iHeight
  1038. * value of height to be set
  1039. *
  1040. * @return none
  1041. *
  1042. * @throw none
  1043. */
  1044. void setGraphHeight(int iHeight , SubGraph& gSubgraph);
  1045. /**
  1046. This function sets height to wrapper member graph
  1047. *
  1048. * @pre none
  1049. *
  1050. * @param iHeight
  1051. * value of height to be set
  1052. *
  1053. * @return none
  1054. *
  1055. * @throw none
  1056. */
  1057. void setGraphHeight(int iHeight);
  1058. /**
  1059. This function sets width to provided graph
  1060. *
  1061. * @pre
  1062. * -# gSubgraph != NULL
  1063. *
  1064. * @param gSubgraph
  1065. * reference to subgraph
  1066. *
  1067. * @param iWidth
  1068. * value of width to be set
  1069. *
  1070. * @return none
  1071. *
  1072. * @throw none
  1073. */
  1074. void setGraphWidth(int iWidth , SubGraph& gSubgraph);
  1075. /**
  1076. This function sets width to wrapper member graph
  1077. *
  1078. * @pre none
  1079. *
  1080. * @param iWidth
  1081. * value of width to be set
  1082. *
  1083. * @return none
  1084. *
  1085. * @throw none
  1086. */
  1087. void setGraphWidth(int iWidth);
  1088. void setGraphCoordX(int iCoordX , SubGraph& gSubgraph);
  1089. void setGraphCoordX(int iCoordX);
  1090. void setGraphCoordY(int iCoordY , SubGraph& gSubgraph);
  1091. void setGraphCoordY(int iCoordY);
  1092. /**
  1093. This function sets distance between centroid of graph and center x coordinate of provided graph
  1094. *
  1095. * @pre
  1096. * -# gSubgraph != NULL
  1097. *
  1098. * @param gSubgraph
  1099. * reference to subgraph
  1100. *
  1101. * @param iDistanceCoordX
  1102. * distance between centroid of graph and center x coordinate
  1103. *
  1104. * @return none
  1105. *
  1106. * @throw none
  1107. */
  1108. void setGraphDistanceBetweenCentoidAndCenterCoordX(int iDistanceCoordX , SubGraph& gSubgraph);
  1109. /**
  1110. This function sets distance between centroid of graph and center x coordinate of wrapper member graph
  1111. *
  1112. * @pre none
  1113. *
  1114. * @param iDistanceCoordX
  1115. * distance between centroid of graph and center x coordinate
  1116. *
  1117. * @return none
  1118. *
  1119. * @throw none
  1120. */
  1121. void setGraphDistanceBetweenCentoidAndCenterCoordX(int iDistanceCoordX);
  1122. /**
  1123. This function sets distance between y coordinate centroid of graph and center y coordinate of provided graph
  1124. *
  1125. * @pre
  1126. * -# gSubgraph != NULL
  1127. *
  1128. * @param gSubgraph
  1129. * reference to subgraph
  1130. *
  1131. * @param iDistanceCoordY
  1132. * distance between centroid of graph and center y coordinate
  1133. *
  1134. * @return none
  1135. *
  1136. * @throw none
  1137. */
  1138. void setGraphDistanceBetweenCentoidAndCenterCoordY(int iDistanceCoordY , SubGraph& gSubgraph);
  1139. /**
  1140. This function sets distance between y coordinate centroid of graph and center y coordinate of wrapper member graph
  1141. *
  1142. * @pre none
  1143. *
  1144. * @param iDistanceCoordY
  1145. * distance between centroid of graph and center y coordinate
  1146. *
  1147. * @return none
  1148. *
  1149. * @throw none
  1150. */
  1151. void setGraphDistanceBetweenCentoidAndCenterCoordY(int iDistanceCoordY);
  1152. //Own Vertices
  1153. //QVectorUInt vectOwnVertices;
  1154. /**
  1155. This function sets provided vertex as a own vertex property for the provided graph.
  1156. *
  1157. * @pre none
  1158. *
  1159. * @param vVertex
  1160. * value of the vertex
  1161. *
  1162. * @return none
  1163. *
  1164. * @throw none
  1165. */
  1166. void setAsOwnVertex(VertexDescriptor vVertex , SubGraph &gGraph);
  1167. /**
  1168. This function sets the upper border value of provided graph property.
  1169. *
  1170. * @pre
  1171. *-# gGraph !- NULL
  1172. *
  1173. * @param gGraph
  1174. * reference to graph
  1175. *
  1176. *@param vUpperBorderVertex
  1177. * value of upper border vertex
  1178. *
  1179. * @return none
  1180. *
  1181. * @throw none
  1182. */
  1183. void setGraphUpperBorderVertex(std::size_t vUpperBorderVertex , SubGraph& gGraph);
  1184. /**
  1185. This function sets the upper border value of wrapper member graph property.
  1186. *
  1187. * @pre none
  1188. *
  1189. *@param vUpperBorderVertex
  1190. * value of upper border vertex
  1191. *
  1192. * @return none
  1193. *
  1194. * @throw none
  1195. */
  1196. void setGraphUpperBorderVertex(std::size_t vUpperBorderVertex);
  1197. /**
  1198. This function sets the lower border value of provided graph property.
  1199. *
  1200. * @pre
  1201. *-# gGraph !- NULL
  1202. *
  1203. * @param gGraph
  1204. * reference to graph
  1205. *
  1206. *@param vLowerBorderVertex
  1207. * value of lower border vertex
  1208. *
  1209. * @return none
  1210. *
  1211. * @throw none
  1212. */
  1213. void setGraphLowerBorderVertex(std::size_t vLowerBorderVertex , SubGraph& gGraph);
  1214. /**
  1215. This function sets the lower border value of wrapper member graph property.
  1216. *
  1217. * @pre none
  1218. *
  1219. *@param vLowerBorderVertex
  1220. * value of lower border vertex
  1221. *
  1222. * @return none
  1223. *
  1224. * @throw none
  1225. */
  1226. void setGraphLowerBorderVertex(std::size_t vLowerBorderVertex);
  1227. //Swap vertex order in 'graph' as well as 'mapOrderVertex'
  1228. /**
  1229. This function swaps vertex's provided orders in 'graph' as well as 'mapOrderVertex'
  1230. *
  1231. * @pre
  1232. *-# subgraph != NULL
  1233. *
  1234. * @param order1
  1235. * value of first order
  1236. *
  1237. * @param order2
  1238. * value of second order
  1239. *
  1240. * @param mapOrderVertex
  1241. * reference to order vertex map
  1242. *
  1243. * @param mapVertexOrder
  1244. * reference to vertex order map
  1245. *
  1246. * @return none
  1247. *
  1248. * @throw none
  1249. */
  1250. template <typename MapVertexOrder>
  1251. void swapVertexOrderByOrder(std::size_t order1, std::size_t order2,
  1252. MapOrderVertex& mapOrderVertex,
  1253. MapVertexOrder& mapVertexOrder)
  1254. {
  1255. //check
  1256. //mapOrderVertex is a valid MapOrderVertex type map
  1257. //order1 and order2 are valid keys with valid values
  1258. LAYOUT_ASSERT(((order1 > 0) && (order2 > 0)),
  1259. LayoutException(__FUNCTION__,
  1260. LayoutExceptionEnum::INVALID_PARAMETER,
  1261. NEGATIVE_ORDER,ORDER_VALUE));
  1262. /* Swapping 'order' value in mapOrderVertex by
  1263. exchanging the vertex desciptors among the order1 and order2 */
  1264. VertexDescriptor vertex1 = mapOrderVertex[order1];
  1265. mapOrderVertex.insert(order1, mapOrderVertex[order2]);
  1266. mapOrderVertex.insert(order2, vertex1);
  1267. //Swapping actual 'order' property values
  1268. PGL_SWAP_VERTEX_ORDER(mapOrderVertex[order1],mapOrderVertex[order2],mapVertexOrder);
  1269. }
  1270. /**
  1271. This function swaps vertex's orders provided vertices in 'graph' as well as 'mapOrderVertex'
  1272. *
  1273. * @pre
  1274. *-# subgraph != NULL
  1275. *
  1276. * @param v1
  1277. * reference to first vertex
  1278. *
  1279. * @param v2
  1280. reference to second vertex
  1281. *
  1282. * @param mapOrderVertex
  1283. * reference to order vertex map
  1284. *
  1285. * @param mapVertexOrder
  1286. * reference to vertex order map
  1287. *
  1288. * @return none
  1289. *
  1290. * @throw none
  1291. */
  1292. template <typename MapVertexOrder>
  1293. void swapVertexOrderByVertex(VertexDescriptor& v1 , VertexDescriptor& v2,
  1294. MapOrderVertex& mapOrderVertex,
  1295. MapVertexOrder& mapVertexOrder)
  1296. {
  1297. //check
  1298. //mapOrderVertex is a valid MapOrderVertex type map
  1299. //v1 and v2 are valid values in mapOrderVertex
  1300. std::size_t order1 = mapOrderVertex.key(v1);
  1301. std::size_t order2 = mapOrderVertex.key(v2);
  1302. swapVertexOrderByOrder(order1,order2,mapOrderVertex,mapVertexOrder);
  1303. }
  1304. //***Left Shift****
  1305. //LeftShift
  1306. /**
  1307. This function shifts the order of vertex provided order of vartex.
  1308. *
  1309. * @pre none
  1310. *
  1311. * @param iOrderSource
  1312. * value of order to be shifted
  1313. *
  1314. * @param mapOrderVertex
  1315. * reference to order vertex map
  1316. *
  1317. * @param enDirection
  1318. * direction of shifting
  1319. *
  1320. * @return none
  1321. *
  1322. * @throw none
  1323. */
  1324. template <typename MapVertexOrder>
  1325. void leftShiftVertexByOrder(std::size_t iOrderSource,MapOrderVertex& mapOrderVertex,
  1326. MapVertexOrder& mapVertexOrder)
  1327. {
  1328. //ToDo : check iOrderSource is valid for mapVertexOrder
  1329. //Check iOrder1 is valid key in mapOrderVertex
  1330. LAYOUT_ASSERT(mapOrderVertex.contains(iOrderSource),LayoutException(__FUNCTION__
  1331. , LayoutExceptionEnum::NOT_FOUND_IN_CONTAINER
  1332. , "mapOrderVertex"
  1333. , "iOrderSource"));
  1334. shiftVertexByOrder(iOrderSource,mapOrderVertex,mapVertexOrder,
  1335. 1,LeftDirection);
  1336. }
  1337. /**
  1338. This function shifts the order of vertex provided vartex.
  1339. *
  1340. * @pre none
  1341. *
  1342. * @param vSource
  1343. * value of vertex
  1344. *
  1345. * @param mapOrderVertex
  1346. * reference to order vertex map
  1347. *
  1348. * @param enDirection
  1349. * direction of shifting
  1350. *
  1351. * @return none
  1352. *
  1353. * @throw none
  1354. */
  1355. template <typename MapVertexOrder>
  1356. void leftShiftVertexByVertex(VertexDescriptor& vSource,MapOrderVertex& mapOrderVertex,
  1357. MapVertexOrder& mapVertexOrder)
  1358. {
  1359. //ToDo : check vOrderSource is valid value from mapVertexOrder
  1360. //Get key for vSource
  1361. std::size_t iOrderSource = mapOrderVertex.key(vSource);
  1362. shiftVertexByOrder(iOrderSource,mapOrderVertex,mapVertexOrder,
  1363. 1,LeftDirection);
  1364. }
  1365. /**
  1366. * Function to shift vertex order value to left by using order values
  1367. *
  1368. * @param iOrderSource
  1369. * @param mapOrderVertex
  1370. * @param mapVertexOrder
  1371. * @param iShiftBy
  1372. *
  1373. * @return none
  1374. *
  1375. * @throw none
  1376. */
  1377. //LeftShift by N
  1378. template <typename MapVertexOrder>
  1379. void leftShiftVertexByOrder(std::size_t iOrderSource,
  1380. MapOrderVertex& mapOrderVertex,
  1381. MapVertexOrder& mapVertexOrder,
  1382. int iShiftBy)
  1383. {
  1384. //ToDo : check iOrderSource is valid for mapVertexOrder
  1385. LAYOUT_ASSERT(iShiftBy>0,LayoutException(__FUNCTION__
  1386. , LayoutExceptionEnum::INVALID_PARAMETER
  1387. , "must be greater than zero"
  1388. , "iShiftBy"));
  1389. //Check iOrder1 is valid key in mapOrderVertex
  1390. LAYOUT_ASSERT(mapOrderVertex.contains(iOrderSource),LayoutException(__FUNCTION__
  1391. , LayoutExceptionEnum::NOT_FOUND_IN_CONTAINER
  1392. , "mapOrderVertex"
  1393. , "iOrderSource"));
  1394. shiftVertexByOrder(iOrderSource,mapOrderVertex,mapVertexOrder,
  1395. iShiftBy,LeftDirection);
  1396. }
  1397. /**
  1398. * Function to shift vertex order value to left by using vertices
  1399. *
  1400. * @param vSource
  1401. * @param mapOrderVertex
  1402. * @param mapVertexOrder
  1403. * @param iShiftBy
  1404. *
  1405. * @return none
  1406. *
  1407. * @throw none
  1408. */
  1409. template <typename MapVertexOrder>
  1410. void leftShiftVertexByVertex(VertexDescriptor& vSource,
  1411. MapOrderVertex& mapOrderVertex,
  1412. MapVertexOrder& mapVertexOrder,
  1413. int iShiftBy)
  1414. {
  1415. //ToDo : check vOrderSource is valid value from mapVertexOrder
  1416. LAYOUT_ASSERT(iShiftBy>0,LayoutException(__FUNCTION__
  1417. , LayoutExceptionEnum::INVALID_PARAMETER
  1418. , "must be greater than zero"
  1419. , "iShiftBy"));
  1420. //Get key for vSource
  1421. std::size_t iOrderSource = mapOrderVertex.key(vSource);
  1422. shiftVertexByOrder(iOrderSource,mapOrderVertex,mapVertexOrder,
  1423. iShiftBy,LeftDirection);
  1424. }
  1425. //***Rigth Shift****
  1426. //RightShiftS
  1427. /**
  1428. * Function to shift vertex order value to right by using order
  1429. *
  1430. * @param iOrderSource
  1431. * @param mapOrderVertex
  1432. * @param mapVertexOrder
  1433. *
  1434. * @return none
  1435. *
  1436. * @throw none
  1437. */
  1438. template <typename MapVertexOrder>
  1439. void rightShiftVertexByOrder(std::size_t iOrderSource,MapOrderVertex& mapOrderVertex,
  1440. MapVertexOrder& mapVertexOrder)
  1441. {
  1442. //check : iOrderSource is valid for both maps: mapOrderVertex and mapVertexOrder
  1443. //Check iOrder1 is valid key in mapOrderVertex
  1444. LAYOUT_ASSERT(mapOrderVertex.contains(iOrderSource),LayoutException(__FUNCTION__
  1445. , LayoutExceptionEnum::NOT_FOUND_IN_CONTAINER
  1446. , "mapOrderVertex"
  1447. , "iOrderSource"));
  1448. shiftVertexByOrder(iOrderSource,mapOrderVertex,mapVertexOrder,
  1449. 1,RightDirection);
  1450. }
  1451. /**
  1452. * Function to shift vertex order value to right by using vertex
  1453. * @param vSource
  1454. * @param mapOrderVertex
  1455. * @param mapVertexOrder
  1456. *
  1457. * @return none
  1458. *
  1459. * @throw none
  1460. */
  1461. template <typename MapVertexOrder>
  1462. void rightShiftVertexByVertex(VertexDescriptor& vSource,
  1463. MapOrderVertex& mapOrderVertex,
  1464. MapVertexOrder& mapVertexOrder)
  1465. {
  1466. //ToDo : check vOrderSource is valid value from mapVertexOrder
  1467. //Get key for vSource
  1468. std::size_t iOrderSource = mapOrderVertex.key(vSource);
  1469. shiftVertexByOrder(iOrderSource,mapOrderVertex,mapVertexOrder,
  1470. 1,RightDirection);
  1471. }
  1472. //RightShift by N
  1473. /**
  1474. * Function to shift vertex order value to right by using order values
  1475. *
  1476. * @param iOrderSource
  1477. * @param mapOrderVertex
  1478. * @param mapVertexOrder
  1479. * @param iShiftBy
  1480. */
  1481. template <typename MapVertexOrder>
  1482. void rightShiftVertexByOrder(std::size_t iOrderSource,MapOrderVertex& mapOrderVertex,
  1483. MapVertexOrder& mapVertexOrder, int iShiftBy)
  1484. {
  1485. //check : iOrderSource is valid for both maps: mapOrderVertex and mapVertexOrder
  1486. //Check iOrder1 is valid key in mapOrderVertex
  1487. LAYOUT_ASSERT(mapOrderVertex.contains(iOrderSource),LayoutException(__FUNCTION__
  1488. , LayoutExceptionEnum::NOT_FOUND_IN_CONTAINER
  1489. , "mapOrderVertex"
  1490. , "iOrderSource"));
  1491. shiftVertexByOrder(iOrderSource,mapOrderVertex,mapVertexOrder,
  1492. iShiftBy,RightDirection);
  1493. }
  1494. /**
  1495. * Function to shift vertex order value to right by using vertex
  1496. *
  1497. * @param vSource
  1498. * @param mapOrderVertex
  1499. * @param mapVertexOrder
  1500. * @param iShiftBy
  1501. */
  1502. template <typename MapVertexOrder>
  1503. void rightShiftVertexByVertex(VertexDescriptor& vSource,
  1504. MapOrderVertex& mapOrderVertex,
  1505. MapVertexOrder& mapVertexOrder,
  1506. int iShiftBy)
  1507. {
  1508. //ToDo : check vOrderSource is valid value from mapVertexOrder
  1509. LAYOUT_ASSERT(iShiftBy>0,LayoutException(__FUNCTION__
  1510. , LayoutExceptionEnum::INVALID_PARAMETER
  1511. , "must be greater than zero"
  1512. , "iShiftBy"));
  1513. //Get key for vSource
  1514. std::size_t iOrderSource = mapOrderVertex.key(vSource);
  1515. shiftVertexByOrder(iOrderSource,mapOrderVertex,mapVertexOrder,
  1516. iShiftBy,RightDirection);
  1517. }
  1518. //************************* Ordering Criteria Components***************
  1519. /**
  1520. This function orders the vertices of the graph ion the basis of connected components.
  1521. @pre
  1522. -# gGraph != NULL
  1523. -# !mapOrderVertex.empty()
  1524. @param gGraph
  1525. reference to input graph.
  1526. @param mapOrderVertex
  1527. map containing order for vertices.
  1528. @return none
  1529. @throw none
  1530. */
  1531. void applyConnectedComponent(SubGraph &gGraph,MapOrderVertex& mapOrderVertex);
  1532. /**
  1533. This function orders the vertices of the graph in topological manner.
  1534. @pre
  1535. -# gGraph != NULL
  1536. -# !mapOrderVertex.empty()
  1537. @param gGraph
  1538. reference to input graph.
  1539. @param mapOrderVertex
  1540. map containing order for vertices.
  1541. @return none
  1542. @throw none
  1543. */
  1544. void applyTopologicalVertexOrdering(SubGraph &gGraph,MapOrderVertex& mapOrderVertex);
  1545. //************************* Ordering Criteria Components END***********
  1546. //*************************Ordering ***************
  1547. /**
  1548. This function sorts the vertices of the graph in orderly manner.
  1549. @pre
  1550. -# gGraph != NULL
  1551. -# !vecVertexOrder.empty()
  1552. @param gGraph
  1553. reference to input graph.
  1554. @param vecVertexOrder
  1555. map containing vertices for order.
  1556. @return none
  1557. @throw none
  1558. */
  1559. void sortVerticesByOrderList(VectorVertexOrder vecVertexOrder, SubGraph& gGraph);
  1560. //*************************Ordering END***********
  1561. //initialize vertex order values equals to the vertex_index
  1562. /**
  1563. This function initializes the all vertex order values to its index from provided graph.
  1564. @pre
  1565. -# gSubgraph != NULL
  1566. @param gSubgraph
  1567. reference to graph.
  1568. @return none
  1569. @throw none
  1570. */
  1571. void initGraphVertexOrderValues(SubGraph& subgraph);
  1572. /**
  1573. This function adds dummy nodes coresponding to each subgraph in the graph
  1574. @pre
  1575. -# gParentGraph != NULL
  1576. -# gChildGraph != NULL
  1577. @param gParentGraph
  1578. referecne to parent graph
  1579. @param gChildGraph
  1580. reference to child graph
  1581. @return vertex descriptor for dummy NodeType
  1582. @throw none
  1583. */
  1584. VertexDescriptor addDummyVertexForChildGraph(SubGraph& gParentGraph, SubGraph& gChildGraph);
  1585. // Force Directed Props Getter and Setter
  1586. // TO DO - Complete documentation
  1587. void setVertXDisp(double iDispX,VertexDescriptor verDis,SubGraph &l_graph);
  1588. void setVertYDisp(double iDispY,VertexDescriptor verDis,SubGraph &l_graph);
  1589. void setVertexLock(VertexDescriptor verDis, SubGraph &l_graph);
  1590. void setGraphClusterID(int iClusterID, SubGraph& gSubgraph);
  1591. void setVertexClusterID(int iClusterID, VertexDescriptor vDisc, SubGraph& gSubgraph );
  1592. bool setIsVirtualNode(VertexDescriptor vertex, SubGraph& subgraph);
  1593. void setClusterXDisplacement(SubGraph& gSubgraph,int iDisp);
  1594. void setClusterYDisplacement(SubGraph& gSubgraph,int iDisp);
  1595. //@}
  1596. /** @name Queries
  1597. * The methods under this section are responsible for accessing
  1598. * an instance of type BoostGraphWrapper.
  1599. */
  1600. //@{
  1601. //Print Graph with SubGraph
  1602. //for m_Graph
  1603. /**
  1604. This function prints wrapper member graph.
  1605. @pre none
  1606. @param none
  1607. @return none
  1608. @throw none
  1609. */
  1610. void printGraph();
  1611. //for any graph
  1612. /**
  1613. This function prints provided graph.
  1614. @pre none
  1615. @param subgraph
  1616. reference to subgraph
  1617. @return none
  1618. @throw none
  1619. */
  1620. void printGraph(SubGraph& subgraph);
  1621. //Total Vertex Count
  1622. //for m_Graph
  1623. /**
  1624. This function returns total number of vertices present in wrapper member graph.
  1625. @pre none
  1626. @param none
  1627. @return number of vertices
  1628. @throw none
  1629. */
  1630. int numVertices();
  1631. /**
  1632. This function returns total number of vertices present in provided graph.
  1633. @pre none
  1634. @param gSubgraph
  1635. reference to gSubgraph
  1636. @return number of vertices
  1637. @throw none
  1638. */
  1639. int numVertices(SubGraph &gSubgraph);
  1640. /**
  1641. This function returns index for provided vertex present in wrapper member graph.
  1642. @pre none
  1643. @param vertex
  1644. reference to vertex
  1645. @return number of vertices
  1646. @throw none
  1647. */
  1648. int getVertexIndex(VertexDescriptor& vertex);
  1649. /**
  1650. This function returns graph from wrapper member graph.
  1651. @pre
  1652. -# subgraph != NULL
  1653. @param none
  1654. @return reference to subgraph
  1655. @throw none
  1656. */
  1657. SubGraph& getGraph();
  1658. //vertex order
  1659. //QString sId;
  1660. /**
  1661. This function returns vertex id of provided vertex from vertex property of provided graph.
  1662. @pre
  1663. -# subgraph != NULL
  1664. @param vertex
  1665. reference to vertex
  1666. @param subgraph
  1667. reference to subgraph
  1668. @return id of provided vertex
  1669. @throw none
  1670. */
  1671. QString getVertexId(VertexDescriptor& vertex, SubGraph& subgraph);
  1672. /**
  1673. This function returns vertex id of provided vertex from vertex property of wrapper member graph.
  1674. @pre none
  1675. @param vertex
  1676. reference to vertex
  1677. @return id of provided vertex
  1678. @throw none
  1679. */
  1680. QString getVertexId(VertexDescriptor& vertex);
  1681. /**
  1682. This function returns height for provided vertex from vertex property of provided graph.
  1683. @pre
  1684. -# subgraph != NULL
  1685. @param vertex
  1686. reference to vertex
  1687. @param subgraph
  1688. reference to subgraph
  1689. @return height of vertex
  1690. @throw none
  1691. */
  1692. int getVertexHeight(VertexDescriptor& vertex, SubGraph& subgraph);
  1693. /**
  1694. This function returns height for provided vertex from vertex property of wrapper member graph.
  1695. @pre
  1696. -# subgraph != NULL
  1697. @param vertex
  1698. reference to vertex
  1699. @return height of vertex
  1700. @throw none
  1701. */
  1702. int getVertexHeight(VertexDescriptor& vertex);
  1703. //int iWidth;
  1704. /**
  1705. This function returns width for provided vertex from vertex property of provided graph.
  1706. @pre
  1707. -# subgraph != NULL
  1708. @param vertex
  1709. reference to vertex
  1710. @param subgraph
  1711. reference to subgraph
  1712. @return width of vertex
  1713. @throw none
  1714. */
  1715. int getVertexWidth(VertexDescriptor& vertex, SubGraph& subgraph);
  1716. /**
  1717. This function returns width for provided vertex from vertex property of wrapper member graph.
  1718. @pre
  1719. -# subgraph != NULL
  1720. @param vertex
  1721. reference to vertex
  1722. @return width of vertex
  1723. @throw none
  1724. */
  1725. int getVertexWidth(VertexDescriptor& vertex);
  1726. /**
  1727. This function returns left x coordinate for provided vertex from vertex property of provided graph.
  1728. @pre
  1729. -# subgraph != NULL
  1730. @param vertex
  1731. reference to vertex
  1732. @param subgraph
  1733. reference to subgraph
  1734. @return left coordinate X of vertex
  1735. @throw none
  1736. */
  1737. int getVertexLeftCoordX(VertexDescriptor& vertex, SubGraph& subgraph);
  1738. /**
  1739. This function returns left x coordinate for provided vertex from vertex property of wrapper member graph.
  1740. @pre none
  1741. @param vertex
  1742. reference to vertex
  1743. @return left coordinate X of vertex
  1744. @throw none
  1745. */
  1746. int getVertexLeftCoordX(VertexDescriptor& vertex);
  1747. //int iCoord_Y;
  1748. /**
  1749. This function returns left y coordinate for provided vertex from vertex property of provided graph.
  1750. @pre
  1751. -# subgraph != NULL
  1752. @param vertex
  1753. reference to vertex
  1754. @param subgraph
  1755. reference to subgraph
  1756. @return left coordinate Y of vertex
  1757. @throw none
  1758. */
  1759. int getVertexLeftCoordY(VertexDescriptor& vertex, SubGraph& subgraph);
  1760. /**
  1761. This function returns left y coordinate for provided vertex from vertex property of wrapper member graph.
  1762. @pre none
  1763. @param vertex
  1764. reference to vertex
  1765. @return left coordinate of vertex
  1766. @throw none
  1767. */
  1768. int getVertexLeftCoordY(VertexDescriptor& vertex);
  1769. /**
  1770. This function returns center x coordinate for provided vertex from vertex property of provided graph.
  1771. @pre
  1772. -# subgraph != NULL
  1773. @param vertex
  1774. reference to vertex
  1775. @param subgraph
  1776. reference to subgraph
  1777. @return center coordinate x of vertex
  1778. @throw none
  1779. */
  1780. int getVertexCenterCoordX(VertexDescriptor& vertex, SubGraph& subgraph);
  1781. /**
  1782. This function returns center x coordinate for provided vertex from vertex property of wrapper member graph.
  1783. @pre none
  1784. @param vertex
  1785. reference to vertex
  1786. @return center x coordinate of vertex
  1787. @throw none
  1788. */
  1789. int getVertexCenterCoordX(VertexDescriptor& vertex);
  1790. /**
  1791. This function returns center y coordinate for provided vertex from vertex property of provided graph.
  1792. @pre
  1793. -# subgraph != NULL
  1794. @param vertex
  1795. reference to vertex
  1796. @param subgraph
  1797. reference to subgraph
  1798. @return center coordinate y of vertex
  1799. @throw none
  1800. */
  1801. int getVertexCenterCoordY(VertexDescriptor& vertex, SubGraph& subgraph);
  1802. /**
  1803. This function returns center y coordinate for provided vertex from vertex property of wrapper member graph.
  1804. @pre none
  1805. @param vertex
  1806. reference to vertex
  1807. @return center y coordinate of vertex
  1808. @throw none
  1809. */
  1810. int getVertexCenterCoordY(VertexDescriptor& vertex);
  1811. /**
  1812. This function returns whether provided vertex is invisible or not from vertex property of provided graph.
  1813. @pre
  1814. -# subgraph != NULL
  1815. @param vertex
  1816. reference to vertex
  1817. @param subgraph
  1818. reference to subgraph
  1819. @return true or false whether the vertex is visible or not
  1820. @throw none
  1821. */
  1822. bool getVertexIsInvisible(VertexDescriptor& vertex, SubGraph& subgraph);
  1823. /**
  1824. This function returns whether provided vertex is invisible or not from vertex property of wrapper member graph.
  1825. @pre none
  1826. @param vertex
  1827. reference to vertex
  1828. @return true or false whether the vertex is visible or not
  1829. @throw none
  1830. */
  1831. bool getVertexIsInvisible(VertexDescriptor& vertex);
  1832. /**
  1833. This function returns whether provided vertex is expandable or not from vertex property of provided graph.
  1834. @pre
  1835. -# subgraph != NULL
  1836. @param vertex
  1837. reference to vertex
  1838. @param subgraph
  1839. reference to subgraph
  1840. @return true or false whether the vertex is expandable or not
  1841. @throw none
  1842. */
  1843. bool getVertexExpandable(VertexDescriptor& vertex, SubGraph& subgraph);
  1844. /**
  1845. This function returns whether provided vertex is expandable or not from vertex property of wrapper member graph.
  1846. @pre none
  1847. @param vertex
  1848. reference to vertex
  1849. @return true or false whether the vertex is visible or not
  1850. @throw none
  1851. */
  1852. bool getVertexExpandable(VertexDescriptor& vertex);
  1853. /**
  1854. This function returns treewidth of vertex.
  1855. @pre
  1856. -# subgraph != NULL
  1857. @param vertex
  1858. reference to vertex
  1859. @param subgraph
  1860. reference to subgraph
  1861. @return treewidth in integer
  1862. @throw none
  1863. */
  1864. int getVertexTreeWidth(VertexDescriptor& vertex, SubGraph& subgraph);
  1865. /**
  1866. This function returns treewidth of vertex of wrapper member graph.
  1867. @pre none
  1868. @param vertex
  1869. reference to vertex
  1870. @return treewidth in interger
  1871. @throw none
  1872. */
  1873. int getVertexTreeWidth(VertexDescriptor& vertex);
  1874. /**
  1875. This function returns distance of vertex from root saved in the vertexproperty of provided graph.
  1876. @pre
  1877. -# subgraph != NULL
  1878. @param vertex
  1879. reference to vertex
  1880. @param subgraph
  1881. reference to subgraph
  1882. @return distance from root in integer
  1883. @throw none
  1884. */
  1885. int getVertexDistanceFromRoot(VertexDescriptor& vertex, SubGraph& subgraph);
  1886. /**
  1887. This function returns distance from root of vertex of wrapper member graph.
  1888. @pre none
  1889. @param vertex
  1890. reference to vertex
  1891. @return distance from root in interger
  1892. @throw none
  1893. */
  1894. int getVertexDistanceFromRoot(VertexDescriptor& vertex);
  1895. /**
  1896. This function returns rank of vertex saved in the vertexproperty of provided graph.
  1897. @pre
  1898. -# subgraph != NULL
  1899. @param vertex
  1900. reference to vertex
  1901. @param subgraph
  1902. reference to subgraph
  1903. @return rank of vertex in integer
  1904. @throw none
  1905. */
  1906. int getVertexRank(VertexDescriptor& vertex, SubGraph& subgraph);
  1907. /**
  1908. This function returns rank of vertex of wrapper member graph.
  1909. @pre none
  1910. @param vertex
  1911. reference to vertex
  1912. @return rank of vertex in interger
  1913. @throw none
  1914. */
  1915. int getVertexRank(VertexDescriptor& vertex);
  1916. /**
  1917. This function returns horizontal position of vertex saved in the vertexproperty of provided graph.
  1918. @pre
  1919. -# subgraph != NULL
  1920. @param vertex
  1921. reference to vertex
  1922. @param subgraph
  1923. reference to subgraph
  1924. @return horizontal position of vertex in integer
  1925. @throw none
  1926. */
  1927. int getVertexHorizontalPosition(VertexDescriptor& vertex, SubGraph& subgraph);
  1928. /**
  1929. This function returns horizontal position of vertex of wrapper member graph.
  1930. @pre none
  1931. @param vertex
  1932. reference to vertex
  1933. @return horizontal position of vertex in interger
  1934. @throw none
  1935. */
  1936. int getVertexHorizontalPosition(VertexDescriptor &vertex);
  1937. /**
  1938. This function returns barry center of vertex saved in the vertexproperty of provided graph.
  1939. @pre
  1940. -# subgraph != NULL
  1941. @param vertex
  1942. reference to vertex
  1943. @param subgraph
  1944. reference to subgraph
  1945. @return barry center of vertex in integer
  1946. @throw none
  1947. */
  1948. double getVertexBarryCenter(VertexDescriptor& vertex, SubGraph& subgraph);
  1949. /**
  1950. This function returns barry center of vertex of wrapper member graph.
  1951. @pre none
  1952. @param vertex
  1953. reference to vertex
  1954. @return barry center of vertex in interger
  1955. @throw none
  1956. */
  1957. double getVertexBarryCenter(VertexDescriptor &vertex);
  1958. //int iTreeLeftX;
  1959. int getVertexTreeLeftX(VertexDescriptor& vertex, SubGraph& subgraph);
  1960. int getVertexTreeLeftX(VertexDescriptor& vertex);
  1961. /**
  1962. This function returns type of vertex saved in the vertexproperty of provided graph.
  1963. @pre
  1964. -# subgraph != NULL
  1965. @param vertex
  1966. reference to vertex
  1967. @param subgraph
  1968. reference to subgraph
  1969. @return type of vertex
  1970. @throw none
  1971. */
  1972. LayoutEnum::NodeType getVertexType(VertexDescriptor& vertex, SubGraph& subgraph);
  1973. /**
  1974. This function returns type of vertex of wrapper member graph.
  1975. @pre none
  1976. @param vertex
  1977. reference to vertex
  1978. @return type of vertex
  1979. @throw none
  1980. */
  1981. LayoutEnum::NodeType getVertexType(VertexDescriptor& vertex);
  1982. bool getVertexVisited(VertexDescriptor& vertex, SubGraph& subgraph);
  1983. bool getVertexVisited(VertexDescriptor& vertex);
  1984. /**
  1985. This function returns topological order of vertex saved in the vertexproperty of provided graph.
  1986. @pre
  1987. -# subgraph != NULL
  1988. @param vertex
  1989. reference to vertex
  1990. @param subgraph
  1991. reference to subgraph
  1992. @return topological order of vertex
  1993. @throw none
  1994. */
  1995. int getVertexTopologicalOrder(VertexDescriptor& vertex, SubGraph& subgraph);
  1996. /**
  1997. This function returns topological order of vertex of wrapper member graph.
  1998. @pre none
  1999. @param vertex
  2000. reference to vertex
  2001. @return topological order of vertex
  2002. @throw none
  2003. */
  2004. int getVertexTopologicalOrder(VertexDescriptor& vertex);
  2005. /**
  2006. This function returns id of edge saved in the edge property of provided graph.
  2007. @pre
  2008. -# subgraph != NULL
  2009. @param edge
  2010. reference to edge
  2011. @param subgraph
  2012. reference to subgraph
  2013. @return id of edge
  2014. @throw none
  2015. */
  2016. QString getEdgeId(EdgeDescriptor& edge, SubGraph& subgraph);
  2017. /**
  2018. This function returns id of edge of wrapper member graph.
  2019. @pre none
  2020. @param edge
  2021. reference to edge
  2022. @return id of edge
  2023. @throw none
  2024. */
  2025. QString getEdgeId(EdgeDescriptor& edge);
  2026. std::size_t getEdgeIndex(EdgeDescriptor& edge, SubGraph& subgraph);
  2027. std::size_t getEdgeIndex(EdgeDescriptor& edge);
  2028. /**
  2029. This function returns type of edge direction saved in the edge property of provided graph.
  2030. @pre
  2031. -# subgraph != NULL
  2032. @param edge
  2033. reference to edge
  2034. @param subgraph
  2035. reference to subgraph
  2036. @return type of edge direction
  2037. @throw none
  2038. */
  2039. bool getEdgeBidirectional(EdgeDescriptor& edge, SubGraph& subgraph);
  2040. /**
  2041. This function returns type of edge direction of wrapper member graph.
  2042. @pre none
  2043. @param edge
  2044. reference to edge
  2045. @return type of edge direction
  2046. @throw none
  2047. */
  2048. bool getEdgeBidirectional(EdgeDescriptor& edge);
  2049. /**
  2050. This function returns type of edge invisible saved in the edge property of provided graph.
  2051. @pre
  2052. -# subgraph != NULL
  2053. @param edge
  2054. reference to edge
  2055. @param subgraph
  2056. reference to subgraph
  2057. @return type of edge invisible
  2058. @throw none
  2059. */
  2060. bool getEdgeIsInvisible(EdgeDescriptor& edge, SubGraph& subgraph);
  2061. /**
  2062. This function returns type of edge invisible of wrapper member graph.
  2063. @pre none
  2064. @param edge
  2065. reference to edge
  2066. @return type of edge invisible
  2067. @throw none
  2068. */
  2069. bool getEdgeIsInvisible(EdgeDescriptor& edge);
  2070. bool getEdgeVisited(EdgeDescriptor& edge, SubGraph& subgraph);
  2071. bool getEdgeVisited(EdgeDescriptor& edge);
  2072. /**
  2073. This function returns type of edge reversed saved in the edge property of provided graph.
  2074. @pre
  2075. -# subgraph != NULL
  2076. @param edge
  2077. reference to edge
  2078. @param subgraph
  2079. reference to subgraph
  2080. @return type of edge reversed
  2081. @throw none
  2082. */
  2083. bool getEdgeReversed(EdgeDescriptor& edge, SubGraph& subgraph);
  2084. /**
  2085. This function returns type of edge reversed of wrapper member graph.
  2086. @pre none
  2087. @param edge
  2088. reference to edge
  2089. @return type of edge reversed
  2090. @throw none
  2091. */
  2092. bool getEdgeReversed(EdgeDescriptor& edge);
  2093. /**
  2094. This function returns if edge is conflicted/crossing with another edge saved in the edge property of provided graph.
  2095. @pre
  2096. -# subgraph != NULL
  2097. @param edge
  2098. reference to edge
  2099. @param subgraph
  2100. reference to subgraph
  2101. @return if edge is conflicted/crossing with another edge or not
  2102. @throw none
  2103. */
  2104. bool getEdgeIsConflicted(EdgeDescriptor& edge, SubGraph& subgraph);
  2105. /**
  2106. This function returns if edge is conflicted/crossing with another edge of wrapper member graph.
  2107. @pre none
  2108. @param edge
  2109. reference to edge
  2110. @return if edge is conflicted/crossing with another edge or not
  2111. @throw none
  2112. */
  2113. bool getEdgeIsConflicted(EdgeDescriptor& edge);
  2114. LayoutEnum::EdgeType getEdgeType(EdgeDescriptor eEdge , SubGraph &gGraph);
  2115. LayoutEnum::EdgeType getEdgeType(EdgeDescriptor eEdge);
  2116. /**
  2117. This function iterates the bend points list of the edge.
  2118. * @brief edgeBendPointsIter
  2119. *
  2120. * @param eEdge
  2121. * graph should contain this edge.
  2122. *
  2123. * @param gSubgraph
  2124. * -# gSubgraph != NULL
  2125. *
  2126. * @return none
  2127. *
  2128. * @throw none
  2129. */
  2130. std::pair<IteratorQVectorBendPoints, IteratorQVectorBendPoints> edgeBendPointsIter(EdgeDescriptor& eEdge, SubGraph& gSubgraph);
  2131. /**
  2132. This function returns id of a provided graph
  2133. *
  2134. * @pre
  2135. * -# gSubgraph != NULL
  2136. *
  2137. * @param gSubgraph
  2138. * reference to graph
  2139. *
  2140. * @return none
  2141. *
  2142. * @throw none
  2143. */
  2144. QString getGraphId(SubGraph& gSubgraph);
  2145. /**
  2146. This function returns id of a wrapper member graph
  2147. *
  2148. * @pre none
  2149. *
  2150. * @param none
  2151. *
  2152. * @return id of graph
  2153. *
  2154. * @throw none
  2155. */
  2156. QString getGraphId();
  2157. //Index of vertex reperesenting this subgraph - Dummy Node
  2158. //size_t iDummyNodeIndex;
  2159. /**
  2160. This function returns index of this provided graph.
  2161. *
  2162. * @pre
  2163. * -# gSubgraph != NULL
  2164. * -# sId should not be empty
  2165. *
  2166. * @param gSubgraph
  2167. * reference to graph
  2168. *
  2169. * @return index for this graph's node
  2170. *
  2171. * @throw none
  2172. */
  2173. std::size_t getGraphDummyNodeIndex(SubGraph& gSubgraph);
  2174. /**
  2175. This function returns index of this wrapper member graph.
  2176. *
  2177. * @pre none
  2178. *
  2179. * @param none
  2180. *
  2181. * @return index for this graph's node
  2182. *
  2183. * @throw none
  2184. */
  2185. std::size_t getGraphDummyNodeIndex();
  2186. /**
  2187. This function returns left x coordinate of provided graph
  2188. *
  2189. * @pre
  2190. * -# gSubgraph != NULL
  2191. *
  2192. * @param gSubgraph
  2193. * reference to subgraph
  2194. *
  2195. * @return graph's x left coordinate
  2196. *
  2197. * @throw none
  2198. */
  2199. int getGraphLeftTopCoordX(SubGraph& gSubgraph);
  2200. /**
  2201. This function returns left x coordinate of wrapper member graph
  2202. *
  2203. * @pre none
  2204. *
  2205. * @param none
  2206. *
  2207. * @return graph's left x coordinate
  2208. *
  2209. * @throw none
  2210. */
  2211. int getGraphLeftTopCoordX();
  2212. /**
  2213. This function returns top y coordinate of provided graph
  2214. *
  2215. * @pre
  2216. * -# gSubgraph != NULL
  2217. *
  2218. * @param gSubgraph
  2219. * reference to subgraph
  2220. *
  2221. * @return graph's y top coordinate
  2222. *
  2223. * @throw none
  2224. */
  2225. int getGraphLeftTopCoordY(SubGraph& gSubgraph);
  2226. /**
  2227. This function returns top y coordinate of wrapper member graph
  2228. *
  2229. * @pre none
  2230. *
  2231. * @param none
  2232. *
  2233. * @return graph's top y coordinate
  2234. *
  2235. * @throw none
  2236. */
  2237. int getGraphLeftTopCoordY();
  2238. /**
  2239. This function returns center coordinate of provided graph
  2240. *
  2241. * @pre
  2242. * -# gSubgraph != NULL
  2243. *
  2244. * @param gSubgraph
  2245. * reference to subgraph
  2246. *
  2247. * @return graph's center x coordinate
  2248. *
  2249. * @throw none
  2250. */
  2251. int getGraphCenterCoordX(SubGraph& gSubgraph);
  2252. /**
  2253. This function returns center x coordinate of wrapper member graph
  2254. *
  2255. * @pre none
  2256. *
  2257. * @param none
  2258. *
  2259. * @return graph's center x coordinate
  2260. *
  2261. * @throw none
  2262. */
  2263. int getGraphCenterCoordX();
  2264. /**
  2265. This function returns center coordinate of provided graph
  2266. *
  2267. * @pre
  2268. * -# gSubgraph != NULL
  2269. *
  2270. * @param gSubgraph
  2271. * reference to subgraph
  2272. *
  2273. * @return graph's center y coordinate
  2274. *
  2275. * @throw none
  2276. */
  2277. int getGraphCenterCoordY(SubGraph& gSubgraph);
  2278. /**
  2279. This function returns center y coordinate of wrapper member graph
  2280. *
  2281. * @pre none
  2282. *
  2283. * @param none
  2284. *
  2285. * @return graph's center y coordinate
  2286. *
  2287. * @throw none
  2288. */
  2289. int getGraphCenterCoordY();
  2290. /**
  2291. This function returns radius of provided graph
  2292. *
  2293. * @pre
  2294. * -# gSubgraph != NULL
  2295. *
  2296. * @param gSubgraph
  2297. * reference to subgraph
  2298. *
  2299. * @return radius of graph
  2300. *
  2301. * @throw none
  2302. */
  2303. double getGraphRadius(SubGraph& gSubgraph);
  2304. /**
  2305. This function returns radius of wrapper member graph
  2306. *
  2307. * @pre none
  2308. *
  2309. * @param none
  2310. *
  2311. * @return radius of graph
  2312. *
  2313. * @throw none
  2314. */
  2315. double getGraphRadius();
  2316. /**
  2317. This function returns height of provided graph
  2318. *
  2319. * @pre
  2320. * -# gSubgraph != NULL
  2321. *
  2322. * @param gSubgraph
  2323. * reference to subgraph
  2324. *
  2325. * @return height of graph
  2326. *
  2327. * @throw none
  2328. */
  2329. int getGraphHeight(SubGraph& gSubgraph);
  2330. /**
  2331. This function returns height from wrapper member graph
  2332. *
  2333. * @pre none
  2334. *
  2335. * @param none
  2336. *
  2337. * @return height of graph
  2338. *
  2339. * @throw none
  2340. */
  2341. int getGraphHeight();
  2342. /**
  2343. This function returns width of provided graph
  2344. *
  2345. * @pre
  2346. * -# gSubgraph != NULL
  2347. *
  2348. * @param gSubgraph
  2349. * reference to subgraph
  2350. *
  2351. * @return width of graph
  2352. *
  2353. * @throw none
  2354. */
  2355. int getGraphWidth(SubGraph& gSubgraph);
  2356. /**
  2357. This function returns width from wrapper member graph
  2358. *
  2359. * @pre none
  2360. *
  2361. * @param none
  2362. *
  2363. * @return width of graph
  2364. *
  2365. * @throw none
  2366. */
  2367. int getGraphWidth();
  2368. int getGraphCoordX(SubGraph& gSubgraph);
  2369. int getGraphCoordX();
  2370. int getGraphCoordY(SubGraph& gSubgraph);
  2371. int getGraphCoordY();
  2372. /**
  2373. This function returns distance between centroid of graph and center x coordinate of provided graph
  2374. *
  2375. * @pre
  2376. * -# gSubgraph != NULL
  2377. *
  2378. * @param gSubgraph
  2379. * reference to subgraph
  2380. *
  2381. * @return distance between centroid of graph and center x coordinate
  2382. *
  2383. * @throw none
  2384. */
  2385. int getGraphDistanceBetweenCentoidAndCenterCoordX(SubGraph& gSubgraph);
  2386. /**
  2387. This function returns distance between centroid of graph and center x coordinate of wrapper member graph
  2388. *
  2389. * @pre none
  2390. *
  2391. * @param none
  2392. *
  2393. * @return distance between centroid of graph and center x coordinate
  2394. *
  2395. * @throw none
  2396. */
  2397. int getGraphDistanceBetweenCentoidAndCenterCoordX();
  2398. /**
  2399. This function returns distance between y coordinate centroid of graph and center y coordinate of provided graph
  2400. *
  2401. * @pre
  2402. * -# gSubgraph != NULL
  2403. *
  2404. * @param gSubgraph
  2405. * reference to subgraph
  2406. *
  2407. * @return distance between y coorcinate centroid of graph and center y coordinate
  2408. *
  2409. * @throw none
  2410. */
  2411. int getGraphDistanceBetweenCentoidAndCenterCoordY(SubGraph& gSubgraph);
  2412. /**
  2413. This function returns distance between y coordinate centroid of graph and center y coordinate of wrapper member graph
  2414. *
  2415. * @pre none
  2416. *
  2417. * @param none
  2418. *
  2419. * @return distance between centroid of graph and center y coordinate
  2420. *
  2421. * @throw none
  2422. */
  2423. int getGraphDistanceBetweenCentoidAndCenterCoordY();
  2424. /**
  2425. This function checks whether provided vertex is own vertex of provided graph.
  2426. *
  2427. * @pre none
  2428. *
  2429. * @param vVertex
  2430. * value of the vertex
  2431. *
  2432. * @return none
  2433. *
  2434. * @throw none
  2435. */
  2436. bool isOwnVertex(VertexDescriptor vVertex , SubGraph &gGraph);
  2437. /**
  2438. This function iterates the ownvertex list of a provided graph
  2439. *
  2440. * @pre none
  2441. *
  2442. * @param gGraph
  2443. * reference to graph
  2444. *
  2445. * @return pair of iterators of vector of int type
  2446. *
  2447. * @throw none
  2448. */
  2449. std::pair<IteratorQVectorUInt , IteratorQVectorUInt> ownVerticesIter(SubGraph &gGraph);
  2450. /**
  2451. This function returns the total number of own vertices of the provided graph.
  2452. *
  2453. * @pre
  2454. *-# gGraph !- NULL
  2455. *
  2456. * @param gGraph
  2457. * reference to graph
  2458. *
  2459. * @return number of own vertices
  2460. *
  2461. * @throw none
  2462. */
  2463. int getCountOfOwnVertices(SubGraph &gGraph);
  2464. //Upper Border Vertex
  2465. //std::size_t vUpperBorderVertex;
  2466. //int iCoordX;
  2467. /**
  2468. This function returns the value of the upper border vertex with respect to provided graph.
  2469. *
  2470. * @pre
  2471. *-# gGraph !- NULL
  2472. *
  2473. * @param gGraph
  2474. * reference to graph
  2475. *
  2476. * @return value of the upper border vertex
  2477. *
  2478. * @throw none
  2479. */
  2480. std::size_t getGraphUpperBorderVertex(SubGraph& gGraph);
  2481. /**
  2482. This function returns the value of the upper border vertex with respect to wrapper member graph.
  2483. *
  2484. * @pre
  2485. *-# gGraph !- NULL
  2486. *
  2487. * @param gGraph
  2488. * reference to graph
  2489. *
  2490. * @return value of the upper border vertex
  2491. *
  2492. * @throw none
  2493. */
  2494. std::size_t getGraphUpperBorderVertex();
  2495. /**
  2496. This function returns the value of the lower border vertex with respect to provided graph.
  2497. *
  2498. * @pre
  2499. * -# gGraph !- NULL
  2500. *
  2501. * @param gGraph
  2502. * reference to graph
  2503. *
  2504. * @return value of the lower border vertex
  2505. *
  2506. * @throw none
  2507. */
  2508. std::size_t getGraphLowerBorderVertex(SubGraph& gGraph);
  2509. /**
  2510. This function returns the value of the lower border vertex with respect to wrapper member graph.
  2511. *
  2512. * @pre
  2513. *-# gGraph !- NULL
  2514. *
  2515. * @param gGraph
  2516. * reference to graph
  2517. *
  2518. * @return value of the lower border vertex
  2519. *
  2520. * @throw none
  2521. */
  2522. std::size_t getGraphLowerBorderVertex();
  2523. /**
  2524. This function returns the source vertex of provided edge
  2525. *
  2526. * @pre
  2527. * -# subgraph !- NULL
  2528. *
  2529. * @param gGraph
  2530. * reference to graph
  2531. *
  2532. * @param edge
  2533. * edge from the graph
  2534. *
  2535. * @return none
  2536. *
  2537. * @throw none
  2538. */
  2539. VertexDescriptor getEdgeTarget(EdgeDescriptor edge , SubGraph& subgraph);
  2540. /**
  2541. This function returns the target vertex of provided egde from wrapper member graph.
  2542. *
  2543. * @pre none
  2544. *
  2545. *@param edge
  2546. * value of edge from wrapper member graph
  2547. *
  2548. * @return none
  2549. *
  2550. * @throw none
  2551. */
  2552. VertexDescriptor getEdgeTarget(EdgeDescriptor edge);
  2553. /**
  2554. This function returns the target vertex of provided edge
  2555. *
  2556. * @pre
  2557. *-# subgraph !- NULL
  2558. *
  2559. * @param gGraph
  2560. * reference to graph
  2561. *
  2562. * @param edge
  2563. * edge from the graph
  2564. *
  2565. * @return none
  2566. *
  2567. * @throw none
  2568. */
  2569. VertexDescriptor getEdgeSource(EdgeDescriptor edge , SubGraph& subgraph);
  2570. /**
  2571. This function returns the source vertex of provided egde.
  2572. *
  2573. * @pre none
  2574. *
  2575. *@param edge
  2576. * value of edge from wrapper member graph
  2577. *
  2578. * @return none
  2579. *
  2580. * @throw none
  2581. */
  2582. VertexDescriptor getEdgeSource(EdgeDescriptor edge);
  2583. /**
  2584. This function returns the vertices in the pair of vertex iterators form of wrapper member graph.
  2585. *
  2586. * @pre none
  2587. *
  2588. * @return none
  2589. *
  2590. * @throw none
  2591. */
  2592. VertexIterPair getVertices();
  2593. /**
  2594. This function returns the vertices in the pair of vertex iterators form of provided graph.
  2595. *
  2596. * @pre
  2597. * -# subgraph != NULL
  2598. *
  2599. * @param subgraph
  2600. * reference to subgraph
  2601. *
  2602. * @return pair of vertex iterators
  2603. *
  2604. * @throw none
  2605. */
  2606. VertexIterPair getVertices(SubGraph& subgraph);
  2607. //Children Iterator
  2608. //for m_Graph
  2609. /**
  2610. This function returns pair of children iteartors for getting children of wrapper member graph.
  2611. *
  2612. * @pre none
  2613. *
  2614. * @param none
  2615. *
  2616. * @return pair of children iterators
  2617. *
  2618. * @throw none
  2619. */
  2620. ChildrenIterPair getChildren();
  2621. /**
  2622. This function returns pair of children iteartors for getting children of provided graph.
  2623. *
  2624. * @pre none
  2625. *
  2626. * @param subgraph
  2627. * reference to graph
  2628. *
  2629. * @return pair of children iterators
  2630. *
  2631. * @throw none
  2632. */
  2633. ChildrenIterPair getChildren(SubGraph& subgraph);
  2634. //in_edges iterator
  2635. /**
  2636. This function returns inedges coming at the vertex provided from wrapper member graph.
  2637. *
  2638. * @pre none
  2639. *
  2640. * @param vertex
  2641. * reference to vertex
  2642. *
  2643. * @return pair of inedge iterators
  2644. *
  2645. * @throw none
  2646. */
  2647. InEdgeIterPair getInEdges(VertexDescriptor &vertex);
  2648. /**
  2649. This function returns inedges coming at the vertex provided from provided graph.
  2650. *
  2651. * @pre none
  2652. *
  2653. * @param vertex
  2654. * reference to vertex
  2655. *
  2656. * @param subgraph
  2657. * reference tosubgraph
  2658. *
  2659. * @return pair of inedge iterators
  2660. *
  2661. * @throw none
  2662. */
  2663. InEdgeIterPair getInEdges(VertexDescriptor &vertex,SubGraph& subgraph);
  2664. //out_edges iterator
  2665. /**
  2666. This function returns outedges coming at the vertex provided from wrapper member graph.
  2667. *
  2668. * @pre none
  2669. *
  2670. * @param vertex
  2671. * reference to vertex
  2672. *
  2673. * @return pair of outedges iterators
  2674. *
  2675. * @throw none
  2676. */
  2677. OutEdgeIterPair getOutEdges(VertexDescriptor &vertex);
  2678. /**
  2679. This function returns outedges coming at the vertex provided from provided graph.
  2680. *
  2681. * @pre none
  2682. *
  2683. * @param vertex
  2684. * reference to vertex
  2685. *
  2686. * @param subgraph
  2687. * reference tosubgraph
  2688. *
  2689. * @return pair of outedges iterators
  2690. *
  2691. * @throw none
  2692. */
  2693. OutEdgeIterPair getOutEdges(VertexDescriptor &vertex,SubGraph& subgraph);
  2694. /**
  2695. This function returns children subgraphs of provided graph.
  2696. *
  2697. * @pre
  2698. *-# gSubgraph != NULL
  2699. *
  2700. * @param gSubgraph
  2701. * reference to subgraph
  2702. *
  2703. * @return none
  2704. *
  2705. * @throw none
  2706. */
  2707. void getChildrenVector(SubGraph &gSubgraph, VectorSubgraphRefs &vecChildSubgraphs);
  2708. /**
  2709. This function returns map of vertices ordered by their 'order' property value.
  2710. *
  2711. * @pre
  2712. *-# subgraph != NULL
  2713. *
  2714. * @param subgraph
  2715. * reference to subgraph
  2716. * @param mapVertexOrder
  2717. * reference to vertex order map.
  2718. *
  2719. * @return order vertex map
  2720. *
  2721. * @throw none
  2722. */
  2723. template <typename MapVertexOrder>
  2724. MapOrderVertex getMapOrderedVertices(SubGraph& subgraph,MapVertexOrder& mapVertexOrder)
  2725. {
  2726. //To Do: assert for mapVertexOrder
  2727. MapOrderVertex mapOrderVertex;
  2728. //iterate all vertices
  2729. std::size_t order;
  2730. BGL_FORALL_VERTICES(vertex, subgraph , SubGraph)
  2731. {
  2732. order = mapVertexOrder[vertex];
  2733. // //cout<<"order: "<<order <<" - "<<PGL_VERTEX_INDEX(vertex , subgraph)<<endl;
  2734. //add elements (order,vertex)
  2735. mapOrderVertex.insert(order , vertex);
  2736. }
  2737. return mapOrderVertex;
  2738. }
  2739. /**
  2740. This function checks the provided order is valid or not.
  2741. *
  2742. * @pre
  2743. *-# subgraph != NULL
  2744. *
  2745. * @param order
  2746. * order value
  2747. *
  2748. * @return valid order or not
  2749. *
  2750. * @throw none
  2751. */
  2752. bool isValidOrder(std::size_t order);
  2753. /**
  2754. This function returns the order of provided vertex.
  2755. *
  2756. * @pre
  2757. *-# subgraph != NULL
  2758. *
  2759. * @param vertex
  2760. * reference to vertex
  2761. *
  2762. * @return order value
  2763. *
  2764. * @throw none
  2765. */
  2766. int getVertexOrder(VertexDescriptor& vertex , SubGraph& subgraph);
  2767. /**
  2768. This function checks whether the shifting of orders of vertices is valid or not.
  2769. *
  2770. * @pre
  2771. *-# subgraph != NULL
  2772. *
  2773. * @param iOrderSource
  2774. * value of order to be shifted
  2775. *
  2776. * @param iShiftBy
  2777. * shift by value
  2778. *
  2779. * @param mapOrderVertex
  2780. * reference to order vertex map
  2781. *
  2782. * @param enDirection
  2783. * direction of shifting
  2784. *
  2785. * @return whether valid shift or not
  2786. *
  2787. * @throw none
  2788. */
  2789. bool isValidShift(std::size_t iOrderSource,MapOrderVertex& mapOrderVertex,
  2790. int iShiftBy, ShiftDirection enDirection);
  2791. /**
  2792. This function returns souce vertex x coordinate of provided edge of provided graph.
  2793. @pre
  2794. -# subGraph != NULL
  2795. @param eEdge
  2796. edge value
  2797. @param subGraph
  2798. reference to input graph.
  2799. @return x coordinate of source vertex of edge
  2800. @throw none
  2801. */
  2802. int getEdgeSourceX(EdgeDescriptor eEdge, SubGraph &subGraph);
  2803. /**
  2804. This function returns souce vertex y coordinate of provided edge of provided graph.
  2805. @pre
  2806. -# subGraph != NULL
  2807. @param eEdge
  2808. edge value
  2809. @param subGraph
  2810. reference to input graph.
  2811. @return y coordinate of source vertex of edge
  2812. @throw none
  2813. */
  2814. int getEdgeSourceY(EdgeDescriptor eEdge, SubGraph &subGraph);
  2815. /**
  2816. This function returns target vertex x coordinate of provided edge of provided graph.
  2817. @pre
  2818. -# subGraph != NULL
  2819. @param eEdge
  2820. edge value
  2821. @param subGraph
  2822. reference to input graph.
  2823. @return x coordinate of source vertex of edge
  2824. @throw none
  2825. */
  2826. int getEdgeTargetX(EdgeDescriptor eEdge, SubGraph &subGraph);
  2827. /**
  2828. This function returns target vertex y coordinate of provided edge of provided graph.
  2829. @pre
  2830. -# subGraph != NULL
  2831. @param eEdge
  2832. edge value
  2833. @param subGraph
  2834. reference to input graph.
  2835. @return y coordinate of source vertex of edge
  2836. @throw none
  2837. */
  2838. int getEdgeTargetY(EdgeDescriptor eEdge, SubGraph &subGraph);
  2839. /**
  2840. This function returns count of crossings f edges.
  2841. @pre
  2842. -# subGraph != NULL
  2843. @param gGraph
  2844. reference to input graph.
  2845. @return count of crossings of edges from graph
  2846. @throw none
  2847. */
  2848. int getEdgeCrossingCount(SubGraph & gGraph);
  2849. /**
  2850. This function calculates the minimum and maximun numbered vertices from the graph.
  2851. @pre
  2852. -# gSubgraph != NULL
  2853. @param gSubgraph
  2854. reference to graph.
  2855. @param iMaxVertex
  2856. value for maximum ordered vertex.
  2857. @param iMinVertex
  2858. value for minimum ordered vertex.
  2859. @return none
  2860. @throw none
  2861. */
  2862. void getMinMaxVertexOrder(SubGraph& gSubgraph, int& iMinVertexOrder, int& iMaxVertexOrder);
  2863. /**
  2864. This function provides the lower index vertex and higher index vertex.
  2865. @pre
  2866. -# gSubgraph != NULL
  2867. @param gSubgraph
  2868. reference to graph
  2869. @return none
  2870. @throw none
  2871. */
  2872. void getMinMaxVertices(SubGraph& gSubgraph, VertexDescriptor& vMinVertex, VertexDescriptor& vMaxVertex);
  2873. //Convert Boost Edge to QString
  2874. QString edgeToQString(EdgeDescriptor eEdge, SubGraph gGraph);
  2875. int getVertXDisp(VertexDescriptor verDis,SubGraph &l_graph );
  2876. int getVertYDisp(VertexDescriptor verDis,SubGraph &l_graph);
  2877. bool getIsVertexLocked(VertexDescriptor verDis, SubGraph &l_graph);
  2878. int getGraphClusterID(SubGraph& gSubgraph);
  2879. int getVertexClusterID(VertexDescriptor vertex, SubGraph& subgraph);
  2880. bool getIsVirtualNode(VertexDescriptor vertex, SubGraph& subgraph);
  2881. int getClusterXDisplacement(SubGraph& gSubgraph);
  2882. int getClusterYDisplacement(SubGraph& gSubgraph);
  2883. //@}
  2884. private:
  2885. //initialize vertex order for newly inserted vertex
  2886. /**
  2887. This function initializes the new inserted vertex order values to its index from provided graph.
  2888. @pre
  2889. -# gSubgraph != NULL
  2890. @param vertex
  2891. reference to vertex
  2892. @param gSubgraph
  2893. reference to graph.
  2894. @return none
  2895. @throw none
  2896. */
  2897. void initVertexOrderValue(VertexDescriptor& vertex,SubGraph& subgraph);
  2898. //***shift vertex order***
  2899. /**
  2900. This function shifts the vertices by its orderin the order vertex map
  2901. @pre
  2902. -# iShiftBy != 0
  2903. -# mapOrderVertex.contains(iOrderSource)
  2904. @param iOrderSource
  2905. value of order in the map
  2906. @param mapOrerVertex
  2907. order to vertex map
  2908. @param mapVertexOrder
  2909. vertex to order map
  2910. @param iShiftBy
  2911. integer value to shift position in map
  2912. @param enDirection
  2913. value for direction left or right
  2914. @return none
  2915. @throw none
  2916. */
  2917. template <typename MapVertexOrder>
  2918. void shiftVertexByOrder(std::size_t iOrderSource, MapOrderVertex& mapOrderVertex,
  2919. MapVertexOrder& mapVertexOrder, int iShiftBy,
  2920. ShiftDirection enDirection)
  2921. {
  2922. //Check iShift>0
  2923. LAYOUT_ASSERT(iShiftBy>0,LayoutException(__FUNCTION__
  2924. , LayoutExceptionEnum::INVALID_PARAMETER
  2925. , "must be greater than zero"
  2926. , "iShiftBy"));
  2927. LAYOUT_ASSERT(mapOrderVertex.contains(iOrderSource),LayoutException(__FUNCTION__
  2928. , LayoutExceptionEnum::NOT_FOUND_IN_CONTAINER
  2929. , "mapOrderVertex"
  2930. , "iOrderSource"));
  2931. //Check iOrder1 is valid key in mapOrderVertex
  2932. if(mapOrderVertex.contains(iOrderSource))
  2933. {
  2934. //Check shifting is valid or not
  2935. bool isValidShiftValue = isValidShift(iOrderSource,mapOrderVertex
  2936. ,iShiftBy,enDirection);
  2937. if(isValidShiftValue)
  2938. {
  2939. //shift in enDirection by 1
  2940. MapOrderVertex::iterator iterMapOrderVertex;
  2941. iterMapOrderVertex = mapOrderVertex.find(iOrderSource);
  2942. if(enDirection==LeftDirection)
  2943. {
  2944. iterMapOrderVertex--;
  2945. }
  2946. else if(enDirection==RightDirection)
  2947. {
  2948. iterMapOrderVertex++;
  2949. }
  2950. std::size_t iOrderDestination = iterMapOrderVertex.key();
  2951. //Swapping the source with destinition
  2952. swapVertexOrderByOrder(iOrderSource,iOrderDestination,
  2953. mapOrderVertex,mapVertexOrder);
  2954. //call shifting again pass: iShiftBy reduced by 1
  2955. iShiftBy--;
  2956. if(iShiftBy>0)
  2957. {
  2958. //Now iOrderDestinition is the iOrderSource
  2959. shiftVertexByOrder(iOrderDestination,mapOrderVertex,mapVertexOrder,
  2960. iShiftBy,enDirection);
  2961. }
  2962. }
  2963. else
  2964. {
  2965. cout<<directionEnumString(enDirection).toStdString();
  2966. //cout<<" shift not possible. Invalid shift value:"<<iShiftBy<<"."<<endl;
  2967. }
  2968. }
  2969. else
  2970. {
  2971. //Warning iOrderSource is not a valid order value in map 'mapOrderVertex'
  2972. cout << directionEnumString(enDirection).toStdString();
  2973. //cout<< " shift not possible. Invalid order: "<<iOrderSource<<"."<<endl;
  2974. }
  2975. }
  2976. //Return string for enum ShiftDirection
  2977. /**
  2978. This function returns the direction for the shifting of order.
  2979. @pre
  2980. -# enDirection should be valid direction
  2981. @param enDirection
  2982. value for the direction.
  2983. @return direction in string
  2984. @throw none
  2985. */
  2986. QString directionEnumString(ShiftDirection enDirection);
  2987. };
  2988. #endif // BOOSTGRAPHWRAPPER_H