1 #ifndef __CPEXTENSIONS__DATASTRUCTURES__GRAPH__H__
2 #define __CPEXTENSIONS__DATASTRUCTURES__GRAPH__H__
7 #include <itkLightObject.h>
8 #include <itkObjectFactory.h>
10 namespace cpExtensions
12 namespace DataStructures
16 template< class V, class C, class I = unsigned long >
18 : public itk::LightObject
22 typedef itk::LightObject Superclass;
23 typedef itk::SmartPointer< Self > Pointer;
24 typedef itk::SmartPointer< const Self > ConstPointer;
31 typedef std::map< I, V > TVertices;
32 typedef std::vector< C > TEdges;
33 typedef std::map< I, TEdges > TMatrixRow;
34 typedef std::map< I, TMatrixRow > TMatrix;
38 itkTypeMacro( Graph, itk::LightObject );
41 typename TVertices::iterator BeginVertices( );
42 typename TVertices::iterator EndVertices( );
43 typename TVertices::const_iterator BeginVertices( ) const;
44 typename TVertices::const_iterator EndVertices( ) const;
46 typename TMatrix::iterator BeginEdgesRows( );
47 typename TMatrix::iterator EndEdgetsRows( );
48 typename TMatrix::const_iterator BeginEdgesRows( ) const;
49 typename TMatrix::const_iterator EndEdgesRows( ) const;
53 bool HasVertexIndex( const I& index ) const;
54 void InsertVertex( const I& index, V& vertex );
55 V& GetVertex( const I& index );
56 const V& GetVertex( const I& index ) const;
58 void AddConnection( const I& orig, const I& dest, const C& cost );
60 std::set< I > GetSinks( ) const;
67 // Purposely not implemented
68 Graph( const Self& other );
69 Self& operator=( const Self& other );
80 #ifndef ITK_MANUAL_INSTANTIATION
81 #include <cpExtensions/DataStructures/Graph.hxx>
82 #endif // ITK_MANUAL_INSTANTIATION
84 #endif // __CPEXTENSIONS__DATASTRUCTURES__GRAPH__H__