# HG changeset patch # User alpar # Date 1094553331 0 # Node ID 65144c52969c5406b3d54be51cd7ad25b7010ac8 # Parent 182d3a4d7ddb1be6d857f52d229d10580ffe13e7 - maxEdgeId() and maxNodeId() now works as their names suggest. - maxEdgeId(), maxNodeId(), nodeNum() and edgeNum() are documented. diff -r 182d3a4d7ddb -r 65144c52969c src/hugo/full_graph.h --- a/src/hugo/full_graph.h Tue Sep 07 07:09:53 2004 +0000 +++ b/src/hugo/full_graph.h Tue Sep 07 10:35:31 2004 +0000 @@ -58,11 +58,21 @@ FullGraph(const FullGraph &_g) : NodeNum(_g.nodeNum()), EdgeNum(NodeNum*NodeNum) { } - int nodeNum() const { return NodeNum; } //FIXME: What is this? - int edgeNum() const { return EdgeNum; } //FIXME: What is this? + ///Number of nodes. + int nodeNum() const { return NodeNum; } + ///Number of edges. + int edgeNum() const { return EdgeNum; } - int maxNodeId() const { return NodeNum; } //FIXME: What is this? - int maxEdgeId() const { return EdgeNum; } //FIXME: What is this? + /// Maximum node ID. + + /// Maximum node ID. + ///\sa id(Node) + int maxNodeId() const { return NodeNum-1; } + /// Maximum edge ID. + + /// Maximum edge ID. + ///\sa id(Edge) + int maxEdgeId() const { return EdgeNum-1; } Node tail(Edge e) const { return e.n%NodeNum; } Node head(Edge e) const { return e.n/NodeNum; } @@ -76,7 +86,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. 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; } /// Finds an edge between two nodes. 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. diff -r 182d3a4d7ddb -r 65144c52969c src/hugo/smart_graph.h --- a/src/hugo/smart_graph.h Tue Sep 07 07:09:53 2004 +0000 +++ b/src/hugo/smart_graph.h Tue Sep 07 10:35:31 2004 +0000 @@ -80,15 +80,21 @@ SmartGraph() : nodes(), edges() { } SmartGraph(const SmartGraph &_g) : nodes(_g.nodes), edges(_g.edges) { } - 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(); } - ///\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; } @@ -102,7 +108,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. 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; } Node addNode() {