$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mln::util::graph Class Reference

#include <mln/util/graph.hh>

Public Member Functions

 graph ()
 graph (unsigned nvertices)
const util::tracked_ptr
< mln::internal::data< graph > > & 
data_hook_ () const
bool has_v (const vertex_id_t &id_v) const
void print_debug (std::ostream &ostr) const
edge_id_t v_ith_nbh_edge (const vertex_id_t &id_v, unsigned i) const
vertex_id_t v_ith_nbh_vertex (const vertex_id_t &id_v, unsigned i) const
size_t v_nmax () const
size_t v_nmax_nbh_edges (const vertex_id_t &id_v) const
size_t v_nmax_nbh_vertices (const vertex_id_t &id_v) const
unsigned add_vertex ()
std::pair< vertex_id_t,
vertex_id_t
add_vertices (unsigned n)
vertex_t vertex (vertex_id_t id_v) const
edge_id_t add_edge (const vertex_id_t &id_v1, const vertex_id_t &id_v2)
edge_t edge (const edge_id_t &e) const
const std::vector
< util::ord_pair< vertex_id_t > > & 
edges () const
size_t e_nmax () const
bool has_e (const edge_id_t &id_e) const
edge_t edge (const vertex_t &v1, const vertex_t &v2) const
vertex_id_t v1 (const edge_id_t &id_e) const
vertex_id_t v2 (const edge_id_t &id_e) const
size_t e_nmax_nbh_edges (const edge_id_t &id_e) const
edge_id_t e_ith_nbh_edge (const edge_id_t &id_e, unsigned i) const
template<typename G2 >
bool is_subgraph_of (const G2 &g) const
const void * id () const
bool has (const util::vertex< graph > &v) const
bool has (const util::edge< graph > &e) const
vertex_id_t v_other (const edge_id_t &id_e, const vertex_id_t &id_v) const
bool is_valid () const
void invalidate ()

Protected Attributes

util::tracked_ptr
< mln::internal::data< graph > > 
data_

Public Types

typedef Graph< void > category
typedef util::edge< graphedge_t
typedef std::set< edge_data_tedges_set_t
typedef std::vector< edge_data_tedges_t
typedef graph exact_t
typedef util::vertex< graphvertex_t
typedef std::vector
< vertex_data_t > 
vertices_t
typedef
mln::internal::vertex_fwd_iterator
< graph
vertex_fwd_iter
typedef
mln::internal::vertex_bkd_iterator
< graph
vertex_bkd_iter
typedef vertex_fwd_iter vertex_iter
typedef
mln::internal::vertex_nbh_edge_fwd_iterator
< graph
vertex_nbh_edge_fwd_iter
typedef
mln::internal::vertex_nbh_edge_bkd_iterator
< graph
vertex_nbh_edge_bkd_iter
typedef vertex_nbh_edge_fwd_iter vertex_nbh_edge_iter
typedef
mln::internal::vertex_nbh_vertex_fwd_iterator
< graph
vertex_nbh_vertex_fwd_iter
typedef
mln::internal::vertex_nbh_vertex_bkd_iterator
< graph
vertex_nbh_vertex_bkd_iter
typedef vertex_nbh_vertex_fwd_iter vertex_nbh_vertex_iter
typedef
mln::internal::edge_fwd_iterator
< graph
edge_fwd_iter
typedef
mln::internal::edge_bkd_iterator
< graph
edge_bkd_iter
typedef edge_fwd_iter edge_iter
typedef
mln::internal::edge_nbh_edge_fwd_iterator
< graph
edge_nbh_edge_fwd_iter
typedef
mln::internal::edge_nbh_edge_bkd_iterator
< graph
edge_nbh_edge_bkd_iter
typedef edge_nbh_edge_fwd_iter edge_nbh_edge_iter

Detailed Description

Undirected graph.

Definition at line 90 of file util/graph.hh.

Constructor & Destructor Documentation

mln::util::graph::graph ( )

Constructor.

mln::util::graph::graph ( unsigned  nvertices)

Construct a graph with nvertices vertices.

Member Function Documentation

edge_id_t mln::util::graph::add_edge ( const vertex_id_t id_v1,
const vertex_id_t id_v2 
)

Edge oriented.

Add an edge.

Returns
The id of the new edge if it does not exist yet; otherwise, return mln_max(unsigned).
unsigned mln::util::graph::add_vertex ( )

Vertex oriented.

Shortcuts factoring the insertion of vertices and edges.Add a vertex.

Returns
The id of the new vertex.
std::pair<vertex_id_t, vertex_id_t> mln::util::graph::add_vertices ( unsigned  n)

Add n vertices to the graph.

Returns
A range of vertex ids.
const util::tracked_ptr< mln::internal::data<graph > >& mln::util::internal::graph_base< graph >::data_hook_ ( ) const
inherited

Hook to data; for debugging purpose.

edge_id_t mln::util::graph::e_ith_nbh_edge ( const edge_id_t id_e,
unsigned  i 
) const

Return the i th edge adjacent to the edge id_e.

size_t mln::util::graph::e_nmax ( ) const

Return the number of edges in the graph.

size_t mln::util::graph::e_nmax_nbh_edges ( const edge_id_t id_e) const

Return the number max of adjacent edge, given an edge id_e.

edge_t mln::util::graph::edge ( const edge_id_t e) const

Return the edge whose id is e.

edge_t mln::util::graph::edge ( const vertex_t v1,
const vertex_t v2 
) const

Return the corresponding edge id if exists.

If it is not, returns an invalid edge.

const std::vector<util::ord_pair<vertex_id_t> >& mln::util::graph::edges ( ) const

Return the list of all edges.

bool mln::util::internal::graph_base< graph >::has ( const util::vertex< graph > &  v) const
inherited

Vertex oriented methodsCheck whether a vertex v exists in the graph.

bool mln::util::internal::graph_base< graph >::has ( const util::edge< graph > &  e) const
inherited

Edge oriented methodsCheck whether an edge e exists in the graph.

bool mln::util::graph::has_e ( const edge_id_t id_e) const

Return whether id_e is in the graph.

bool mln::util::graph::has_v ( const vertex_id_t id_v) const

Check whether a vertex id id_v exists in the graph.

const void* mln::util::internal::graph_base< graph >::id ( ) const
inherited

Misc.

methods

Returns the graph id, the "this" pointer.

void mln::util::internal::graph_base< graph >::invalidate ( )
inherited

Invalidate the graph.

template<typename G2 >
bool mln::util::graph::is_subgraph_of ( const G2 &  g) const

Return whether this graph is a subgraph Return true if g and *this have the same graph_id.

bool mln::util::internal::graph_base< graph >::is_valid ( ) const
inherited

Return true if this graph is valid.

void mln::util::internal::graph_base< graph >::print_debug ( std::ostream &  ostr) const
inherited

Print on ostr the graph.

Parameters
[in]ostrThe output stream.
vertex_id_t mln::util::graph::v1 ( const edge_id_t id_e) const

Return the first vertex associated to the edge id_e.

vertex_id_t mln::util::graph::v2 ( const edge_id_t id_e) const

Return the second vertex associated to edge id_e.

edge_id_t mln::util::graph::v_ith_nbh_edge ( const vertex_id_t id_v,
unsigned  i 
) const

Returns the i th edge adjacent to the vertex id_v.

vertex_id_t mln::util::graph::v_ith_nbh_vertex ( const vertex_id_t id_v,
unsigned  i 
) const

Returns the i th vertex adjacent to the vertex id_v.

size_t mln::util::graph::v_nmax ( ) const

Return the number of vertices in the graph.

size_t mln::util::graph::v_nmax_nbh_edges ( const vertex_id_t id_v) const

Return the number of adjacent edges of vertex id_v.

size_t mln::util::graph::v_nmax_nbh_vertices ( const vertex_id_t id_v) const

Return the number of adjacent vertices of vertex id_v.

vertex_id_t mln::util::internal::graph_base< graph >::v_other ( const edge_id_t id_e,
const vertex_id_t id_v 
) const
inherited

Vertex and edge oriented methods.

Returns the other adjacent vertex id of a given edge id id_e.

vertex_t mln::util::graph::vertex ( vertex_id_t  id_v) const

Return the vertex whose id is v.

Member Data Documentation

util::tracked_ptr< mln::internal::data<graph > > mln::util::internal::graph_base< graph >::data_
protectedinherited

Internal data, sharable by several graphs.

Definition at line 129 of file graph_base.hh.

Member Typedef Documentation

typedef Graph<void> mln::Graph< graph >::category
inherited

Definition at line 62 of file core/concept/graph.hh.

Definition at line 134 of file util/graph.hh.

The type of an edge.

Definition at line 75 of file graph_base.hh.

A set to test the presence of a given edge.

Definition at line 105 of file util/graph.hh.

typedef std::vector<edge_data_t> mln::util::graph::edges_t

The type of the set of edges.

Definition at line 103 of file util/graph.hh.

typedef graph mln::Object< graph >::exact_t
inherited

Definition at line 105 of file object.hh.

Definition at line 113 of file util/graph.hh.

The type of a vertex.

Definition at line 73 of file graph_base.hh.

typedef std::vector<vertex_data_t> mln::util::graph::vertices_t

The type of the set of vertices.

Definition at line 100 of file util/graph.hh.