SubgraphOrderingGraph.cpp 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #include "SubgraphOrderingGraph.h"
  2. SubgraphOrderingGraphWrapper::SubgraphOrderingGraphWrapper()
  3. {
  4. }
  5. void SubgraphOrderingGraphWrapper::setVertexNestingTreeSubgraphNodeRef(NestingTreeSubgraphNode *nestingTreeNodeRef, SubgraphOrderingGraphVertexDescriptor vVertex, SubgraphOrderingGraphType &gSubgraphOrderingGraph)
  6. {
  7. LAYOUT_ASSERT(gSubgraphOrderingGraph[vVertex].layerNode == NULL,
  8. LayoutException(__FUNCTION__
  9. ,LayoutExceptionEnum::INVALID_OPERATION
  10. ,"Setting Nesting Tree Node"
  11. ,"SubgraphOrderingGraph"));
  12. gSubgraphOrderingGraph[vVertex].nestingTreeSubgraphNode = nestingTreeNodeRef;
  13. gSubgraphOrderingGraph[vVertex].bIsLayerNode = false;
  14. }
  15. NestingTreeSubgraphNode *SubgraphOrderingGraphWrapper::getVertexNestingTreeSubgraphNode(SubgraphOrderingGraphVertexDescriptor vVertex, SubgraphOrderingGraphType &gSubgraphOrderingGraph)
  16. {
  17. LAYOUT_ASSERT(gSubgraphOrderingGraph[vVertex].nestingTreeSubgraphNode != NULL,
  18. LayoutException(__FUNCTION__
  19. ,LayoutExceptionEnum::REQUIRED_PARAMETER_NOT_SET
  20. ,"nestingTreeSubgraphNode"
  21. ,"SubgraphOrderingGraph"));
  22. return gSubgraphOrderingGraph[vVertex].nestingTreeSubgraphNode;
  23. }
  24. void SubgraphOrderingGraphWrapper::setVertexLayerNodeRef(LayerNode *layerNodeRef, SubgraphOrderingGraphVertexDescriptor vVertex, SubgraphOrderingGraphType &gSubgraphOrderingGraph)
  25. {
  26. LAYOUT_ASSERT(gSubgraphOrderingGraph[vVertex].nestingTreeSubgraphNode == NULL,
  27. LayoutException(__FUNCTION__
  28. ,LayoutExceptionEnum::INVALID_OPERATION
  29. ,"Setting LayerNodeRef"
  30. ,"SubgraphOrderingGraph"));
  31. gSubgraphOrderingGraph[vVertex].layerNode = layerNodeRef;
  32. gSubgraphOrderingGraph[vVertex].bIsLayerNode = true;
  33. }
  34. LayerNode *SubgraphOrderingGraphWrapper::getVertexLayerNodeRef(SubgraphOrderingGraphVertexDescriptor vVertex, SubgraphOrderingGraphType &gSubgraphOrderingGraph)
  35. {
  36. LAYOUT_ASSERT(gSubgraphOrderingGraph[vVertex].layerNode != NULL,
  37. LayoutException(__FUNCTION__
  38. ,LayoutExceptionEnum::REQUIRED_PARAMETER_NOT_SET
  39. ,"layerNode"
  40. ,"SubgraphOrderingGraph"));
  41. return gSubgraphOrderingGraph[vVertex].layerNode;
  42. }
  43. bool SubgraphOrderingGraphWrapper::isSubgraphOrderingVertexIsLayerNode(SubgraphOrderingGraphVertexDescriptor vVertex, SubgraphOrderingGraphType &gSubgraphOrderingGraph)
  44. {
  45. LAYOUT_ASSERT(gSubgraphOrderingGraph[vVertex].nestingTreeSubgraphNode == NULL ||
  46. gSubgraphOrderingGraph[vVertex].layerNode == NULL,
  47. LayoutException(__FUNCTION__
  48. ,LayoutExceptionEnum::REQUIRED_PARAMETER_NOT_SET
  49. ,"layerNode and nestingTreeSubgraphNode"
  50. ,"SubgraphOrderingGraph"));
  51. return gSubgraphOrderingGraph[vVertex].bIsLayerNode;
  52. }
  53. bool SubgraphOrderingGraphWrapper::getIsEdgeInSpanningTree(SubgraphOrderingGraphEdgeDescriptor eEdge, SubgraphOrderingGraphType &gSubgraphOrderingGraph)
  54. {
  55. LAYOUT_ASSERT(gSubgraphOrderingGraph.find_edge(eEdge).second == true,
  56. LayoutException(__FUNCTION__
  57. ,LayoutExceptionEnum::INVALID_OPERATION
  58. ,"Edge does not exist"
  59. ,"Getting IsEdgeInSpanningTree"));
  60. return gSubgraphOrderingGraph[eEdge].bIsSpanningTreeEdge;
  61. }
  62. void SubgraphOrderingGraphWrapper::setIsEdgeInSpanningTree(bool bIsSpannigTreeEdge, SubgraphOrderingGraphEdgeDescriptor eEdge, SubgraphOrderingGraphType &gSubgraphOrderingGraph)
  63. {
  64. LAYOUT_ASSERT(gSubgraphOrderingGraph.find_edge(eEdge).second == true,
  65. LayoutException(__FUNCTION__
  66. ,LayoutExceptionEnum::INVALID_OPERATION
  67. ,"Edge does not exist"
  68. ,"Getting IsEdgeInSpanningTree"));
  69. gSubgraphOrderingGraph[eEdge].bIsSpanningTreeEdge = bIsSpannigTreeEdge;
  70. }
  71. void SubgraphOrderingGraphWrapper::printGraph(SubgraphOrderingGraphType &gGraph)
  72. {
  73. QString sLine = "";
  74. BGL_FORALL_VERTICES(vVertex , gGraph , SubgraphOrderingGraphType)
  75. {
  76. sLine ="";
  77. sLine.append(QString::number((int)vVertex));
  78. sLine.append(" --> ");
  79. BGL_FORALL_ADJ(vVertex , vAdjVertex , gGraph , SubgraphOrderingGraphType)
  80. {
  81. sLine.append(QString::number((int)vAdjVertex));
  82. sLine.append(" ");
  83. }
  84. qDebug() << sLine;
  85. }
  86. }