ClusteredSpringEmbedder.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. #ifndef SPRINGEMBEDDERVARIABLESIZENODES_H
  2. #define SPRINGEMBEDDERVARIABLESIZENODES_H
  3. #include<Common/GraphType.h>
  4. #include<Common/BoostGraphWrapper.h>
  5. #include <ForceBasedLayout/SpringEmbedder.h>
  6. #include "MembershipInitializer.h"
  7. #include <HierarchicalLayoutGenerator/HierarchicalLayouter.h>
  8. #include <Common/LayoutEnum.h>
  9. #include <Common/GraphType.h>
  10. #include <ForceBasedLayout/Reingold.h>
  11. #include <boost/geometry.hpp>
  12. #include <boost/geometry/geometries/segment.hpp>
  13. #include <boost/geometry/algorithms/intersection.hpp>
  14. #include <ForceBasedLayout/Postprocessing.h>
  15. #include <ForceBasedLayout/RelaxInterEdges.h>
  16. #include<LayoutException/LayoutExceptionConstants.h>
  17. #include<ForceBasedLayout/Constants.h>
  18. #include<ForceBasedLayout/VertexOverlapRemoval.h>
  19. /**
  20. * @brief The ClusteredSpringEmbedder class
  21. *
  22. * The class provides helpers for spring embedder algorithm on clustered graph.
  23. */
  24. class GRAPHLAYOUTLIBRARYSHARED_EXPORT ClusteredSpringEmbedder
  25. {
  26. public:
  27. SubGraph *m_gSubgraph = NULL; /*!< Pointer to subgraph */
  28. SubGraph m_gMaingraph; /*!< Copy of Main graph*/
  29. BoostGraphWrapper m_bGraphWrapper; /*!< Single graph wrapper object to access properties */
  30. /** @name Creators
  31. * The methods under this section are responsible for constructing
  32. * an instance of type ClusteredSpringEmbedder.
  33. */
  34. //@{
  35. /**
  36. Constructs new object of type ClusteredSpringEmbedder.
  37. @pre none
  38. @param none
  39. @return none
  40. @throw none
  41. */
  42. ClusteredSpringEmbedder();
  43. //@}
  44. /** @name Modifiers
  45. * The methods under this section are responsible for modifying
  46. * an instance of ClusteredSpringEmbedder.
  47. */
  48. //@{
  49. /** For each subgraph of received graph.
  50. @pre
  51. -# gMaingraph != NULL
  52. @param iIterations
  53. number of iterations for algorithm
  54. @param gMaingraph
  55. reference to main graph
  56. @return none
  57. @throw LayoutException
  58. */
  59. void springForEachCluster(SubGraph& gMaingraph,int iIterations);
  60. //@}
  61. private:
  62. /** Perform main algo steps iterations time
  63. @pre
  64. -# gMainGraph != NULL
  65. -# gSubgraph != NULL
  66. @param gMaingraph
  67. reference to main graph
  68. @param gSubgraph
  69. reference to Subgraph
  70. @param iIterations
  71. number of iterations
  72. @return none
  73. @throw none
  74. */
  75. void springStep(SubGraph& gSubgraph,SubGraph& gMaingraph,int iIterations);
  76. /** Relax only immediate nodes one step at a time
  77. @pre
  78. -# gMainGraph != NULL
  79. @param gSubgraph
  80. reference to graph
  81. @return none
  82. @throw none
  83. */
  84. void springRelaxImmediate(SubGraph& gSubgraph);
  85. /** Repel only immediate nodes one step at a time
  86. @pre
  87. -# gMainGraph != NULL
  88. @param gSubgraph
  89. reference to graph
  90. @return none
  91. @throw none
  92. */
  93. void springRepelImmediate(SubGraph& gSubgraph);
  94. /** Move the nodes one step in their bounds only
  95. @pre
  96. -# gMainGraph != NULL
  97. @param gSubgraph
  98. reference to graph
  99. @return none
  100. @throw none
  101. */
  102. void springMoveRestricted(SubGraph& gSubgraph);
  103. /** Repel only immediate nodes with immediate clusters one step at a time.
  104. @pre
  105. -# gMainGraph != NULL
  106. @param gSubgraph
  107. reference to graph
  108. @return none
  109. @throw none
  110. */
  111. void springRepelFromClusters(SubGraph& gSubgraph);
  112. /** Repel only immediate nodes with immediate clusters one step at a time.
  113. @pre
  114. -# gMaingraph != NULL
  115. @param gSubgraph
  116. Reference to sub graph
  117. @return none
  118. @throw none
  119. */
  120. void springRepelClustersToCluster(SubGraph& gSubgraph);
  121. /** Relax all the inter edges such of received subgraph such that it does not cross clusters,
  122. * generally will be of less power of force.
  123. @pre
  124. -# gMaingraph != NULL
  125. @param gMaingraph
  126. Reference to main graph
  127. @return none
  128. @throw LayoutException
  129. */
  130. void springRelaxInterEdges(SubGraph& gMaingraph );
  131. /** For each subgraph of received graph move clusters.
  132. @pre
  133. -# gsubgraph != NULL
  134. @param gsubgraph
  135. reference to graph
  136. @return none
  137. @throw LayoutException
  138. */
  139. void springMoveClusters(SubGraph& gsubgraph);
  140. /** For each subgraph of received graph. check whether clusters
  141. * needed to be expanded.
  142. @pre
  143. none
  144. @param none
  145. @return none
  146. @throw none
  147. */
  148. void springSetVerticesDisplacementZero();
  149. /** Testing method for recursive type of algorithm which starts lay out
  150. * from inner subgraph to outer.
  151. *
  152. @pre
  153. -# gMaingraph != NULL
  154. @param gMaingraph
  155. reference to graph
  156. @return none
  157. @throw none
  158. */
  159. void springTestRecursive(SubGraph& gMaingraph);
  160. /** Repel only immediate clusters with immediate clusters one step at a time.
  161. @pre
  162. -# gMainGraph != NULL
  163. @param gSubgraph
  164. reference to graph
  165. @return none
  166. @throw none
  167. */
  168. void springTestRepelClusterToCluster(SubGraph &gSubgraph);
  169. };
  170. #endif // SPRINGEMBEDDERVARIABLESIZENODES_H