- maxEdgeId() and maxNodeId() now works as their names suggest.
- maxEdgeId(), maxNodeId(), nodeNum() and edgeNum() are documented.
1.1 --- a/src/hugo/full_graph.h Tue Sep 07 07:09:53 2004 +0000
1.2 +++ b/src/hugo/full_graph.h Tue Sep 07 10:35:31 2004 +0000
1.3 @@ -58,11 +58,21 @@
1.4 FullGraph(const FullGraph &_g)
1.5 : NodeNum(_g.nodeNum()), EdgeNum(NodeNum*NodeNum) { }
1.6
1.7 - int nodeNum() const { return NodeNum; } //FIXME: What is this?
1.8 - int edgeNum() const { return EdgeNum; } //FIXME: What is this?
1.9 + ///Number of nodes.
1.10 + int nodeNum() const { return NodeNum; }
1.11 + ///Number of edges.
1.12 + int edgeNum() const { return EdgeNum; }
1.13
1.14 - int maxNodeId() const { return NodeNum; } //FIXME: What is this?
1.15 - int maxEdgeId() const { return EdgeNum; } //FIXME: What is this?
1.16 + /// Maximum node ID.
1.17 +
1.18 + /// Maximum node ID.
1.19 + ///\sa id(Node)
1.20 + int maxNodeId() const { return NodeNum-1; }
1.21 + /// Maximum edge ID.
1.22 +
1.23 + /// Maximum edge ID.
1.24 + ///\sa id(Edge)
1.25 + int maxEdgeId() const { return EdgeNum-1; }
1.26
1.27 Node tail(Edge e) const { return e.n%NodeNum; }
1.28 Node head(Edge e) const { return e.n/NodeNum; }
1.29 @@ -76,7 +86,23 @@
1.30 InEdgeIt& first(InEdgeIt& e, const Node v) const {
1.31 e=InEdgeIt(*this,v); return e; }
1.32
1.33 + /// Node ID.
1.34 +
1.35 + /// The ID of a valid Node is a nonnegative integer not greater than
1.36 + /// \ref maxNodeId(). The range of the ID's is not surely continuous
1.37 + /// and the greatest node ID can be actually less then \ref maxNodeId().
1.38 + ///
1.39 + /// The ID of the \ref INVALID node is -1.
1.40 + ///\return The ID of the node \c v.
1.41 static int id(Node v) { return v.n; }
1.42 + /// Edge ID.
1.43 +
1.44 + /// The ID of a valid Edge is a nonnegative integer not greater than
1.45 + /// \ref maxEdgeId(). The range of the ID's is not surely continuous
1.46 + /// and the greatest edge ID can be actually less then \ref maxEdgeId().
1.47 + ///
1.48 + /// The ID of the \ref INVALID edge is -1.
1.49 + ///\return The ID of the edge \c e.
1.50 static int id(Edge e) { return e.n; }
1.51
1.52 /// Finds an edge between two nodes.
2.1 --- a/src/hugo/list_graph.h Tue Sep 07 07:09:53 2004 +0000
2.2 +++ b/src/hugo/list_graph.h Tue Sep 07 10:35:31 2004 +0000
2.3 @@ -93,22 +93,28 @@
2.4 first_free_node(_g.first_free_node), edges(_g.edges),
2.5 first_free_edge(_g.first_free_edge) {}
2.6
2.7 - int nodeNum() const { return nodes.size(); } //FIXME: What is this?
2.8 - int edgeNum() const { return edges.size(); } //FIXME: What is this?
2.9 + ///Number of nodes.
2.10 + int nodeNum() const { return nodes.size(); }
2.11 + ///Number of edges.
2.12 + int edgeNum() const { return edges.size(); }
2.13
2.14 - ///Set the expected number of edges
2.15 + ///Set the expected maximum number of edges.
2.16
2.17 ///With this function, it is possible to set the expected number of edges.
2.18 ///The use of this fasten the building of the graph and makes
2.19 ///it possible to avoid the superfluous memory allocation.
2.20 void reserveEdge(int n) { edges.reserve(n); };
2.21
2.22 - ///\bug This function does something different than
2.23 - ///its name would suggests...
2.24 - int maxNodeId() const { return nodes.size(); } //FIXME: What is this?
2.25 - ///\bug This function does something different than
2.26 - ///its name would suggests...
2.27 - int maxEdgeId() const { return edges.size(); } //FIXME: What is this?
2.28 + /// Maximum node ID.
2.29 +
2.30 + /// Maximum node ID.
2.31 + ///\sa id(Node)
2.32 + int maxNodeId() const { return nodes.size()-1; }
2.33 + /// Maximum edge ID.
2.34 +
2.35 + /// Maximum edge ID.
2.36 + ///\sa id(Edge)
2.37 + int maxEdgeId() const { return edges.size()-1; }
2.38
2.39 Node tail(Edge e) const { return edges[e.n].tail; }
2.40 Node head(Edge e) const { return edges[e.n].head; }
2.41 @@ -122,12 +128,28 @@
2.42 InEdgeIt& first(InEdgeIt& e, const Node v) const {
2.43 e=InEdgeIt(*this,v); return e; }
2.44
2.45 + /// Node ID.
2.46 +
2.47 + /// The ID of a valid Node is a nonnegative integer not greater than
2.48 + /// \ref maxNodeId(). The range of the ID's is not surely continuous
2.49 + /// and the greatest node ID can be actually less then \ref maxNodeId().
2.50 + ///
2.51 + /// The ID of the \ref INVALID node is -1.
2.52 + ///\return The ID of the node \c v.
2.53 static int id(Node v) { return v.n; }
2.54 + /// Edge ID.
2.55 +
2.56 + /// The ID of a valid Edge is a nonnegative integer not greater than
2.57 + /// \ref maxEdgeId(). The range of the ID's is not surely continuous
2.58 + /// and the greatest edge ID can be actually less then \ref maxEdgeId().
2.59 + ///
2.60 + /// The ID of the \ref INVALID edge is -1.
2.61 + ///\return The ID of the edge \c e.
2.62 static int id(Edge e) { return e.n; }
2.63
2.64 /// Adds a new node to the graph.
2.65
2.66 - /// \todo It adds the nodes in a reversed order.
2.67 + /// \warning It adds the new node to the front of the list.
2.68 /// (i.e. the lastly added node becomes the first.)
2.69 Node addNode() {
2.70 int n;
2.71 @@ -520,15 +542,21 @@
2.72 : nodes(_g.nodes), first_node(_g.first_node),
2.73 first_free_node(_g.first_free_node) {}
2.74
2.75 - int nodeNum() const { return nodes.size(); } //FIXME: What is this?
2.76 - int edgeNum() const { return 0; } //FIXME: What is this?
2.77 + ///Number of nodes.
2.78 + int nodeNum() const { return nodes.size(); }
2.79 + ///Number of edges.
2.80 + int edgeNum() const { return 0; }
2.81
2.82 - ///\bug This function does something different than
2.83 - ///its name would suggests...
2.84 - int maxNodeId() const { return nodes.size(); } //FIXME: What is this?
2.85 - ///\bug This function does something different than
2.86 - ///its name would suggests...
2.87 - int maxEdgeId() const { return 0; } //FIXME: What is this?
2.88 + /// Maximum node ID.
2.89 +
2.90 + /// Maximum node ID.
2.91 + ///\sa id(Node)
2.92 + int maxNodeId() const { return nodes.size()-1; }
2.93 + /// Maximum edge ID.
2.94 +
2.95 + /// Maximum edge ID.
2.96 + ///\sa id(Edge)
2.97 + int maxEdgeId() const { return 0; }
2.98
2.99 Node tail(Edge e) const { return INVALID; }
2.100 Node head(Edge e) const { return INVALID; }
2.101 @@ -542,12 +570,28 @@
2.102 InEdgeIt& first(InEdgeIt& e, const Node v) const {
2.103 e=InEdgeIt(*this,v); return e; }
2.104
2.105 + /// Node ID.
2.106 +
2.107 + /// The ID of a valid Node is a nonnegative integer not greater than
2.108 + /// \ref maxNodeId(). The range of the ID's is not surely continuous
2.109 + /// and the greatest node ID can be actually less then \ref maxNodeId().
2.110 + ///
2.111 + /// The ID of the \ref INVALID node is -1.
2.112 + ///\return The ID of the node \c v.
2.113 int id(Node v) const { return v.n; }
2.114 + /// Edge ID.
2.115 +
2.116 + /// The ID of a valid Edge is a nonnegative integer not greater than
2.117 + /// \ref maxEdgeId(). The range of the ID's is not surely continuous
2.118 + /// and the greatest edge ID can be actually less then \ref maxEdgeId().
2.119 + ///
2.120 + /// The ID of the \ref INVALID edge is -1.
2.121 + ///\return The ID of the edge \c e.
2.122 int id(Edge e) const { return -1; }
2.123
2.124 /// Adds a new node to the graph.
2.125
2.126 - /// \todo It adds the nodes in a reversed order.
2.127 + /// \warning It adds the new node to the front of the list.
2.128 /// (i.e. the lastly added node becomes the first.)
2.129 Node addNode() {
2.130 int n;
2.131 @@ -827,15 +871,21 @@
2.132 : G(_g.G), nodes(_g.G), edges(_g.edges),
2.133 first_free_edge(_g.first_free_edge) {}
2.134
2.135 - int nodeNum() const { return G.nodeNum(); } //FIXME: What is this?
2.136 - int edgeNum() const { return edges.size(); } //FIXME: What is this?
2.137 + ///Number of nodes.
2.138 + int nodeNum() const { return G.nodeNum(); }
2.139 + ///Number of edges.
2.140 + int edgeNum() const { return edges.size(); }
2.141
2.142 - ///\bug This function does something different than
2.143 - ///its name would suggests...
2.144 - int maxNodeId() const { return G.maxNodeId(); } //FIXME: What is this?
2.145 - ///\bug This function does something different than
2.146 - ///its name would suggests...
2.147 - int maxEdgeId() const { return edges.size(); } //FIXME: What is this?
2.148 + /// Maximum node ID.
2.149 +
2.150 + /// Maximum node ID.
2.151 + ///\sa id(Node)
2.152 + int maxNodeId() const { return G.maxNodeId(); }
2.153 + /// Maximum edge ID.
2.154 +
2.155 + /// Maximum edge ID.
2.156 + ///\sa id(Edge)
2.157 + int maxEdgeId() const { return edges.size()-1; }
2.158
2.159 Node tail(Edge e) const { return edges[e.n].tail; }
2.160 Node head(Edge e) const { return edges[e.n].head; }
2.161 @@ -849,6 +899,23 @@
2.162 InEdgeIt& first(InEdgeIt& e, const Node v) const {
2.163 e=InEdgeIt(*this,v); return e; }
2.164
2.165 + /// Node ID.
2.166 +
2.167 + /// The ID of a valid Node is a nonnegative integer not greater than
2.168 + /// \ref maxNodeId(). The range of the ID's is not surely continuous
2.169 + /// and the greatest node ID can be actually less then \ref maxNodeId().
2.170 + ///
2.171 + /// The ID of the \ref INVALID node is -1.
2.172 + ///\return The ID of the node \c v.
2.173 + int id(Node v) { return G.id(v); }
2.174 + /// Edge ID.
2.175 +
2.176 + /// The ID of a valid Edge is a nonnegative integer not greater than
2.177 + /// \ref maxEdgeId(). The range of the ID's is not surely continuous
2.178 + /// and the greatest edge ID can be actually less then \ref maxEdgeId().
2.179 + ///
2.180 + /// The ID of the \ref INVALID edge is -1.
2.181 + ///\return The ID of the edge \c e.
2.182 int id(Edge e) const { return e.n; }
2.183
2.184 /// Adds a new node to the graph.
3.1 --- a/src/hugo/smart_graph.h Tue Sep 07 07:09:53 2004 +0000
3.2 +++ b/src/hugo/smart_graph.h Tue Sep 07 10:35:31 2004 +0000
3.3 @@ -80,15 +80,21 @@
3.4 SmartGraph() : nodes(), edges() { }
3.5 SmartGraph(const SmartGraph &_g) : nodes(_g.nodes), edges(_g.edges) { }
3.6
3.7 - int nodeNum() const { return nodes.size(); } //FIXME: What is this?
3.8 - int edgeNum() const { return edges.size(); } //FIXME: What is this?
3.9 + ///Number of nodes.
3.10 + int nodeNum() const { return nodes.size(); }
3.11 + ///Number of edges.
3.12 + int edgeNum() const { return edges.size(); }
3.13
3.14 - ///\bug This function does something different than
3.15 - ///its name would suggests...
3.16 - int maxNodeId() const { return nodes.size(); } //FIXME: What is this?
3.17 - ///\bug This function does something different than
3.18 - ///its name would suggests...
3.19 - int maxEdgeId() const { return edges.size(); } //FIXME: What is this?
3.20 + /// Maximum node ID.
3.21 +
3.22 + /// Maximum node ID.
3.23 + ///\sa id(Node)
3.24 + int maxNodeId() const { return nodes.size()-1; }
3.25 + /// Maximum edge ID.
3.26 +
3.27 + /// Maximum edge ID.
3.28 + ///\sa id(Edge)
3.29 + int maxEdgeId() const { return edges.size()-1; }
3.30
3.31 Node tail(Edge e) const { return edges[e.n].tail; }
3.32 Node head(Edge e) const { return edges[e.n].head; }
3.33 @@ -102,7 +108,23 @@
3.34 InEdgeIt& first(InEdgeIt& e, const Node v) const {
3.35 e=InEdgeIt(*this,v); return e; }
3.36
3.37 + /// Node ID.
3.38 +
3.39 + /// The ID of a valid Node is a nonnegative integer not greater than
3.40 + /// \ref maxNodeId(). The range of the ID's is not surely continuous
3.41 + /// and the greatest node ID can be actually less then \ref maxNodeId().
3.42 + ///
3.43 + /// The ID of the \ref INVALID node is -1.
3.44 + ///\return The ID of the node \c v.
3.45 static int id(Node v) { return v.n; }
3.46 + /// Edge ID.
3.47 +
3.48 + /// The ID of a valid Edge is a nonnegative integer not greater than
3.49 + /// \ref maxEdgeId(). The range of the ID's is not surely continuous
3.50 + /// and the greatest edge ID can be actually less then \ref maxEdgeId().
3.51 + ///
3.52 + /// The ID of the \ref INVALID edge is -1.
3.53 + ///\return The ID of the edge \c e.
3.54 static int id(Edge e) { return e.n; }
3.55
3.56 Node addNode() {