cmGraphAdjacencyList.h 912 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmGraphAdjacencyList_h
  4. #define cmGraphAdjacencyList_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <vector>
  7. /**
  8. * Graph edge representation. Most use cases just need the
  9. * destination vertex, so we support conversion to/from an int. We
  10. * also store boolean to indicate whether an edge is "strong".
  11. */
  12. class cmGraphEdge
  13. {
  14. public:
  15. cmGraphEdge(int n = 0, bool s = true)
  16. : Dest(n)
  17. , Strong(s)
  18. {
  19. }
  20. operator int() const { return this->Dest; }
  21. bool IsStrong() const { return this->Strong; }
  22. private:
  23. int Dest;
  24. bool Strong;
  25. };
  26. struct cmGraphEdgeList : public std::vector<cmGraphEdge>
  27. {
  28. };
  29. struct cmGraphNodeList : public std::vector<int>
  30. {
  31. };
  32. struct cmGraphAdjacencyList : public std::vector<cmGraphEdgeList>
  33. {
  34. };
  35. #endif