diff -r 182d3a4d7ddb -r 65144c52969c src/hugo/list_graph.h --- a/src/hugo/list_graph.h Tue Sep 07 07:09:53 2004 +0000 +++ b/src/hugo/list_graph.h Tue Sep 07 10:35:31 2004 +0000 @@ -93,22 +93,28 @@ first_free_node(_g.first_free_node), edges(_g.edges), first_free_edge(_g.first_free_edge) {} - int nodeNum() const { return nodes.size(); } //FIXME: What is this? - int edgeNum() const { return edges.size(); } //FIXME: What is this? + ///Number of nodes. + int nodeNum() const { return nodes.size(); } + ///Number of edges. + int edgeNum() const { return edges.size(); } - ///Set the expected number of edges + ///Set the expected maximum number of edges. ///With this function, it is possible to set the expected number of edges. ///The use of this fasten the building of the graph and makes ///it possible to avoid the superfluous memory allocation. void reserveEdge(int n) { edges.reserve(n); }; - ///\bug This function does something different than - ///its name would suggests... - int maxNodeId() const { return nodes.size(); } //FIXME: What is this? - ///\bug This function does something different than - ///its name would suggests... - int maxEdgeId() const { return edges.size(); } //FIXME: What is this? + /// Maximum node ID. + + /// Maximum node ID. + ///\sa id(Node) + int maxNodeId() const { return nodes.size()-1; } + /// Maximum edge ID. + + /// Maximum edge ID. + ///\sa id(Edge) + int maxEdgeId() const { return edges.size()-1; } Node tail(Edge e) const { return edges[e.n].tail; } Node head(Edge e) const { return edges[e.n].head; } @@ -122,12 +128,28 @@ InEdgeIt& first(InEdgeIt& e, const Node v) const { e=InEdgeIt(*this,v); return e; } + /// Node ID. + + /// The ID of a valid Node is a nonnegative integer not greater than + /// \ref maxNodeId(). The range of the ID's is not surely continuous + /// and the greatest node ID can be actually less then \ref maxNodeId(). + /// + /// The ID of the \ref INVALID node is -1. + ///\return The ID of the node \c v. static int id(Node v) { return v.n; } + /// Edge ID. + + /// The ID of a valid Edge is a nonnegative integer not greater than + /// \ref maxEdgeId(). The range of the ID's is not surely continuous + /// and the greatest edge ID can be actually less then \ref maxEdgeId(). + /// + /// The ID of the \ref INVALID edge is -1. + ///\return The ID of the edge \c e. static int id(Edge e) { return e.n; } /// Adds a new node to the graph. - /// \todo It adds the nodes in a reversed order. + /// \warning It adds the new node to the front of the list. /// (i.e. the lastly added node becomes the first.) Node addNode() { int n; @@ -520,15 +542,21 @@ : nodes(_g.nodes), first_node(_g.first_node), first_free_node(_g.first_free_node) {} - int nodeNum() const { return nodes.size(); } //FIXME: What is this? - int edgeNum() const { return 0; } //FIXME: What is this? + ///Number of nodes. + int nodeNum() const { return nodes.size(); } + ///Number of edges. + int edgeNum() const { return 0; } - ///\bug This function does something different than - ///its name would suggests... - int maxNodeId() const { return nodes.size(); } //FIXME: What is this? - ///\bug This function does something different than - ///its name would suggests... - int maxEdgeId() const { return 0; } //FIXME: What is this? + /// Maximum node ID. + + /// Maximum node ID. + ///\sa id(Node) + int maxNodeId() const { return nodes.size()-1; } + /// Maximum edge ID. + + /// Maximum edge ID. + ///\sa id(Edge) + int maxEdgeId() const { return 0; } Node tail(Edge e) const { return INVALID; } Node head(Edge e) const { return INVALID; } @@ -542,12 +570,28 @@ InEdgeIt& first(InEdgeIt& e, const Node v) const { e=InEdgeIt(*this,v); return e; } + /// Node ID. + + /// The ID of a valid Node is a nonnegative integer not greater than + /// \ref maxNodeId(). The range of the ID's is not surely continuous + /// and the greatest node ID can be actually less then \ref maxNodeId(). + /// + /// The ID of the \ref INVALID node is -1. + ///\return The ID of the node \c v. int id(Node v) const { return v.n; } + /// Edge ID. + + /// The ID of a valid Edge is a nonnegative integer not greater than + /// \ref maxEdgeId(). The range of the ID's is not surely continuous + /// and the greatest edge ID can be actually less then \ref maxEdgeId(). + /// + /// The ID of the \ref INVALID edge is -1. + ///\return The ID of the edge \c e. int id(Edge e) const { return -1; } /// Adds a new node to the graph. - /// \todo It adds the nodes in a reversed order. + /// \warning It adds the new node to the front of the list. /// (i.e. the lastly added node becomes the first.) Node addNode() { int n; @@ -827,15 +871,21 @@ : G(_g.G), nodes(_g.G), edges(_g.edges), first_free_edge(_g.first_free_edge) {} - int nodeNum() const { return G.nodeNum(); } //FIXME: What is this? - int edgeNum() const { return edges.size(); } //FIXME: What is this? + ///Number of nodes. + int nodeNum() const { return G.nodeNum(); } + ///Number of edges. + int edgeNum() const { return edges.size(); } - ///\bug This function does something different than - ///its name would suggests... - int maxNodeId() const { return G.maxNodeId(); } //FIXME: What is this? - ///\bug This function does something different than - ///its name would suggests... - int maxEdgeId() const { return edges.size(); } //FIXME: What is this? + /// Maximum node ID. + + /// Maximum node ID. + ///\sa id(Node) + int maxNodeId() const { return G.maxNodeId(); } + /// Maximum edge ID. + + /// Maximum edge ID. + ///\sa id(Edge) + int maxEdgeId() const { return edges.size()-1; } Node tail(Edge e) const { return edges[e.n].tail; } Node head(Edge e) const { return edges[e.n].head; } @@ -849,6 +899,23 @@ InEdgeIt& first(InEdgeIt& e, const Node v) const { e=InEdgeIt(*this,v); return e; } + /// Node ID. + + /// The ID of a valid Node is a nonnegative integer not greater than + /// \ref maxNodeId(). The range of the ID's is not surely continuous + /// and the greatest node ID can be actually less then \ref maxNodeId(). + /// + /// The ID of the \ref INVALID node is -1. + ///\return The ID of the node \c v. + int id(Node v) { return G.id(v); } + /// Edge ID. + + /// The ID of a valid Edge is a nonnegative integer not greater than + /// \ref maxEdgeId(). The range of the ID's is not surely continuous + /// and the greatest edge ID can be actually less then \ref maxEdgeId(). + /// + /// The ID of the \ref INVALID edge is -1. + ///\return The ID of the edge \c e. int id(Edge e) const { return e.n; } /// Adds a new node to the graph.