@node The Full Feature Graph Class @section The Full Feature Graph Class @cindex Full Feature Graph Class This section describes what an imaginary full feature graph class knows. The set of features provided by a real graph implementation is typically a subset of the features below. On the other hand, each graph algorithm requires the underlying graph structure to provide a certain (typically small) set of features in order to be able to run. @subsection Declaration @deftp {Class} {class Graph} @code{Graph} is the imaginary @emph{full feature graph class}. @code{G} denotes the instance of this class in the exaples below. @c Each node and edge has a user defined data sturcure @c @var{N} and @var{E} statically attached to it. @end deftp @subsection Types @deftp {Type} Graph::NodeType @deftpx {Type} Graph::EdgeType The type of the data stored statically for each node and edge. @end deftp @anchor{Graph-NodeIterator} @deftp {Type} Graph::NodePoint @deftpx {Type} Graph::NodeIterator These types points a node uniquely. The difference between the @code{NodePoint} and the @code{NodeIterator} is that @code{NodePoint} requires the graph structure itself for most of the operations. For examples using iterators you can go through all nodes as follows. @quotation @verbatim Graph G; int nodenum=0; for(Graph::NodeIterator n(G);n.Valid();++n) ++nodenum; @end verbatim @end quotation Using @code{NodePoint} the last line looks like this. @quotation @verbatim for(MyGraph::NodePoint n(G);n.Valid();n=G.Next(n)) ++nodenum; @end verbatim @end quotation or @quotation @verbatim MyGraph::NodePoint n; for(G.GetFirst(n);G.Valid(n);G.GoNext(n)) ++nodenum; @end verbatim @end quotation @end deftp @deftp {Type} Graph::EdgePoint @deftpx {Type} Graph::InEdgePoint @deftpx {Type} Graph::OutEdgePoint @deftpx {Type} Graph::BiEdgePoint @deftpx {Type} Graph::SymEdgePoint Each of these types points an edge uniquely. The difference between the @code{EdgePoint} and the @c @mref{Graph-NodeIterator,@code{EdgeIterator}} @mref{Graph-NodeIterator , EdgeIterator} series is that @code{EdgePoint} requires the graph structure itself for most of the operations. @end deftp @anchor{Graph-EdgeIterator} @deftp {Type} Graph::EdgeIterator @deftpx {Type} Graph::InEdgeIterator @deftpx {Type} Graph::OutEdgeIterator @deftpx {Type} Graph::BiEdgeIterator @deftpx {Type} Graph::SymEdgeIterator @deftpx {Type} Graph::AllEdgeIterator Each of these types points an edge uniquely. The difference between the @code{EdgePoint} and the @code{EdgeIterator} series is that @code{EdgePoint} requires the graph structure itself for most of the operations. For the @code{EdgeIterator} types you can use operator @code{++} (both the prefix and the posfix one) to obtain the next edge. @end deftp @deftp {Type} Graph::NodeMap @deftpx {Type} Graph::EdgeMap There are the default property maps for the edges and the nodes. @end deftp @subsection Member Functions @subsubsection Constructors @deftypefun { } Graph::Graph () The default constructor. @end deftypefun @c @deftypefun { } Graph::Graph (Graph@tie{}&) @deftypefun { } Graph::Graph (Graph &) The copy constructor. Not yet implemented. @end deftypefun @subsubsection Graph Maintenence Operations @deftypefun NodeIterator Graph::AddNode () Adds a new node to the graph and returns a @code{NodeIterator} pointing to it. @end deftypefun @deftypefun EdgeIterator Graph::AddEdge (@w{const @mref{Graph-NodeIterator,NodeIterator} @var{from}}, @w{const @mref{Graph-NodeIterator,NodeIterator} @var{to}}) Adds a new edge with tail @var{from} and head @var{to} to the graph and returns an @code{EdgeIterator} pointing to it. @end deftypefun @deftypefun void Graph::Delete (@w{const @mref{Graph-NodeIterator,NodeIterator} @var{n}}) Deletes the node @var{n}. It also deletes the adjacent edges. @end deftypefun @deftypefun void Graph::Delete (@w{const @mref{Graph-EdgeIterator,EdgeIterator} @var{e}}) Deletes the edge @var{n}. @end deftypefun @deftypefun void Graph::Clean () Deletes all edges and nodes from the graph. @end deftypefun @deftypefun int Graph::NodeNum () Returns the number of the nodes in the graph. @end deftypefun @subsubsection NodePoint Operations @deftypefun NodePoint Graph::GetFirst (NodePoint &@var{n}) @deftypefunx NodePoint Graph::Next (const NodePoint @var{n}) @deftypefunx {NodePoint &} Graph::GoNext (NodePoint &@var{n}) The nodes in the graph forms a list. @code{GetFirst(n)} sets @var{n} to be the first node. @code{Next(n)} gives back the subsequent node. @code{Next(n)} is equivalent to @code{n=Next(n)}, though it might be faster. ??? What should be the return value ??? @end deftypefun @deftypefun bool Graph::Valid (NodePoint &@var{e}) @deftypefunx bool NodePoint::Valid () These functions check if and NodePoint is valid or not. ??? Which one should be implemented ??? @end deftypefun @subsubsection EdgePoint Operations @deftypefun AllEdgePoint Graph::GetFirst (const AllEdgePoint & @var{e}) @deftypefunx AllEdgePoint Graph::Next (const AllEdgePoint @var{n}) @deftypefunx {AllEdgePoint &} Graph::GoNext (AllEdgePoint &@var{n}) With these functions you can go though all the edges of the graph. ??? What should be the return value ??? @end deftypefun @deftypefun InEdgePoint Graph::GetFirst (const InEdgePoint & @var{e}, const NodePoint @var{n}) @deftypefunx OutEdgePoint Graph::GetFirst (const OutEdgePoint & @var{e}, const NodePoint @var{n}) @deftypefunx SymEdgePoint Graph::GetFirst (const SymEdgePoint & @var{e}, const NodePoint @var{n}) The edges leaving from, arriving at or adjacent with a node forms a list. These functions give back the first elements of these lists. The exact behavior depends on the type of @var{e}. If @var{e} is an @code{InEdgePoint} or an @code{OutEdgePoint} then @code{GetFirst} sets @var{e} to be the first incoming or outgoing edge of the node @var{n}, respectively. If @var{e} is a @code{SymEdgePoint} then @code{GetFirst} sets @var{e} to be the first incoming if there exists one otherwise the first outgoing edge. If there are no such edges, @var{e} will be invalid. @end deftypefun @deftypefun InEdgePoint Graph::Next (const InEdgePoint @var{e}) @deftypefunx OutEdgePoint Graph::Next (const OutEdgePoint @var{e}) @deftypefunx SymEdgePoint Graph::Next (const SymEdgePoint @var{e}) These functions give back the edge that follows @var{e} @end deftypefun @deftypefun {InEdgePoint &} Graph::GoNext (InEdgePoint &@var{e}) @deftypefunx {OutEdgePoint &} Graph::GoNext (OutEdgePoint &@var{e}) @deftypefunx {SymEdgePoint &} Graph::GoNext (SymEdgePoint &@var{e}) @code{G.GoNext(e)} is equivalent to @code{e=G.Next(e)}, though it might be faster. ??? What should be the return value ??? @end deftypefun @deftypefun bool Graph::Valid (EdgePoint &@var{e}) @deftypefunx bool EdgePoint::Valid () These functions check if and EdgePoint is valid or not. ??? Which one should be implemented ??? @end deftypefun @deftypefun NodePoint Graph::From (const EdgePoint @var{e}) @deftypefunx NodePoint Graph::To (const EdgePoint @var{e}) @deftypefunx NodePoint Graph::ANode (const InEdgePoint @var{e}) @deftypefunx NodePoint Graph::ANode (const OutEdgePoint @var{e}) @deftypefunx NodePoint Graph::ANode (const SymEdgePoint @var{e}) @deftypefunx NodePoint Graph::BNode (const InEdgePoint @var{e}) @deftypefunx NodePoint Graph::BNode (const OutEdgePoint @var{e}) @deftypefunx NodePoint Graph::BNode (const SymEdgePoint @var{e}) There queries give back the two endpoints of the edge @var{e}. For a directed edge @var{e}, @code{From(e)} and @code{To(e)} is its tail and its head, respectively. For an undirected @var{e}, they are two endpoints, but you should not rely on which end is which. @code{ANode(e)} is the node which @var{e} is bounded to, i.e. it is equal to @code{From(e)} if @var{e} is an @code{OutEdgePoint} and @code{To(e)} if @var{e} is an @code{InEdgePoint}. If @var{e} is a @code{SymEdgePoint} and it or its first preceding edge was created by @code{GetFirst(e,n)}, then @code{ANode(e)} is equal to @var{n}. @code{BNode(e)} is the other end of the edge. ???It it implemented in an other way now. (Member function <-> Graph global)??? @end deftypefun @c @deftypevar int from @c the tail of the created edge. @c @end deftypevar