algorithms Namespace Reference

Namespace containing various useful algorithms. More...

Classes

class  Insert
 Insert a new vertex on an edge. More...
class  TriangleGrowth
 Growth description using a set of triangles moving. More...
class  TriangleSurface
 Class representing a triangulated surface. More...

Functions

template<typename src_t , typename tgt_t , typename Model , typename Graph , typename iterator >
void _drawGraphConnections (Model *model, Viewer *viewer, const Graph &G, iterator(Graph::*begin)() const, iterator(Graph::*end)() const, bool order_neighbors)
template<typename GraphType , typename Model >
void drawSymetricVVGraph (Model *model, const GraphType &G)
 This function draws a graph using lines between the vertices.
template<typename Model , typename GraphType >
void drawVVBiGraphConnections1 (Model *model, Viewer *viewer, const GraphType &G, bool order_neighbors)
 Draw the connections of a bigraph using the drawArrow method of the viewer.
template<typename Model , typename GraphType >
void drawVVBiGraphConnections2 (Model *model, Viewer *viewer, const GraphType &G, bool order_neighbors)
 Draw the connections of a bigraph using the drawArrow method of the viewer.
template<typename Model , typename GraphType >
void drawVVGraphConnections (Model *model, Viewer *viewer, const GraphType &G, bool order_neighbors)
 Draw the connections of a graph using the drawArrow method of the viewer.
template<class VertexContent , class EdgeContent , bool compact>
const graph::Vertex
< VertexContent > & 
insert (const graph::Vertex< VertexContent > &a, const graph::Vertex< VertexContent > &b, graph::VVGraph< VertexContent, EdgeContent, compact > &S, const graph::Vertex< VertexContent > &x=graph::Vertex< VertexContent >(0))
template<class Graph >
Graph::edge_t insertAfter (const typename Graph::vertex_t &v, const typename Graph::vertex_t &ref, const typename Graph::vertex_t &nv, Graph &S)
 Splice nv after ref in v if ref is not null.
template<class Graph >
Graph::edge_t insertBefore (const typename Graph::vertex_t &v, const typename Graph::vertex_t &ref, const typename Graph::vertex_t &nv, Graph &S)
 Splice nv before ref in v if ref is not null.
template<typename VertexContent , typename EdgeContent , bool compact, typename Model , typename tag_t >
void shortest_paths_Dijkstra (const std::unordered_set< Vertex< VertexContent > > &srcs, const graph::VVGraph< VertexContent, EdgeContent, compact > &m, Model &model, const tag_t &t)
template<typename VertexContent , typename EdgeContent , bool compact, typename Model >
void shortest_paths_Dijkstra (const Vertex< VertexContent > &src, const graph::VVGraph< VertexContent, EdgeContent, compact > &m, const Model &model)
template<typename VertexContent , typename EdgeContent , bool compact, typename Model , typename tag_t >
void shortest_paths_Dijkstra (const Vertex< VertexContent > &src, const graph::VVGraph< VertexContent, EdgeContent, compact > &m, Model &model, const tag_t &t)
template<typename VVGraph , typename Model >
void shortest_paths_FloydWarshall (const VVGraph &m, const Model &model)
 Compute the shortest path for all pair of vertices in the graph.
template<typename VertexContent , typename EdgeContent , bool compact, typename Model , typename tag_t >
void shortest_paths_FloydWarshall (const graph::VVGraph< VertexContent, EdgeContent, compact > &m, Model &model, const tag_t &t)
template<class vvgraph >
vvgraph::vertex_t split (const typename vvgraph::vertex_t &v, const typename vvgraph::vertex_t &n1, const typename vvgraph::vertex_t &n2, vvgraph &S)
 Split the vertex v in two, attaching all the neighbors of v from n1 to n2 (included) to the new vertex.

Detailed Description

Namespace containing various useful algorithms.


Function Documentation

template<typename GraphType , typename Model >
void algorithms::drawSymetricVVGraph ( Model model,
const GraphType &  G 
) [inline]

This function draws a graph using lines between the vertices.

It supposes the graph is symetric, i.e. if there is an edge from v1 to v2, there is another edge from v2 to v1.

These methods are required in the model:

 Point3d position(const vertex& v);
 Point3d normal(const vertex& v);

Definition at line 28 of file draw_graphs.h.

References util::Vector< dim, T >::c_data(), and forall.

00029   {
00030     typedef typename GraphType::vertex_t vertex;
00031     glBegin(GL_LINES);
00032     forall(const vertex& v, G)
00033     {
00034       const geometry::Point3d& vpos = model->position(v);
00035       const geometry::Point3d& normal = model->normal(v);
00036       forall(const vertex& n, G.neighbors(v))
00037       {
00038         if(v<n)
00039         {
00040           glNormal3dv(normal.c_data());
00041           glVertex3dv(vpos.c_data());
00042           glNormal3dv(model->normal(n).c_data());
00043           glVertex3dv(model->position(n).c_data());
00044         }
00045       }
00046     }
00047     glEnd();
00048   }

template<typename Model , typename GraphType >
void algorithms::drawVVBiGraphConnections1 ( Model model,
Viewer viewer,
const GraphType &  G,
bool  order_neighbors 
) [inline]

Draw the connections of a bigraph using the drawArrow method of the viewer.

This function draws the connections from the vertex1 to the vertex2.

This method is required in the model:

 Point3d position(const vertex& v);

Definition at line 83 of file draw_connections.h.

00087   {
00088     typedef typename GraphType::vertex1_t vertex1;
00089     typedef typename GraphType::vertex2_t vertex2;

template<typename Model , typename GraphType >
void algorithms::drawVVBiGraphConnections2 ( Model model,
Viewer viewer,
const GraphType &  G,
bool  order_neighbors 
) [inline]

Draw the connections of a bigraph using the drawArrow method of the viewer.

This function draws the connections from the vertex2 to the vertex1.

This method is required in the model:

 Point3d position(const vertex& v);

Definition at line 102 of file draw_connections.h.

00106   {
00107     typedef typename GraphType::vertex1_t vertex1;
00108     typedef typename GraphType::vertex2_t vertex2;

template<typename Model , typename GraphType >
void algorithms::drawVVGraphConnections ( Model model,
Viewer viewer,
const GraphType &  G,
bool  order_neighbors 
) [inline]

Draw the connections of a graph using the drawArrow method of the viewer.

This method is required in the model:

 Point3d position(const vertex& v);

Definition at line 65 of file draw_connections.h.

00069   {
00070     typedef typename GraphType::vertex_t vertex;

template<class Graph >
Graph::edge_t algorithms::insertAfter ( const typename Graph::vertex_t &  v,
const typename Graph::vertex_t &  ref,
const typename Graph::vertex_t &  nv,
Graph &  S 
) [inline]

Splice nv after ref in v if ref is not null.

Otherwise just insert the edge (v,nv) in S.

Definition at line 138 of file insert.h.

Referenced by complex_factory::square_grid().

00142   {
00143     if(ref)
00144       return S.spliceAfter(v, ref, nv);
00145     return S.insertEdge(v, nv);
00146   }

template<class Graph >
Graph::edge_t algorithms::insertBefore ( const typename Graph::vertex_t &  v,
const typename Graph::vertex_t &  ref,
const typename Graph::vertex_t &  nv,
Graph &  S 
) [inline]

Splice nv before ref in v if ref is not null.

Otherwise just insert the edge (v,nv) in S.

Definition at line 153 of file insert.h.

00157   {
00158     if(ref)
00159       return S.spliceBefore(v, ref, nv);
00160     return S.insertEdge(v, nv);
00161   }

template<typename VVGraph , typename Model >
void algorithms::shortest_paths_FloydWarshall ( const VVGraph &  m,
const Model model 
) [inline]

Compute the shortest path for all pair of vertices in the graph.

This version do not have a tag and will call all the required methods in the model without a tag (to use either as a default or if there is no other call to this function)

See also:
shortest_paths_FloydWarshall(const graph::VVGraph<VertexContent,EdgeContent>&, Model&, const tag_t&)

Definition at line 194 of file graph.h.

00198   {

template<class vvgraph >
vvgraph::vertex_t algorithms::split ( const typename vvgraph::vertex_t v,
const typename vvgraph::vertex_t n1,
const typename vvgraph::vertex_t n2,
vvgraph S 
) [inline]

Split the vertex v in two, attaching all the neighbors of v from n1 to n2 (included) to the new vertex.

The next vertex is replacing the range n1-n2 in v.

All the edges content are copied using the = operator. This function assumes symetric connectivity.

Definition at line 22 of file split.h.

References graph::VVGraph< VertexContent, EdgeContent, compact >::edge(), graph::VVGraph< VertexContent, EdgeContent, compact >::eraseEdge(), graph::VVGraph< VertexContent, EdgeContent, compact >::insert(), graph::VVGraph< VertexContent, EdgeContent, compact >::insertEdge(), graph::VVGraph< VertexContent, EdgeContent, compact >::nextTo(), graph::VVGraph< VertexContent, EdgeContent, compact >::replace(), graph::VVGraph< VertexContent, EdgeContent, compact >::spliceAfter(), and graph::VVGraph< VertexContent, EdgeContent, compact >::spliceBefore().

00026   {
00027     typedef typename vvgraph::vertex_t vertex;
00028     typedef typename vvgraph::edge_t edge;
00029     vertex x;
00030     vertex pv = v;
00031     S.insert(x);
00032     S.spliceBefore(v,n1,x);
00033     S.insertEdge(x,v);
00034     do
00035     {
00036       const vertex& n = S.nextTo(v,x);
00037       typename edge::content_t ec = *S.edge(n,v);
00038       *S.replace(n,v,x) = ec;
00039       *S.spliceAfter(x,pv,n) = *S.edge(v,n);
00040       pv = n;
00041       S.eraseEdge(v,n);
00042     } while(pv != n2);
00043     return x;
00044   }

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Fri May 31 15:38:04 2013 for VVE by  doxygen 1.6.3