[Lemon-commits] [lemon_svn] alpar: r1109 - hugo/trunk/src/hugo
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:43:18 CET 2006
Author: alpar
Date: Tue Sep 7 12:35:31 2004
New Revision: 1109
Modified:
hugo/trunk/src/hugo/full_graph.h
hugo/trunk/src/hugo/list_graph.h
hugo/trunk/src/hugo/smart_graph.h
Log:
- maxEdgeId() and maxNodeId() now works as their names suggest.
- maxEdgeId(), maxNodeId(), nodeNum() and edgeNum() are documented.
Modified: hugo/trunk/src/hugo/full_graph.h
==============================================================================
--- hugo/trunk/src/hugo/full_graph.h (original)
+++ hugo/trunk/src/hugo/full_graph.h Tue Sep 7 12:35:31 2004
@@ -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?
-
- int maxNodeId() const { return NodeNum; } //FIXME: What is this?
- int maxEdgeId() const { return EdgeNum; } //FIXME: What is this?
+ ///Number of nodes.
+ int nodeNum() const { return NodeNum; }
+ ///Number of edges.
+ int edgeNum() const { return EdgeNum; }
+
+ /// 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.
Modified: hugo/trunk/src/hugo/list_graph.h
==============================================================================
--- hugo/trunk/src/hugo/list_graph.h (original)
+++ hugo/trunk/src/hugo/list_graph.h Tue Sep 7 12:35:31 2004
@@ -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?
-
- ///\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?
+ ///Number of nodes.
+ int nodeNum() const { return nodes.size(); }
+ ///Number of edges.
+ int edgeNum() const { return 0; }
+
+ /// 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?
-
- ///\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?
+ ///Number of nodes.
+ int nodeNum() const { return G.nodeNum(); }
+ ///Number of edges.
+ int edgeNum() const { return edges.size(); }
+
+ /// 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.
Modified: hugo/trunk/src/hugo/smart_graph.h
==============================================================================
--- hugo/trunk/src/hugo/smart_graph.h (original)
+++ hugo/trunk/src/hugo/smart_graph.h Tue Sep 7 12:35:31 2004
@@ -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() {
More information about the Lemon-commits
mailing list