#include <graph.hh>
Public Types | |
typedef Graph< void > | category |
typedef util::edge< E > | edge_t |
The type of an edge. | |
typedef std::set< edge_data_t > | edges_set_t |
A set to test the presence of a given edge. | |
typedef std::vector< edge_data_t > | edges_t |
The type of the set of edges. | |
typedef E | exact_t |
typedef util::vertex< E > | vertex_t |
The type of a vertex. | |
typedef std::vector < vertex_data_t > | vertices_t |
The type of the set of vertices. | |
typedef mln::internal::edge_bkd_iterator < graph > | edge_bkd_iter |
typedef mln::internal::edge_fwd_iterator < graph > | edge_fwd_iter |
Edge iterators. | |
typedef edge_fwd_iter | edge_iter |
typedef mln::internal::edge_nbh_edge_bkd_iterator < graph > | edge_nbh_edge_bkd_iter |
typedef mln::internal::edge_nbh_edge_fwd_iterator < graph > | edge_nbh_edge_fwd_iter |
Edge centered edge iterators. | |
typedef edge_nbh_edge_fwd_iter | edge_nbh_edge_iter |
typedef mln::internal::vertex_bkd_iterator < graph > | vertex_bkd_iter |
typedef mln::internal::vertex_fwd_iterator < graph > | vertex_fwd_iter |
Iterator types
Vertex iterators. | |
typedef vertex_fwd_iter | vertex_iter |
typedef mln::internal::vertex_nbh_edge_bkd_iterator < graph > | vertex_nbh_edge_bkd_iter |
typedef mln::internal::vertex_nbh_edge_fwd_iterator < graph > | vertex_nbh_edge_fwd_iter |
Vertex centered edge iterators. | |
typedef vertex_nbh_edge_fwd_iter | vertex_nbh_edge_iter |
typedef mln::internal::vertex_nbh_vertex_bkd_iterator < graph > | vertex_nbh_vertex_bkd_iter |
typedef mln::internal::vertex_nbh_vertex_fwd_iterator < graph > | vertex_nbh_vertex_fwd_iter |
Vertex centered vertex iterators. | |
typedef vertex_nbh_vertex_fwd_iter | vertex_nbh_vertex_iter |
Public Member Functions | |
const util::tracked_ptr < mln::internal::data< E > > & | data_hook_ () const |
Hook to data; for debugging purpose. | |
graph (unsigned nvertices) | |
Construct a graph with nvertices vertices. | |
graph () | |
bool | has_v (const vertex_id_t &id_v) const |
Check whether a vertex id id_v exists in the graph. | |
void | print_debug (std::ostream &ostr) const |
Print on ostr the graph. | |
edge_id_t | 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 | 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 | v_nmax () const |
Return the number of vertices in the graph. | |
size_t | v_nmax_nbh_edges (const vertex_id_t &id_v) const |
Return the number of adjacent edges of vertex id_v . | |
size_t | v_nmax_nbh_vertices (const vertex_id_t &id_v) const |
Return the number of adjacent vertices of vertex id_v . | |
edge_id_t | add_edge (const vertex_id_t &id_v1, const vertex_id_t &id_v2) |
Edge oriented. | |
edge_id_t | 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 | e_nmax () const |
Return the number of edges in the graph. | |
size_t | 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 | edge (const vertex_t &v1, const vertex_t &v2) const |
@} | |
edge_t | edge (const edge_id_t &e) const |
Return the edge whose id is e. | |
const std::vector < util::ord_pair< vertex_id_t > > & | edges () const |
Return the list of all edges. | |
bool | has_e (const edge_id_t &id_e) const |
Return whether id_e is in the graph. | |
template<typename G2> | |
bool | 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. | |
vertex_id_t | v1 (const edge_id_t &id_e) const |
Return the first vertex associated to the edge id_e . | |
vertex_id_t | v2 (const edge_id_t &id_e) const |
Return the second vertex associated to edge id_e . | |
unsigned | add_vertex () |
Vertex oriented. | |
std::pair< vertex_id_t, vertex_id_t > | add_vertices (unsigned n) |
Add n vertices to the graph. | |
vertex_t | vertex (vertex_id_t id_v) const |
Return the vertex whose id is v. | |
bool | has (const util::edge< E > &e) const |
Edge oriented methods | |
bool | has (const util::vertex< E > &v) const |
Vertex oriented methods | |
const void * | id () const |
Misc. | |
void | invalidate () |
Invalidate the graph. | |
bool | is_valid () const |
Return true if this graph is valid. | |
vertex_id_t | v_other (const edge_id_t &id_e, const vertex_id_t &id_v) const |
Vertex and edge oriented methods. | |
Protected Attributes | |
util::tracked_ptr < mln::internal::data< E > > | data_ |
Internal data, sharable by several graphs. | |
Package Types | |
typedef super::edge_data_t | edge_data_t |
Internal edge data type. | |
typedef super::vertex_data_t | vertex_data_t |
Internal vertex data type. | |
Package Attributes | |
__pad0__:graph_base<graph> super | |
The super class. |
Definition at line 86 of file mln/util/graph.hh.
typedef Graph<void> mln::Graph< E >::category [inherited] |
Definition at line 129 of file mln/util/graph.hh.
typedef super::edge_data_t mln::util::graph::edge_data_t [package] |
Reimplemented from mln::util::internal::graph_base< E >.
Definition at line 92 of file mln/util/graph.hh.
Definition at line 130 of file mln/util/graph.hh.
Definition at line 136 of file mln/util/graph.hh.
Definition at line 137 of file mln/util/graph.hh.
typedef util::edge<E> mln::util::internal::graph_base< E >::edge_t [inherited] |
The type of an edge.
Reimplemented in mln::util::line_graph< G >.
Definition at line 72 of file graph_base.hh.
typedef std::set<edge_data_t> mln::util::graph::edges_set_t |
typedef std::vector<edge_data_t> mln::util::graph::edges_t |
typedef E mln::Object< E >::exact_t [inherited] |
Definition at line 108 of file mln/util/graph.hh.
typedef super::vertex_data_t mln::util::graph::vertex_data_t [package] |
Reimplemented from mln::util::internal::graph_base< E >.
Definition at line 91 of file mln/util/graph.hh.
Definition at line 109 of file mln/util/graph.hh.
typedef mln::internal::vertex_nbh_edge_bkd_iterator<graph> mln::util::graph::vertex_nbh_edge_bkd_iter |
Definition at line 115 of file mln/util/graph.hh.
Definition at line 116 of file mln/util/graph.hh.
typedef mln::internal::vertex_nbh_vertex_bkd_iterator<graph> mln::util::graph::vertex_nbh_vertex_bkd_iter |
Definition at line 122 of file mln/util/graph.hh.
Definition at line 123 of file mln/util/graph.hh.
typedef util::vertex<E> mln::util::internal::graph_base< E >::vertex_t [inherited] |
The type of a vertex.
Reimplemented in mln::util::line_graph< G >.
Definition at line 70 of file graph_base.hh.
typedef std::vector<vertex_data_t> mln::util::graph::vertices_t |
mln::util::graph::graph | ( | ) | [inline] |
Constructor.
Definition at line 279 of file mln/util/graph.hh.
References mln::util::internal::graph_base< E >::data_.
mln::util::graph::graph | ( | unsigned | nvertices | ) | [inline] |
Construct a graph with nvertices
vertices.
Definition at line 285 of file mln/util/graph.hh.
References mln::util::internal::graph_base< E >::data_.
edge_id_t mln::util::graph::add_edge | ( | const vertex_id_t & | id_v1, | |
const vertex_id_t & | id_v2 | |||
) | [inline] |
Edge oriented.
Add an edge.
mln_max(unsigned)
. Definition at line 383 of file mln/util/graph.hh.
References mln::util::internal::graph_base< E >::data_, edge(), and has_v().
Referenced by mln::make::impl::generic::influence_zone_adjacency_graph(), mln::make::impl::generic::rag_and_labeled_wsl(), mln::make::impl::generic::region_adjacency_graph(), and mln::make::voronoi().
unsigned mln::util::graph::add_vertex | ( | ) | [inline] |
Vertex oriented.
Shortcuts factoring the insertion of vertices and edges. Add a vertex.
Definition at line 296 of file mln/util/graph.hh.
References mln::util::internal::graph_base< E >::data_, and v_nmax().
Referenced by mln::make::voronoi().
std::pair< vertex_id_t, vertex_id_t > mln::util::graph::add_vertices | ( | unsigned | n | ) | [inline] |
Add n
vertices to the graph.
Definition at line 307 of file mln/util/graph.hh.
References mln::util::internal::graph_base< E >::data_, and v_nmax().
Referenced by mln::make::impl::generic::influence_zone_adjacency_graph(), mln::make::impl::generic::rag_and_labeled_wsl(), and mln::make::impl::generic::region_adjacency_graph().
const util::tracked_ptr< mln::internal::data< E > > & mln::util::internal::graph_base< E >::data_hook_ | ( | ) | const [inline, inherited] |
Hook to data; for debugging purpose.
Definition at line 266 of file graph_base.hh.
References mln::util::internal::graph_base< E >::data_.
Return the i
th edge adjacent to the edge id_e
.
Definition at line 498 of file mln/util/graph.hh.
References e_nmax(), e_nmax_nbh_edges(), has_e(), v1(), v2(), v_ith_nbh_edge(), and v_nmax_nbh_edges().
size_t mln::util::graph::e_nmax | ( | ) | const [inline] |
Return the number of edges in the graph.
Definition at line 438 of file mln/util/graph.hh.
References mln::util::internal::graph_base< E >::data_.
Referenced by e_ith_nbh_edge(), and edge().
size_t mln::util::graph::e_nmax_nbh_edges | ( | const edge_id_t & | id_e | ) | const [inline] |
Return the number max of adjacent edge, given an edge id_e
.
Definition at line 490 of file mln/util/graph.hh.
References has_e(), v1(), v2(), and v_nmax_nbh_edges().
Referenced by e_ith_nbh_edge().
graph::edge_t mln::util::graph::edge | ( | const vertex_t & | v1, | |
const vertex_t & | v2 | |||
) | const [inline] |
@}
Return the corresponding edge id if exists. If it is not, returns an invalid edge.
Definition at line 452 of file mln/util/graph.hh.
References mln::util::internal::graph_base< E >::data_, has_v(), and mln::util::vertex< G >::id().
graph::edge_t mln::util::graph::edge | ( | const edge_id_t & | e | ) | const [inline] |
Return the edge whose id is e.
Definition at line 430 of file mln/util/graph.hh.
References e_nmax().
Referenced by add_edge().
const std::vector< util::ord_pair< vertex_id_t > > & mln::util::graph::edges | ( | ) | const [inline] |
Return the list of all edges.
Definition at line 423 of file mln/util/graph.hh.
References mln::util::internal::graph_base< E >::data_.
bool mln::util::internal::graph_base< E >::has | ( | const util::edge< E > & | e | ) | const [inline, inherited] |
Edge oriented methods
Check whether an edge e
exists in the graph.
Definition at line 211 of file graph_base.hh.
References mln::exact(), and mln::util::edge< G >::id().
bool mln::util::internal::graph_base< E >::has | ( | const util::vertex< E > & | v | ) | const [inline, inherited] |
Vertex oriented methods
Check whether a vertex v
exists in the graph.
Definition at line 199 of file graph_base.hh.
References mln::exact(), and mln::util::vertex< G >::id().
bool mln::util::graph::has_e | ( | const edge_id_t & | id_e | ) | const [inline] |
Return whether id_e
is in the graph.
@{
Definition at line 445 of file mln/util/graph.hh.
References mln::util::internal::graph_base< E >::data_.
Referenced by e_ith_nbh_edge(), e_nmax_nbh_edges(), v1(), and v2().
bool mln::util::graph::has_v | ( | const vertex_id_t & | id_v | ) | const [inline] |
Check whether a vertex id id_v
exists in the graph.
Definition at line 335 of file mln/util/graph.hh.
References mln::util::internal::graph_base< E >::data_.
Referenced by add_edge(), edge(), v_ith_nbh_edge(), v_ith_nbh_vertex(), v_nmax_nbh_edges(), v_nmax_nbh_vertices(), and vertex().
const void * mln::util::internal::graph_base< E >::id | ( | ) | const [inline, inherited] |
Misc.
methods
Returns the graph id, the "this" pointer.
Definition at line 167 of file graph_base.hh.
References mln::util::internal::graph_base< E >::data_, and mln::util::tracked_ptr< T >::ptr_.
Referenced by mln::util::line_graph< G >::is_subgraph_of(), is_subgraph_of(), and mln::operator==().
void mln::util::internal::graph_base< E >::invalidate | ( | ) | [inline, inherited] |
Invalidate the graph.
Definition at line 228 of file graph_base.hh.
References mln::util::tracked_ptr< T >::clean_(), and mln::util::internal::graph_base< E >::data_.
bool mln::util::graph::is_subgraph_of | ( | const G2 & | g | ) | const [inline] |
Return whether this graph is a subgraph Return true if g and *this have the same graph_id.
Definition at line 514 of file mln/util/graph.hh.
References mln::util::internal::graph_base< E >::id().
bool mln::util::internal::graph_base< E >::is_valid | ( | ) | const [inline, inherited] |
Return true if this graph is valid.
Definition at line 220 of file graph_base.hh.
References mln::util::internal::graph_base< E >::data_.
void mln::util::internal::graph_base< E >::print_debug | ( | std::ostream & | ostr | ) | const [inline, inherited] |
Print on ostr
the graph.
[in] | ostr | The output stream. |
Definition at line 241 of file graph_base.hh.
References mln::exact().
vertex_id_t mln::util::graph::v1 | ( | const edge_id_t & | id_e | ) | const [inline] |
Return the first vertex associated to the edge id_e
.
Definition at line 474 of file mln/util/graph.hh.
References mln::util::internal::graph_base< E >::data_, and has_e().
Referenced by e_ith_nbh_edge(), and e_nmax_nbh_edges().
vertex_id_t mln::util::graph::v2 | ( | const edge_id_t & | id_e | ) | const [inline] |
Return the second vertex associated to edge id_e
.
Definition at line 482 of file mln/util/graph.hh.
References mln::util::internal::graph_base< E >::data_, and has_e().
Referenced by e_ith_nbh_edge(), and e_nmax_nbh_edges().
edge_id_t mln::util::graph::v_ith_nbh_edge | ( | const vertex_id_t & | id_v, | |
unsigned | i | |||
) | const [inline] |
Returns the i
th edge adjacent to the vertex id_v
.
Definition at line 350 of file mln/util/graph.hh.
References mln::util::internal::graph_base< E >::data_, has_v(), and v_nmax_nbh_edges().
Referenced by e_ith_nbh_edge(), and v_ith_nbh_vertex().
vertex_id_t mln::util::graph::v_ith_nbh_vertex | ( | const vertex_id_t & | id_v, | |
unsigned | i | |||
) | const [inline] |
Returns the i
th vertex adjacent to the vertex id_v
.
Definition at line 368 of file mln/util/graph.hh.
References has_v(), v_ith_nbh_edge(), and mln::util::internal::graph_base< E >::v_other().
size_t mln::util::graph::v_nmax | ( | ) | const [inline] |
Return the number of vertices in the graph.
Definition at line 328 of file mln/util/graph.hh.
References mln::util::internal::graph_base< E >::data_.
Referenced by add_vertex(), and add_vertices().
size_t mln::util::graph::v_nmax_nbh_edges | ( | const vertex_id_t & | id_v | ) | const [inline] |
Return the number of adjacent edges of vertex id_v
.
Definition at line 342 of file mln/util/graph.hh.
References mln::util::internal::graph_base< E >::data_, and has_v().
Referenced by e_ith_nbh_edge(), e_nmax_nbh_edges(), v_ith_nbh_edge(), and v_nmax_nbh_vertices().
size_t mln::util::graph::v_nmax_nbh_vertices | ( | const vertex_id_t & | id_v | ) | const [inline] |
Return the number of adjacent vertices of vertex id_v
.
Definition at line 360 of file mln/util/graph.hh.
References has_v(), and v_nmax_nbh_edges().
vertex_id_t mln::util::internal::graph_base< E >::v_other | ( | const edge_id_t & | id_e, | |
const vertex_id_t & | id_v | |||
) | const [inline, inherited] |
Vertex and edge oriented methods.
Returns the other adjacent vertex id of a given edge id id_e
.
Definition at line 179 of file graph_base.hh.
References mln::exact().
Referenced by mln::util::line_graph< G >::v_ith_nbh_vertex(), and v_ith_nbh_vertex().
graph::vertex_t mln::util::graph::vertex | ( | vertex_id_t | id_v | ) | const [inline] |
Return the vertex whose id is v.
Definition at line 319 of file mln/util/graph.hh.
References has_v().
mln::util::graph::__pad0__ [package] |
util::tracked_ptr< mln::internal::data<E> > mln::util::internal::graph_base< E >::data_ [protected, inherited] |
Internal data, sharable by several graphs.
Definition at line 126 of file graph_base.hh.
Referenced by add_edge(), add_vertex(), add_vertices(), mln::util::internal::graph_base< E >::data_hook_(), mln::util::line_graph< G >::e_nmax(), e_nmax(), edge(), edges(), mln::util::line_graph< G >::graph(), graph(), mln::util::line_graph< G >::has_e(), has_e(), mln::util::line_graph< G >::has_v(), has_v(), mln::util::internal::graph_base< E >::id(), mln::util::internal::graph_base< E >::invalidate(), mln::util::internal::graph_base< E >::is_valid(), mln::util::line_graph< G >::line_graph(), mln::util::line_graph< G >::v1(), v1(), mln::util::line_graph< G >::v2(), v2(), mln::util::line_graph< G >::v_ith_nbh_edge(), v_ith_nbh_edge(), mln::util::line_graph< G >::v_nmax(), v_nmax(), mln::util::line_graph< G >::v_nmax_nbh_edges(), and v_nmax_nbh_edges().