src/work/peter/hierarchygraph.h
changeset 706 0fe42b8ec5a6
parent 690 a0f95e1b17fc
child 826 056fbb112b30
equal deleted inserted replaced
1:e2bdfd53a225 2:7db3aa3cd0f2
     7 
     7 
     8 #include <hugo/invalid.h>
     8 #include <hugo/invalid.h>
     9 #include <hugo/maps.h>
     9 #include <hugo/maps.h>
    10 
    10 
    11 /// The namespace of HugoLib
    11 /// The namespace of HugoLib
    12 namespace hugo {
    12 namespace hugo
       
    13 {
    13 
    14 
    14   // @defgroup empty_graph The HierarchyGraph class
    15   // @defgroup empty_graph The HierarchyGraph class
    15   // @{
    16   // @{
    16 
    17 
    17   /// A graph class in that a simple edge can represent a path.
    18   /// A graph class in that a simple edge can represent a path.
    19   /// This class provides common features of a graph structure
    20   /// This class provides common features of a graph structure
    20   /// that represents a network. You can handle with it layers. This
    21   /// that represents a network. You can handle with it layers. This
    21   /// means that a node in one layer can be a complete network in a nother
    22   /// means that a node in one layer can be a complete network in a nother
    22   /// layer.
    23   /// layer.
    23 
    24 
    24   template <class Gact, class Gsub>
    25   template < class Gact, class Gsub > class HierarchyGraph
    25   class HierarchyGraph
       
    26   {
    26   {
    27 
    27 
    28   public:
    28   public:
    29 
    29 
    30     /// The actual layer
    30     /// The actual layer
    37     class SubNetwork
    37     class SubNetwork
    38     {
    38     {
    39 
    39 
    40       struct actedgesubnodestruct
    40       struct actedgesubnodestruct
    41       {
    41       {
    42         typename Gact::Edge actedge;
    42 	typename Gact::Edge actedge;
    43         typename Gsub::Node subnode;
    43 	typename Gsub::Node subnode;
    44       };
    44       };
    45 
    45 
    46       int edgenumber;
    46       int edgenumber;
    47       bool connectable;
    47       bool connectable;
    48       Gact * actuallayer;
    48       Gact *actuallayer;
    49       typename Gact::Node * actuallayernode;
    49       typename Gact::Node * actuallayernode;
    50       Gsub * subnetwork;
    50       Gsub *subnetwork;
    51       actedgesubnodestruct * assignments;
    51       actedgesubnodestruct *assignments;
    52 
    52 
    53     public:
    53     public:
    54 
    54 
    55       int addAssignment(typename Gact::Edge actedge, typename Gsub::Node subnode)
    55       int addAssignment (typename Gact::Edge actedge,
    56       {
    56 			 typename Gsub::Node subnode)
    57 	if(!(actuallayer->valid(actedge)))
    57       {
    58 	{
    58 	if (!(actuallayer->valid (actedge)))
    59 	  cerr << "The given edge is not in the given network!" << endl;
    59 	  {
    60 	  return -1;
    60 	    cerr << "The given edge is not in the given network!" << endl;
    61 	}
    61 	    return -1;
    62 	else if(
    62 	  }
    63 	   (actuallayer->id(actuallayer->tail(actedge))!=actuallayer->id(*actuallayernode))
    63 	else if ((actuallayer->id (actuallayer->tail (actedge)) !=
    64 	   &&
    64 		  actuallayer->id (*actuallayernode))
    65 	   (actuallayer->id(actuallayer->head(actedge))!=actuallayer->id(*actuallayernode))
    65 		 && (actuallayer->id (actuallayer->head (actedge)) !=
    66 	  )
    66 		     actuallayer->id (*actuallayernode)))
    67 	{
    67 	  {
    68 	  cerr << "The given edge does not connect to the given node!" << endl;
    68 	    cerr << "The given edge does not connect to the given node!" <<
    69 	  return -1;
    69 	      endl;
    70 	}
    70 	    return -1;
    71 
    71 	  }
    72 	if(!(subnetwork->valid(subnode)))
    72 
    73 	{
    73 	if (!(subnetwork->valid (subnode)))
    74 	  cerr << "The given node is not in the given network!" << endl;
    74 	  {
    75 	  return -1;
    75 	    cerr << "The given node is not in the given network!" << endl;
    76 	}
    76 	    return -1;
    77 
    77 	  }
    78 	int i=0;
    78 
       
    79 	int i = 0;
    79 	//while in the array there is valid note that is not equvivalent with the one that would be noted increase i
    80 	//while in the array there is valid note that is not equvivalent with the one that would be noted increase i
    80 	while( (i<edgenumber) && (actuallayer->valid(assignments[i].actedge) ) && (assignments[i].actedge!=actedge) ) i++;
    81 	while ((i < edgenumber)
    81 	if(assignments[i].actedge==actedge)
    82 	       && (actuallayer->valid (assignments[i].actedge))
    82 	{
    83 	       && (assignments[i].actedge != actedge))
    83 	  cout << "Warning: Redefinement of assigment!!!" << endl;
    84 	  i++;
    84 	}
    85 	if (assignments[i].actedge == actedge)
    85 	if(i==edgenumber)
    86 	  {
    86 	{
    87 	    cout << "Warning: Redefinement of assigment!!!" << endl;
    87 	  cout << "This case can't be!!! (because there should be the guven edge in the array already and the cycle had to stop)" << endl;
    88 	  }
    88 	}
    89 	if (i == edgenumber)
       
    90 	  {
       
    91 	    cout <<
       
    92 	      "This case can't be!!! (because there should be the guven edge in the array already and the cycle had to stop)"
       
    93 	      << endl;
       
    94 	  }
    89 	//if(!(actuallayer->valid(assignments[i].actedge)))   //this condition is necessary if we do not obey redefinition
    95 	//if(!(actuallayer->valid(assignments[i].actedge)))   //this condition is necessary if we do not obey redefinition
    90 	{
    96 	{
    91 	  assignments[i].actedge=actedge;
    97 	  assignments[i].actedge = actedge;
    92 	  assignments[i].subnode=subnode;
    98 	  assignments[i].subnode = subnode;
    93 	}
    99 	}
    94 
   100 
    95 	/// If to all of the edges a subnode is assigned then the subnetwork is connectable (attachable?)
   101 	/// If to all of the edges a subnode is assigned then the subnetwork is connectable (attachable?)
    96 	/// We do not need to check for further attributes, because to notice an assignment we need
   102 	/// We do not need to check for further attributes, because to notice an assignment we need
    97 	/// all of them to be correctly initialised before.
   103 	/// all of them to be correctly initialised before.
    98 	if(i==edgenumber-1)connectable=1;
   104 	if (i == edgenumber - 1)
       
   105 	  connectable = 1;
    99 
   106 
   100 	return 0;
   107 	return 0;
   101       }
   108       }
   102 
   109 
   103       int setSubNetwork(Gsub * sn)
   110       int setSubNetwork (Gsub * sn)
   104       {
   111       {
   105 	subnetwork=sn;
   112 	subnetwork = sn;
   106 	return 0;
   113 	return 0;
   107       }
   114       }
   108 
   115 
   109       int setActualLayer(Gact * al)
   116       int setActualLayer (Gact * al)
   110       {
   117       {
   111 	actuallayer=al;
   118 	actuallayer = al;
   112 	return 0;
   119 	return 0;
   113       }
   120       }
   114 
   121 
   115       int setActualLayerNode(typename Gact::Node * aln)
   122       int setActualLayerNode (typename Gact::Node * aln)
   116       {
   123       {
   117 	typename Gact::InEdgeIt iei;
   124 	typename Gact::InEdgeIt iei;
   118 	typename Gact::OutEdgeIt oei;
   125 	typename Gact::OutEdgeIt oei;
   119 
   126 
   120 	actuallayernode=aln;
   127 	actuallayernode = aln;
   121 
   128 
   122 	edgenumber=0;
   129 	edgenumber = 0;
   123 
   130 
   124 	if(actuallayer)
   131 	if (actuallayer)
   125 	{
   132 	  {
   126 	  for(iei=actuallayer->first(iei,(*actuallayernode));((actuallayer->valid(iei))&&(actuallayer->head(iei)==(*actuallayernode)));actuallayer->next(iei))
   133 	    for (iei = actuallayer->first (iei, (*actuallayernode));
   127 	  {
   134 		 ((actuallayer->valid (iei))
   128 	    cout << actuallayer->id(actuallayer->tail(iei)) << " " << actuallayer->id(actuallayer->head(iei)) << endl;
   135 		  && (actuallayer->head (iei) == (*actuallayernode)));
   129 	    edgenumber++;
   136 		 actuallayer->next (iei))
   130 	  }
   137 	      {
   131 	  //cout << "Number of in-edges: " << edgenumber << endl;
   138 		cout << actuallayer->id (actuallayer->
   132 	  for(oei=actuallayer->first(oei,(*actuallayernode));((actuallayer->valid(oei))&&(actuallayer->tail(oei)==(*actuallayernode)));actuallayer->next(oei))
   139 					 tail (iei)) << " " << actuallayer->
   133 	  {
   140 		  id (actuallayer->head (iei)) << endl;
   134 	    cout << actuallayer->id(actuallayer->tail(oei)) << " " << actuallayer->id(actuallayer->head(oei)) << endl;
   141 		edgenumber++;
   135 	    edgenumber++;
   142 	      }
   136 	  }
   143 	    //cout << "Number of in-edges: " << edgenumber << endl;
   137 	  //cout << "Number of in+out-edges: " << edgenumber << endl;
   144 	    for (oei = actuallayer->first (oei, (*actuallayernode));
   138 	  assignments=new actedgesubnodestruct[edgenumber];
   145 		 ((actuallayer->valid (oei))
   139 	  for(int i=0;i<edgenumber;i++)
   146 		  && (actuallayer->tail (oei) == (*actuallayernode)));
   140 	  {
   147 		 actuallayer->next (oei))
   141 	    assignments[i].actedge=INVALID;
   148 	      {
   142 	    assignments[i].subnode=INVALID;
   149 		cout << actuallayer->id (actuallayer->
   143 	  }
   150 					 tail (oei)) << " " << actuallayer->
   144 	}
   151 		  id (actuallayer->head (oei)) << endl;
       
   152 		edgenumber++;
       
   153 	      }
       
   154 	    //cout << "Number of in+out-edges: " << edgenumber << endl;
       
   155 	    assignments = new actedgesubnodestruct[edgenumber];
       
   156 	    for (int i = 0; i < edgenumber; i++)
       
   157 	      {
       
   158 		assignments[i].actedge = INVALID;
       
   159 		assignments[i].subnode = INVALID;
       
   160 	      }
       
   161 	  }
   145 	else
   162 	else
   146 	{
   163 	  {
   147 	  cerr << "There is no actual layer defined yet!" << endl;
   164 	    cerr << "There is no actual layer defined yet!" << endl;
   148 	  return -1;
   165 	    return -1;
   149 	}
   166 	  }
   150 
   167 
   151 	return 0;
   168 	return 0;
   152       }
   169       }
   153 
   170 
   154       SubNetwork(): edgenumber(0), connectable(false), actuallayer(NULL), actuallayernode(NULL), subnetwork(NULL), assignments(NULL)
   171     SubNetwork ():edgenumber (0), connectable (false), actuallayer (NULL),
       
   172 	actuallayernode (NULL), subnetwork (NULL),
       
   173 	assignments (NULL)
   155       {
   174       {
   156       }
   175       }
   157 
   176 
   158     };
   177     };
   159 
   178 
   160     typename Gact::template NodeMap< SubNetwork > subnetworks;
   179     typename Gact::template NodeMap < SubNetwork > subnetworks;
   161 
   180 
   162 
   181 
   163     /// Defalult constructor.
   182     /// Defalult constructor.
   164     /// We don't need any extra lines, because the actuallayer
   183     /// We don't need any extra lines, because the actuallayer
   165     /// variable has run its constructor, when we have created this class
   184     /// variable has run its constructor, when we have created this class
   166     /// So only the two maps has to be initialised here.
   185     /// So only the two maps has to be initialised here.
   167     HierarchyGraph() : subnetworks(actuallayer)
   186   HierarchyGraph ():subnetworks (actuallayer)
   168     {
   187     {
   169     }
   188     }
   170 
   189 
   171 
   190 
   172     ///Copy consructor.
   191     ///Copy consructor.
   173     HierarchyGraph(const HierarchyGraph<Gact, Gsub> & HG ) : actuallayer(HG.actuallayer), subnetworks(actuallayer)
   192   HierarchyGraph (const HierarchyGraph < Gact, Gsub > &HG):actuallayer (HG.actuallayer),
       
   193       subnetworks
       
   194       (actuallayer)
   174     {
   195     {
   175     }
   196     }
   176 
   197 
   177 
   198 
   178     /// The base type of the node iterators.
   199     /// The base type of the node iterators.
   195     typedef typename Gact::NodeIt NodeIt;
   216     typedef typename Gact::NodeIt NodeIt;
   196 
   217 
   197 
   218 
   198     /// The base type of the edge iterators.
   219     /// The base type of the edge iterators.
   199     /// The Edge type of the HierarchyGraph is the Edge type of the actual layer.
   220     /// The Edge type of the HierarchyGraph is the Edge type of the actual layer.
   200     typedef typename  Gact::Edge Edge;
   221     typedef typename Gact::Edge Edge;
   201 
   222 
   202 
   223 
   203     /// This iterator goes trough the outgoing edges of a node.
   224     /// This iterator goes trough the outgoing edges of a node.
   204 
   225 
   205     /// This iterator goes trough the \e outgoing edges of a certain node
   226     /// This iterator goes trough the \e outgoing edges of a certain node
   245 
   266 
   246     /// First node of the graph.
   267     /// First node of the graph.
   247 
   268 
   248     /// \retval i the first node.
   269     /// \retval i the first node.
   249     /// \return the first node.
   270     /// \return the first node.
   250     typename Gact::NodeIt &first(typename Gact::NodeIt &i) const { return actuallayer.first(i);}
   271     typename Gact::NodeIt & first (typename Gact::NodeIt & i) const
       
   272     {
       
   273       return actuallayer.first (i);
       
   274     }
   251 
   275 
   252 
   276 
   253     /// The first incoming edge.
   277     /// The first incoming edge.
   254     typename Gact::InEdgeIt &first(typename Gact::InEdgeIt &i, typename Gact::Node) const { return actuallayer.first(i);}
   278     typename Gact::InEdgeIt & first (typename Gact::InEdgeIt & i,
       
   279 				     typename Gact::Node) const
       
   280     {
       
   281       return actuallayer.first (i);
       
   282     }
   255 
   283 
   256 
   284 
   257     /// The first outgoing edge.
   285     /// The first outgoing edge.
   258     typename Gact::OutEdgeIt &first(typename Gact::OutEdgeIt &i, typename Gact::Node) const { return actuallayer.first(i);}
   286     typename Gact::OutEdgeIt & first (typename Gact::OutEdgeIt & i,
       
   287 				      typename Gact::Node) const
       
   288     {
       
   289       return actuallayer.first (i);
       
   290     }
   259 
   291 
   260 
   292 
   261     //  SymEdgeIt &first(SymEdgeIt &, Node) const { return i;}
   293     //  SymEdgeIt &first(SymEdgeIt &, Node) const { return i;}
   262     /// The first edge of the Graph.
   294     /// The first edge of the Graph.
   263     typename Gact::EdgeIt &first(typename Gact::EdgeIt &i) const { return actuallayer.first(i);}
   295     typename Gact::EdgeIt & first (typename Gact::EdgeIt & i) const
       
   296     {
       
   297       return actuallayer.first (i);
       
   298     }
   264 
   299 
   265 
   300 
   266 //     Node getNext(Node) const {}
   301 //     Node getNext(Node) const {}
   267 //     InEdgeIt getNext(InEdgeIt) const {}
   302 //     InEdgeIt getNext(InEdgeIt) const {}
   268 //     OutEdgeIt getNext(OutEdgeIt) const {}
   303 //     OutEdgeIt getNext(OutEdgeIt) const {}
   269 //     //SymEdgeIt getNext(SymEdgeIt) const {}
   304 //     //SymEdgeIt getNext(SymEdgeIt) const {}
   270 //     EdgeIt getNext(EdgeIt) const {}
   305 //     EdgeIt getNext(EdgeIt) const {}
   271 
   306 
   272 
   307 
   273     /// Go to the next node.
   308     /// Go to the next node.
   274     typename Gact::NodeIt &next(typename Gact::NodeIt &i) const { return actuallayer.next(i);}
   309     typename Gact::NodeIt & next (typename Gact::NodeIt & i) const
       
   310     {
       
   311       return actuallayer.next (i);
       
   312     }
   275     /// Go to the next incoming edge.
   313     /// Go to the next incoming edge.
   276     typename Gact::InEdgeIt &next(typename Gact::InEdgeIt &i) const { return actuallayer.next(i);}
   314     typename Gact::InEdgeIt & next (typename Gact::InEdgeIt & i) const
       
   315     {
       
   316       return actuallayer.next (i);
       
   317     }
   277     /// Go to the next outgoing edge.
   318     /// Go to the next outgoing edge.
   278     typename Gact::OutEdgeIt &next(typename Gact::OutEdgeIt &i) const { return actuallayer.next(i);}
   319     typename Gact::OutEdgeIt & next (typename Gact::OutEdgeIt & i) const
       
   320     {
       
   321       return actuallayer.next (i);
       
   322     }
   279     //SymEdgeIt &next(SymEdgeIt &) const {}
   323     //SymEdgeIt &next(SymEdgeIt &) const {}
   280     /// Go to the next edge.
   324     /// Go to the next edge.
   281     typename Gact::EdgeIt &next(typename Gact::EdgeIt &i) const { return actuallayer.next(i);}
   325     typename Gact::EdgeIt & next (typename Gact::EdgeIt & i) const
       
   326     {
       
   327       return actuallayer.next (i);
       
   328     }
   282 
   329 
   283     ///Gives back the head node of an edge.
   330     ///Gives back the head node of an edge.
   284     typename Gact::Node head(typename Gact::Edge edge) const { return actuallayer.head(edge); }
   331     typename Gact::Node head (typename Gact::Edge edge) const
       
   332     {
       
   333       return actuallayer.head (edge);
       
   334     }
   285     ///Gives back the tail node of an edge.
   335     ///Gives back the tail node of an edge.
   286     typename Gact::Node tail(typename Gact::Edge edge) const { return actuallayer.tail(edge); }
   336     typename Gact::Node tail (typename Gact::Edge edge) const
       
   337     {
       
   338       return actuallayer.tail (edge);
       
   339     }
   287 
   340 
   288     //   Node aNode(InEdgeIt) const {}
   341     //   Node aNode(InEdgeIt) const {}
   289     //   Node aNode(OutEdgeIt) const {}
   342     //   Node aNode(OutEdgeIt) const {}
   290     //   Node aNode(SymEdgeIt) const {}
   343     //   Node aNode(SymEdgeIt) const {}
   291 
   344 
   295 
   348 
   296     /// Checks if a node iterator is valid
   349     /// Checks if a node iterator is valid
   297 
   350 
   298     ///\todo Maybe, it would be better if iterator converted to
   351     ///\todo Maybe, it would be better if iterator converted to
   299     ///bool directly, as Jacint prefers.
   352     ///bool directly, as Jacint prefers.
   300     bool valid(const typename Gact::Node& node) const { return actuallayer.valid(node);}
   353     bool valid (const typename Gact::Node & node) const
       
   354     {
       
   355       return actuallayer.valid (node);
       
   356     }
   301     /// Checks if an edge iterator is valid
   357     /// Checks if an edge iterator is valid
   302 
   358 
   303     ///\todo Maybe, it would be better if iterator converted to
   359     ///\todo Maybe, it would be better if iterator converted to
   304     ///bool directly, as Jacint prefers.
   360     ///bool directly, as Jacint prefers.
   305     bool valid(const typename Gact::Edge& edge) const { return actuallayer.valid(edge);}
   361     bool valid (const typename Gact::Edge & edge) const
       
   362     {
       
   363       return actuallayer.valid (edge);
       
   364     }
   306 
   365 
   307     ///Gives back the \e id of a node.
   366     ///Gives back the \e id of a node.
   308 
   367 
   309     ///\warning Not all graph structures provide this feature.
   368     ///\warning Not all graph structures provide this feature.
   310     ///
   369     ///
   311     int id(const typename Gact::Node & node) const { return actuallayer.id(node);}
   370     int id (const typename Gact::Node & node) const
       
   371     {
       
   372       return actuallayer.id (node);
       
   373     }
   312     ///Gives back the \e id of an edge.
   374     ///Gives back the \e id of an edge.
   313 
   375 
   314     ///\warning Not all graph structures provide this feature.
   376     ///\warning Not all graph structures provide this feature.
   315     ///
   377     ///
   316     int id(const typename Gact::Edge & edge) const { return actuallayer.id(edge);}
   378     int id (const typename Gact::Edge & edge) const
       
   379     {
       
   380       return actuallayer.id (edge);
       
   381     }
   317 
   382 
   318     //void setInvalid(Node &) const {};
   383     //void setInvalid(Node &) const {};
   319     //void setInvalid(Edge &) const {};
   384     //void setInvalid(Edge &) const {};
   320 
   385 
   321     ///Add a new node to the graph.
   386     ///Add a new node to the graph.
   322 
   387 
   323     /// \return the new node.
   388     /// \return the new node.
   324     ///
   389     ///
   325     typename Gact::Node addNode() { return actuallayer.addNode();}
   390     typename Gact::Node addNode ()
       
   391     {
       
   392       return actuallayer.addNode ();
       
   393     }
   326     ///Add a new edge to the graph.
   394     ///Add a new edge to the graph.
   327 
   395 
   328     ///Add a new edge to the graph with tail node \c tail
   396     ///Add a new edge to the graph with tail node \c tail
   329     ///and head node \c head.
   397     ///and head node \c head.
   330     ///\return the new edge.
   398     ///\return the new edge.
   331     typename Gact::Edge addEdge(typename Gact::Node node1, typename Gact::Node node2) { return actuallayer.addEdge(node1, node2);}
   399     typename Gact::Edge addEdge (typename Gact::Node node1,
       
   400 				 typename Gact::Node node2)
       
   401     {
       
   402       return actuallayer.addEdge (node1, node2);
       
   403     }
   332 
   404 
   333     /// Resets the graph.
   405     /// Resets the graph.
   334 
   406 
   335     /// This function deletes all edges and nodes of the graph.
   407     /// This function deletes all edges and nodes of the graph.
   336     /// It also frees the memory allocated to store them.
   408     /// It also frees the memory allocated to store them.
   337     void clear() {actuallayer.clear();}
   409     void clear ()
   338 
   410     {
   339     int nodeNum() const { return actuallayer.nodeNum();}
   411       actuallayer.clear ();
   340     int edgeNum() const { return actuallayer.edgeNum();}
   412     }
       
   413 
       
   414     int nodeNum () const
       
   415     {
       
   416       return actuallayer.nodeNum ();
       
   417     }
       
   418     int edgeNum () const
       
   419     {
       
   420       return actuallayer.edgeNum ();
       
   421     }
   341 
   422 
   342     ///Read/write/reference map of the nodes to type \c T.
   423     ///Read/write/reference map of the nodes to type \c T.
   343 
   424 
   344     ///Read/write/reference map of the nodes to type \c T.
   425     ///Read/write/reference map of the nodes to type \c T.
   345     /// \sa MemoryMapSkeleton
   426     /// \sa MemoryMapSkeleton
   347     /// \todo We may need conversion from other nodetype
   428     /// \todo We may need conversion from other nodetype
   348     /// \todo We may need operator=
   429     /// \todo We may need operator=
   349     /// \warning Making maps that can handle bool type (NodeMap<bool>)
   430     /// \warning Making maps that can handle bool type (NodeMap<bool>)
   350     /// needs extra attention!
   431     /// needs extra attention!
   351 
   432 
   352     template<class T> class NodeMap
   433     template < class T > class NodeMap
   353     {
   434     {
   354     public:
   435     public:
   355       typedef T ValueType;
   436       typedef T ValueType;
   356       typedef Node KeyType;
   437       typedef Node KeyType;
   357 
   438 
   358       NodeMap(const HierarchyGraph &) {}
   439       NodeMap (const HierarchyGraph &)
   359       NodeMap(const HierarchyGraph &, T) {}
   440       {
   360 
   441       }
   361       template<typename TT> NodeMap(const NodeMap<TT> &) {}
   442       NodeMap (const HierarchyGraph &, T)
       
   443       {
       
   444       }
       
   445 
       
   446       template < typename TT > NodeMap (const NodeMap < TT > &)
       
   447       {
       
   448       }
   362 
   449 
   363       /// Sets the value of a node.
   450       /// Sets the value of a node.
   364 
   451 
   365       /// Sets the value associated with node \c i to the value \c t.
   452       /// Sets the value associated with node \c i to the value \c t.
   366       ///
   453       ///
   367       void set(Node, T) {}
   454       void set (Node, T)
       
   455       {
       
   456       }
   368       // Gets the value of a node.
   457       // Gets the value of a node.
   369       //T get(Node i) const {return *(T*)0;}  //FIXME: Is it necessary?
   458       //T get(Node i) const {return *(T*)0;}  //FIXME: Is it necessary?
   370       T &operator[](Node) {return *(T*)0;}
   459       T & operator[](Node)
   371       const T &operator[](Node) const {return *(T*)0;}
   460       {
       
   461 	return *(T *) 0;
       
   462       }
       
   463       const T & operator[] (Node) const
       
   464       {
       
   465 	return *(T *) 0;
       
   466       }
   372 
   467 
   373       /// Updates the map if the graph has been changed
   468       /// Updates the map if the graph has been changed
   374 
   469 
   375       /// \todo Do we need this?
   470       /// \todo Do we need this?
   376       ///
   471       ///
   377       void update() {}
   472       void update ()
   378       void update(T a) {}   //FIXME: Is it necessary
   473       {
       
   474       }
       
   475       void update (T a)
       
   476       {
       
   477       }				//FIXME: Is it necessary
   379     };
   478     };
   380 
   479 
   381     ///Read/write/reference map of the edges to type \c T.
   480     ///Read/write/reference map of the edges to type \c T.
   382 
   481 
   383     ///Read/write/reference map of the edges to type \c T.
   482     ///Read/write/reference map of the edges to type \c T.
   385     /// \sa NodeMap
   484     /// \sa NodeMap
   386     /// \sa MemoryMapSkeleton
   485     /// \sa MemoryMapSkeleton
   387     /// \todo We may need copy constructor
   486     /// \todo We may need copy constructor
   388     /// \todo We may need conversion from other edgetype
   487     /// \todo We may need conversion from other edgetype
   389     /// \todo We may need operator=
   488     /// \todo We may need operator=
   390     template<class T> class EdgeMap
   489     template < class T > class EdgeMap
   391     {
   490     {
   392     public:
   491     public:
   393       typedef T ValueType;
   492       typedef T ValueType;
   394       typedef Edge KeyType;
   493       typedef Edge KeyType;
   395 
   494 
   396       EdgeMap(const HierarchyGraph &) {}
   495       EdgeMap (const HierarchyGraph &)
   397       EdgeMap(const HierarchyGraph &, T ) {}
   496       {
       
   497       }
       
   498       EdgeMap (const HierarchyGraph &, T)
       
   499       {
       
   500       }
   398 
   501 
   399       ///\todo It can copy between different types.
   502       ///\todo It can copy between different types.
   400       ///
   503       ///
   401       template<typename TT> EdgeMap(const EdgeMap<TT> &) {}
   504       template < typename TT > EdgeMap (const EdgeMap < TT > &)
   402 
   505       {
   403       void set(Edge, T) {}
   506       }
       
   507 
       
   508       void set (Edge, T)
       
   509       {
       
   510       }
   404       //T get(Edge) const {return *(T*)0;}
   511       //T get(Edge) const {return *(T*)0;}
   405       T &operator[](Edge) {return *(T*)0;}
   512       T & operator[](Edge)
   406       const T &operator[](Edge) const {return *(T*)0;}
   513       {
   407 
   514 	return *(T *) 0;
   408       void update() {}
   515       }
   409       void update(T a) {}   //FIXME: Is it necessary
   516       const T & operator[] (Edge) const
       
   517       {
       
   518 	return *(T *) 0;
       
   519       }
       
   520 
       
   521       void update ()
       
   522       {
       
   523       }
       
   524       void update (T a)
       
   525       {
       
   526       }				//FIXME: Is it necessary
   410     };
   527     };
   411   };
   528   };
   412 
   529 
   413   /// An empty eraseable graph class.
   530   /// An empty eraseable graph class.
   414 
   531 
   427   ///
   544   ///
   428   /// Also, you will find here the full documentation of a certain graph
   545   /// Also, you will find here the full documentation of a certain graph
   429   /// feature, the documentation of a real graph imlementation
   546   /// feature, the documentation of a real graph imlementation
   430   /// like @ref ListGraph or
   547   /// like @ref ListGraph or
   431   /// @ref SmartGraph will just refer to this structure.
   548   /// @ref SmartGraph will just refer to this structure.
   432   template <typename Gact, typename Gsub>
   549 template < typename Gact, typename Gsub > class EraseableHierarchyGraph:public HierarchyGraph < Gact,
   433   class EraseableHierarchyGraph : public HierarchyGraph<Gact, Gsub>
   550     Gsub
       
   551     >
   434   {
   552   {
   435   public:
   553   public:
   436     /// Deletes a node.
   554     /// Deletes a node.
   437     void erase(typename Gact::Node n) {actuallayer.erase(n);}
   555     void erase (typename Gact::Node n)
       
   556     {
       
   557       actuallayer.erase (n);
       
   558     }
   438     /// Deletes an edge.
   559     /// Deletes an edge.
   439     void erase(typename Gact::Edge e) {actuallayer.erase(e);}
   560     void erase (typename Gact::Edge e)
       
   561     {
       
   562       actuallayer.erase (e);
       
   563     }
   440 
   564 
   441     /// Defalult constructor.
   565     /// Defalult constructor.
   442     EraseableHierarchyGraph() {}
   566     EraseableHierarchyGraph ()
       
   567     {
       
   568     }
   443     ///Copy consructor.
   569     ///Copy consructor.
   444     EraseableHierarchyGraph(const HierarchyGraph<Gact, Gsub> &EPG) {}
   570     EraseableHierarchyGraph (const HierarchyGraph < Gact, Gsub > &EPG)
       
   571     {
       
   572     }
   445   };
   573   };
   446 
   574 
   447 
   575 
   448   // @}
   576   // @}
   449 
   577 
   450 } //namespace hugo
   578 }				//namespace hugo
   451 
   579 
   452 
   580 
   453 #endif // HUGO_SKELETON_GRAPH_H
   581 #endif // HUGO_SKELETON_GRAPH_H