cmake/Source/cmGraphAdjacencyList.h

42 lines
913 B
C
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmGraphAdjacencyList_h
#define cmGraphAdjacencyList_h
2017-07-20 19:35:53 +02:00
#include "cmConfigure.h" // IWYU pragma: keep
2016-10-30 18:24:19 +01:00
2017-04-14 19:02:05 +02:00
#include <vector>
2010-11-13 01:00:53 +02:00
/**
* Graph edge representation. Most use cases just need the
* destination vertex, so we support conversion to/from an int. We
* also store boolean to indicate whether an edge is "strong".
*/
class cmGraphEdge
{
public:
2017-07-20 19:35:53 +02:00
cmGraphEdge(int n = 0, bool s = true)
2016-07-09 11:21:54 +02:00
: Dest(n)
, Strong(s)
{
}
2010-11-13 01:00:53 +02:00
operator int() const { return this->Dest; }
bool IsStrong() const { return this->Strong; }
2018-08-09 18:06:22 +02:00
2010-11-13 01:00:53 +02:00
private:
int Dest;
bool Strong;
};
2016-07-09 11:21:54 +02:00
struct cmGraphEdgeList : public std::vector<cmGraphEdge>
{
};
struct cmGraphNodeList : public std::vector<int>
{
};
struct cmGraphAdjacencyList : public std::vector<cmGraphEdgeList>
{
};
#endif