diff --git a/YASI_12/YASI_12.vcxproj b/YASI_12/YASI_12.vcxproj index 89e2516..e1c21bf 100644 --- a/YASI_12/YASI_12.vcxproj +++ b/YASI_12/YASI_12.vcxproj @@ -84,6 +84,7 @@ + diff --git a/YASI_12/YASI_12.vcxproj.filters b/YASI_12/YASI_12.vcxproj.filters index 5d40c3d..5367086 100644 --- a/YASI_12/YASI_12.vcxproj.filters +++ b/YASI_12/YASI_12.vcxproj.filters @@ -31,6 +31,9 @@ {d2827f3c-736f-4f2a-891c-9fa2883e5685} + + {9d029d58-d806-4503-8f54-cc27d0b9332d} + @@ -128,5 +131,8 @@ Header Files\Dictionary + + Header Files\Graph + \ No newline at end of file diff --git a/YASI_12/ds.graph.h b/YASI_12/ds.graph.h new file mode 100644 index 0000000..a640dde --- /dev/null +++ b/YASI_12/ds.graph.h @@ -0,0 +1,49 @@ +#pragma once +#include "common.h" +#include "ds.doublylinkedlist.h" +using namespace std; + +namespace yasi{ +namespace ds{ + +// forward declarations +class VertexBase; +class EdgeBase; + +template +struct Edge{ + Element element; + V *pStart, *pEnd; +}; + +template +typedef DoublyLinkedList< E > EdgeList; + +template +struct Vertex{ +protected: + typedef Vertex self; + typedef Edge edge; +public: + typedef DoublyLinkedList< edge > EdgeList; + int id; + Element element; + EdgeList* pInEdges; + EdgeList* pOutEdges; +}; + +/// Adjacency list data structure +template +class Graph{ +public: + typedef Vertex VertexType; + typedef Edge EdgeType; + typedef DoublyLinkedList VertexList; + typedef DoublyLinkedList EdgeList; +protected: + VertexList* vertexList; + EdgeList* edgeList; +}; + +} +} \ No newline at end of file