Boost logo

Boost-Commit :

From: asutton_at_[hidden]
Date: 2008-06-17 08:08:09


Author: asutton
Date: 2008-06-17 08:08:08 EDT (Tue, 17 Jun 2008)
New Revision: 46444
URL: http://svn.boost.org/trac/boost/changeset/46444

Log:
Started migrating file and class names to support both directed and
undirected graphs in the same namespace.

Added:
   sandbox/SOC/2008/graphs/trunk/boost/graphs/undirected_edge.hpp
      - copied, changed from r46443, /sandbox/SOC/2008/graphs/trunk/boost/graphs/edge.hpp
   sandbox/SOC/2008/graphs/trunk/boost/graphs/undirected_vertex.hpp
      - copied, changed from r46443, /sandbox/SOC/2008/graphs/trunk/boost/graphs/vertex.hpp
Removed:
   sandbox/SOC/2008/graphs/trunk/boost/graphs/edge.hpp
   sandbox/SOC/2008/graphs/trunk/boost/graphs/vertex.hpp
Text files modified:
   sandbox/SOC/2008/graphs/trunk/boost/graphs/incidence_iterator.hpp | 2
   sandbox/SOC/2008/graphs/trunk/boost/graphs/undirected_edge.hpp | 4
   sandbox/SOC/2008/graphs/trunk/boost/graphs/undirected_graph.hpp | 6 +-
   sandbox/SOC/2008/graphs/trunk/boost/graphs/undirected_vertex.hpp | 81 +++++++++++++++++++--------------------
   4 files changed, 46 insertions(+), 47 deletions(-)

Deleted: sandbox/SOC/2008/graphs/trunk/boost/graphs/edge.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/graphs/edge.hpp 2008-06-17 08:08:08 EDT (Tue, 17 Jun 2008)
+++ (empty file)
@@ -1,85 +0,0 @@
-
-#ifndef EDGE_HPP
-#define EDGE_HPP
-
-#include "unordered_pair.hpp"
-
-/**
- * This structure implements an unordered edge - sort of. Because the undirected
- * adjacency list class doesn't ever store a concrete edge type, this edge
- * type simply aggregates descriptors in such a way that it defines an edge.
- * This means that this class can also act (and does) as a descriptor itself.
- */
-template <typename VertexDesc, typename PropDesc>
-class undirected_edge
-{
-public:
- typedef VertexDesc vertex_descriptor;
- typedef PropDesc property_descriptor;
- typedef unordered_pair<vertex_descriptor> edge_pair;
-
- inline undirected_edge();
- inline undirected_edge(vertex_descriptor u, vertex_descriptor v, property_descriptor p);
-
- inline property_descriptor properties() const
- { return _prop; }
-
- inline edge_pair const& edge() const
- { return _edge; }
-
- inline vertex_descriptor first() const
- { return _edge.first(); }
-
- inline vertex_descriptor second() const
- { return _edge.second(); }
-
- inline vertex_descriptor opposite(vertex_descriptor v)
- { return v == first() ? second() : first(); }
-
-
- inline bool operator==(undirected_edge const& x);
- inline bool operator!=(undirected_edge const& x);
- inline bool operator<(undirected_edge const& x);
-
-private:
- edge_pair _edge;
- PropDesc _prop;
-};
-
-template <typename VD, typename PD>
-undirected_edge<VD,PD>::undirected_edge()
- : _edge()
- , _prop()
-{ }
-
-template <typename VD, typename PD>
-undirected_edge<VD,PD>::undirected_edge(vertex_descriptor u,
- vertex_descriptor v,
- property_descriptor p)
- : _edge(u, v)
- , _prop(p)
-{ }
-
-template <typename VD, typename PD>
-bool
-undirected_edge<VD,PD>::operator==(undirected_edge const& x)
-{
- return _edge == x._edge && _prop == x._prop;
-}
-
-template <typename VD, typename PD>
-bool
-undirected_edge<VD,PD>::operator!=(undirected_edge const& x)
-{
- return !(*this->operator==(x));
-}
-
-template <typename VD, typename PD>
-bool
-undirected_edge<VD,PD>::operator<(undirected_edge const& x)
-{
- return _edge < x._edge || (!(x._edge < _edge) && _prop < x._prop);
-}
-
-
-#endif

Modified: sandbox/SOC/2008/graphs/trunk/boost/graphs/incidence_iterator.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/graphs/incidence_iterator.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/graphs/incidence_iterator.hpp 2008-06-17 08:08:08 EDT (Tue, 17 Jun 2008)
@@ -4,7 +4,7 @@
 
 #include <boost/type_traits.hpp>
 
-#include "edge.hpp"
+#include "undirected_edge.hpp"
 
 /**
  * The incidence iterator is an abstraction over the incidence iterators of

Copied: sandbox/SOC/2008/graphs/trunk/boost/graphs/undirected_edge.hpp (from r46443, /sandbox/SOC/2008/graphs/trunk/boost/graphs/edge.hpp)
==============================================================================
--- /sandbox/SOC/2008/graphs/trunk/boost/graphs/edge.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/graphs/undirected_edge.hpp 2008-06-17 08:08:08 EDT (Tue, 17 Jun 2008)
@@ -1,6 +1,6 @@
 
-#ifndef EDGE_HPP
-#define EDGE_HPP
+#ifndef UNDIRECTED_EDGE_HPP
+#define UNDIRECTED_EDGE_HPP
 
 #include "unordered_pair.hpp"
 

Modified: sandbox/SOC/2008/graphs/trunk/boost/graphs/undirected_graph.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/graphs/undirected_graph.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/graphs/undirected_graph.hpp 2008-06-17 08:08:08 EDT (Tue, 17 Jun 2008)
@@ -19,13 +19,13 @@
 
 #include "descriptor.hpp"
 
-#include "vertex.hpp"
+#include "undirected_vertex.hpp"
 #include "vertex_iterator.hpp"
 #include "vertex_vector.hpp"
 #include "vertex_list.hpp"
 #include "vertex_set.hpp"
 
-#include "edge.hpp"
+#include "undirected_edge.hpp"
 #include "edge_vector.hpp"
 #include "edge_list.hpp"
 #include "edge_set.hpp"
@@ -67,7 +67,7 @@
     // store. Then, turn around and use that to generate the vertex store and its
     // related types. Incident edge iterators are abstracted over the iterators
     // of the vertex.
- typedef vertex<vertex_properties, incidence_store> vertex_type;
+ typedef undirected_vertex<vertex_properties, incidence_store> vertex_type;
     typedef typename vertex_type::size_type incident_edges_size_type;
     typedef incidence_iterator<typename vertex_type::iterator> incident_edge_iterator;
     typedef std::pair<incident_edge_iterator, incident_edge_iterator> incident_edge_range;

Copied: sandbox/SOC/2008/graphs/trunk/boost/graphs/undirected_vertex.hpp (from r46443, /sandbox/SOC/2008/graphs/trunk/boost/graphs/vertex.hpp)
==============================================================================
--- /sandbox/SOC/2008/graphs/trunk/boost/graphs/vertex.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/graphs/undirected_vertex.hpp 2008-06-17 08:08:08 EDT (Tue, 17 Jun 2008)
@@ -1,19 +1,27 @@
 
-#ifndef VERTEX_HPP
-#define VERTEX_HPP
+#ifndef UNDIRECTED_VERTEX_HPP
+#define UNDIRECTED_VERTEX_HPP
 
 #include "incidence_iterator.hpp"
 
-// A vertex, at least for an undirected graph, is simply an repository
-// for the vertex' properties and an interface for the its incidence
-// list.
-//
-// For directed graphs, it's basically the same, but has an out edge
-// list and/or an in edge list, and the edge properties are stored on
-// the out edge list.
 
+/**
+ * A vertex, at least for an undirected graph, is simply an repository
+ * for the vertex' properties and an interface for the its incidence
+ * list.
+ *
+ * For directed graphs, it's basically the same, but has an out edge
+ * list and/or an in edge list, and the edge properties are stored on
+ * the out edge list.
+ * The default comparison of vertices always delegates the comparison to the
+ * stored vertex properties. This allows developers to express custom
+ * comparitors with respect to the properties and have the vertex sets or other
+ * vertex ordering operations work as they might expect.
+ *
+ * @requires LessThanComparable<vertex_properties>.
+ */
 template <typename VertexProps, typename IncStore>
-class vertex
+class undirected_vertex
 {
     typedef IncStore incidence_store;
 public:
@@ -24,8 +32,8 @@
     typedef typename incidence_store::const_iterator iterator;
     typedef typename incidence_store::size_type size_type;
 
- inline vertex();
- inline vertex(vertex_properties const& vp);
+ inline undirected_vertex();
+ inline undirected_vertex(vertex_properties const& vp);
 
     /** @name Edge Connection and Disconnection
      * These functions control how edges are added to and removed from the
@@ -50,8 +58,15 @@
 
     inline size_type degree() const
     { return _edges.size(); }
+
+ inline bool operator==(undirected_vertex const& x) const
+ { return _props == x._props; }
 
- inline bool operator<(vertex const&) const;
+ inline bool operator!=(undirected_vertex const& x) const
+ { return !this->operator==(x); }
+
+ inline bool operator<(undirected_vertex const& x) const
+ { return _props < x._props; }
 
 private:
     vertex_properties _props;
@@ -59,13 +74,13 @@
 };
 
 template <typename VP, typename IS>
-vertex<VP,IS>::vertex()
+undirected_vertex<VP,IS>::undirected_vertex()
     : _props()
     , _edges()
 { }
 
 template <typename VP, typename IS>
-vertex<VP,IS>::vertex(vertex_properties const& vp)
+undirected_vertex<VP,IS>::undirected_vertex(vertex_properties const& vp)
     : _props(vp)
     , _edges()
 { }
@@ -79,8 +94,8 @@
  * @complexity O(lg(d))
  */
 template <typename VP, typename IS>
-std::pair<typename vertex<VP,IS>::iterator, bool>
-vertex<VP,IS>::allow(vertex_descriptor v) const
+std::pair<typename undirected_vertex<VP,IS>::iterator, bool>
+undirected_vertex<VP,IS>::allow(vertex_descriptor v) const
 {
     return _edges.allow(v);
 }
@@ -90,7 +105,7 @@
  */
 template <typename VP, typename IS>
 void
-vertex<VP,IS>::connect(vertex_descriptor v, property_descriptor p)
+undirected_vertex<VP,IS>::connect(vertex_descriptor v, property_descriptor p)
 {
     _edges.add(make_pair(v, p));
 }
@@ -101,7 +116,7 @@
  */
 template <typename VP, typename IS>
 void
-vertex<VP,IS>::disconnect()
+undirected_vertex<VP,IS>::disconnect()
 {
     _edges.clear();
 }
@@ -111,7 +126,7 @@
  */
 template <typename VP, typename IS>
 void
-vertex<VP,IS>::disconnect(vertex_descriptor v, property_descriptor p)
+undirected_vertex<VP,IS>::disconnect(vertex_descriptor v, property_descriptor p)
 {
     _edges.remove(make_pair(v, p));
 }
@@ -119,7 +134,7 @@
 template <typename VP, typename IS>
 template <typename Eraser>
 void
-vertex<VP,IS>::disconnect(vertex_descriptor v, Eraser erase)
+undirected_vertex<VP,IS>::disconnect(vertex_descriptor v, Eraser erase)
 {
     _edges.remove(v, erase);
 }
@@ -128,8 +143,8 @@
  * Return the properties associated with this vertex (if any).
  */
 template <typename VP, typename IS>
-typename vertex<VP,IS>::vertex_properties&
-vertex<VP,IS>::properties()
+typename undirected_vertex<VP,IS>::vertex_properties&
+undirected_vertex<VP,IS>::properties()
 {
     return _props;
 }
@@ -138,26 +153,10 @@
  * Return the properties associated with this vertex (if any).
  */
 template <typename VP, typename IS>
-typename vertex<VP,IS>::vertex_properties const&
-vertex<VP,IS>::properties() const
+typename undirected_vertex<VP,IS>::vertex_properties const&
+undirected_vertex<VP,IS>::properties() const
 {
     return _props;
 }
 
-/**
- * The default comparison of vertices always delegates the comparison to the
- * stored vertex properties. This allows developers to express custom
- * comparitors with respect to the properties and have the vertex sets or other
- * vertex ordering operations work as they might expect.
- *
- * @requires LessThanComparable<vertex_properties>.
- */
-template <typename VP, typename IS>
-bool
-vertex<VP,IS>::operator<(vertex const& v) const
-{
- return _props < v._props;
-}
-
 #endif
-

Deleted: sandbox/SOC/2008/graphs/trunk/boost/graphs/vertex.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/graphs/vertex.hpp 2008-06-17 08:08:08 EDT (Tue, 17 Jun 2008)
+++ (empty file)
@@ -1,163 +0,0 @@
-
-#ifndef VERTEX_HPP
-#define VERTEX_HPP
-
-#include "incidence_iterator.hpp"
-
-// A vertex, at least for an undirected graph, is simply an repository
-// for the vertex' properties and an interface for the its incidence
-// list.
-//
-// For directed graphs, it's basically the same, but has an out edge
-// list and/or an in edge list, and the edge properties are stored on
-// the out edge list.
-
-template <typename VertexProps, typename IncStore>
-class vertex
-{
- typedef IncStore incidence_store;
-public:
- typedef VertexProps vertex_properties;
- typedef typename incidence_store::vertex_descriptor vertex_descriptor;
- typedef typename incidence_store::property_descriptor property_descriptor;
-
- typedef typename incidence_store::const_iterator iterator;
- typedef typename incidence_store::size_type size_type;
-
- inline vertex();
- inline vertex(vertex_properties const& vp);
-
- /** @name Edge Connection and Disconnection
- * These functions control how edges are added to and removed from the
- * vertex. The allow() function determines whether or not the edge
- * connection is allowed and/or already existing.
- */
- inline std::pair<iterator, bool> allow(vertex_descriptor) const;
- inline void connect(vertex_descriptor, property_descriptor);
- inline void disconnect();
- inline void disconnect(vertex_descriptor, property_descriptor);
- template <typename Eraser> inline void disconnect(vertex_descriptor, Eraser);
-
- inline vertex_properties& properties();
- inline vertex_properties const& properties() const;
-
-
- inline iterator begin() const
- { return _edges.begin(); }
-
- inline iterator end() const
- { return _edges.end(); }
-
- inline size_type degree() const
- { return _edges.size(); }
-
- inline bool operator<(vertex const&) const;
-
-private:
- vertex_properties _props;
- incidence_store _edges;
-};
-
-template <typename VP, typename IS>
-vertex<VP,IS>::vertex()
- : _props()
- , _edges()
-{ }
-
-template <typename VP, typename IS>
-vertex<VP,IS>::vertex(vertex_properties const& vp)
- : _props(vp)
- , _edges()
-{ }
-
-/**
- * Deteremine whether or not the edge exists or is even allowed to be added.
- * This returns a pair containing an iterator indicating the position of the
- * edge if it already exists and a bool value indicating whether or not the
- * addition would even be allowed by policy.
- *
- * @complexity O(lg(d))
- */
-template <typename VP, typename IS>
-std::pair<typename vertex<VP,IS>::iterator, bool>
-vertex<VP,IS>::allow(vertex_descriptor v) const
-{
- return _edges.allow(v);
-}
-
-/**
- * Connect this vertex to the vertex v with edge properties p.
- */
-template <typename VP, typename IS>
-void
-vertex<VP,IS>::connect(vertex_descriptor v, property_descriptor p)
-{
- _edges.add(make_pair(v, p));
-}
-
-/**
- * Disconect all edges from this vertex. This does not remove the connection
- * from adjacent vertices to this vertex.
- */
-template <typename VP, typename IS>
-void
-vertex<VP,IS>::disconnect()
-{
- _edges.clear();
-}
-
-/**
- * Disconnect the incidedent edge given by the vertex v with edge properties p.
- */
-template <typename VP, typename IS>
-void
-vertex<VP,IS>::disconnect(vertex_descriptor v, property_descriptor p)
-{
- _edges.remove(make_pair(v, p));
-}
-
-template <typename VP, typename IS>
-template <typename Eraser>
-void
-vertex<VP,IS>::disconnect(vertex_descriptor v, Eraser erase)
-{
- _edges.remove(v, erase);
-}
-
-/**
- * Return the properties associated with this vertex (if any).
- */
-template <typename VP, typename IS>
-typename vertex<VP,IS>::vertex_properties&
-vertex<VP,IS>::properties()
-{
- return _props;
-}
-
-/**
- * Return the properties associated with this vertex (if any).
- */
-template <typename VP, typename IS>
-typename vertex<VP,IS>::vertex_properties const&
-vertex<VP,IS>::properties() const
-{
- return _props;
-}
-
-/**
- * The default comparison of vertices always delegates the comparison to the
- * stored vertex properties. This allows developers to express custom
- * comparitors with respect to the properties and have the vertex sets or other
- * vertex ordering operations work as they might expect.
- *
- * @requires LessThanComparable<vertex_properties>.
- */
-template <typename VP, typename IS>
-bool
-vertex<VP,IS>::operator<(vertex const& v) const
-{
- return _props < v._props;
-}
-
-#endif
-


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk