diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2019-01-14 15:47:59 -0500 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2019-01-14 15:47:59 -0500 |
commit | 49ac78a6c04e215950bc9c0f97368605e63da15b (patch) | |
tree | 64b770c543a0c90bc7dcbc06ceaaa31e96e541ce /doc/graph.rst | |
parent | 994cbf1a3b611ff4c94ced3b1630e51fd249d7ed (diff) | |
download | c++-49ac78a6c04e215950bc9c0f97368605e63da15b.tar.gz c++-49ac78a6c04e215950bc9c0f97368605e63da15b.tar.bz2 c++-49ac78a6c04e215950bc9c0f97368605e63da15b.zip |
Large refactoring around changes in the graph class.
- Graphs now use lists of references instead of vectors of indicies.
- Vertices and edges have associated classes that can be given arbitrary properties via template specification.
- All essential library headers have been combined into one, wolff.hpp.
Diffstat (limited to 'doc/graph.rst')
-rw-r--r-- | doc/graph.rst | 63 |
1 files changed, 48 insertions, 15 deletions
diff --git a/doc/graph.rst b/doc/graph.rst index 8a96e50..dfe684c 100644 --- a/doc/graph.rst +++ b/doc/graph.rst @@ -1,50 +1,83 @@ .. default-domain:: cpp +.. _graphs: ****** Graphs ****** -This class is defined in the header :file:`wolff/graph.hpp`. +This class is defined in the header :file:`lib/wolff.hpp`. -.. class:: graph +.. class:: \template <class vertex_prop = std::tuple\<>, class edge_prop = std::tuple\<>> graph - Lattices are described by objects of class :class:`graph`, a minimal implementation of graphs. + Lattices are described by objects of class :class:`graph`, a minimal implementation of graphs. Can be called with `graph<>` if no properties need to be associated with vertices or edges. Otherwise, those properties can be supplied as classes. - .. member:: D_t graph::D + .. member:: unsigned graph::D The dimension of the graph. This property is unused by the core library. - .. member:: L_t graph::L + .. member:: unsigned graph::L The linear size of the graph. This property is unused by the core library. - .. member:: v_t graph::ne + .. member:: unsigned graph::ne The number of edges in the graph. This property is unused by the core library. - .. member:: v_t graph::nv + .. member:: unsigned graph::nv The number of vertices in the graph. - .. member:: std::vector<std::vector<v_t>> graph::adjacency + .. class:: graph::vertex - The adjacency list for the graph. The :math:`i\text{th}` element of :member:`adjacency` is a standard library vector containing the indices of all vertices adjacent to vertex :math:`i`. + This class describes the vertices on the graph. - .. member:: std::vector<std::vector<double>> graph::coordinate + .. member:: unsigned ind - The coordinates of the graph vertices. The :math:`i\text{th}` element of :var:`coordinate` is a standard library vector of length :var:`D` containing the spatial coordinates of vertex :math:`i`. This property is unused by the core library. + The index of the vertex, which is also its position in the list :var:`vertices`. + + .. member:: std::list<halfedge> edges + + The list of edges emanating from this vertex. + + .. member:: vertex_prop prop + + Template-defined class which stores optional properties of the vertex. + + .. class:: graph::halfedge + + This class describes the halfedges on the graph. + + .. member:: vertex& self + + A reference to the vertex this halfedge is emanating from. + + .. member:: vertex& neighbor + + A reference to the vertex this halfedge is going to. + + .. member:: edge_prop prop + + Template-defined class which stores optional properties of the edge. + + .. function:: halfedge(vertex &self, vertex &neighbor) + + Constructor which sets self and neighbor from supplied vertices. + + .. member:: std::vector<vertex> graph::vertices + + A list of all vertices in the graph. .. function:: graph::graph() - The default constructor. Initializes an empty graph, i.e., :var:`D`, :var:`L`, :var:`ne`, and :var:`nv` are all zero and :var:`adjacency` and :var:`coordinate` are uninitialized. + The default constructor. Initializes an empty graph, i.e., :var:`D`, :var:`L`, :var:`ne`, and :var:`nv` are all zero and :var:`vertices` is uninitialized. - .. function:: graph::graph(D_t D, L_t L) + .. function:: graph::graph(unsigned D, unsigned L) Initializes a graph of a :var:`D`-dimensional hypercubic lattice with :var:`L` vertices per side. This is the only nontrivial graph constructor supplied by the core library. The library will work with arbitrary graphs, and if a different lattice is needed consider calling the default constructor and populating the member objects youself before handing the graph to the :class:`system` constructor. - :param D_t D: The dimension of space. - :param L_t L: The number of vertices per edge of the hypercube. + :param unsigned D: The dimension of space. + :param unsigned L: The number of vertices per edge of the hypercube. .. function:: void graph::add_ghost() |