Classes | Public Types | Public Member Functions | Private Attributes | Friends
bgrl_graph Class Reference

The graph. More...

#include <bgrl_graph.h>

Inheritance diagram for bgrl_graph:
Inheritance graph
[legend]

List of all members.

Classes

class  iterator

Public Types

typedef vcl_set
< bgrl_vertex_sptr >::iterator 
vertex_iterator
typedef vcl_set
< bgrl_edge_sptr >::iterator 
edge_iterator

Public Member Functions

 bgrl_graph ()
 Constructor.
 bgrl_graph (const bgrl_graph &graph)
 Copy Constructor.
virtual ~bgrl_graph ()
 Destructor.
bool add_vertex (const bgrl_vertex_sptr &vertex)
 Adds a new vertex to the graph.
bool remove_vertex (const bgrl_vertex_sptr &vertex)
 Deletes a vertex in the graph.
bgrl_edge_sptr add_edge (const bgrl_vertex_sptr &v1, const bgrl_vertex_sptr &v2, const bgrl_edge_sptr &model_edge=NULL)
 Add an edge between v1 and v2.
bool remove_edge (const bgrl_vertex_sptr &v1, const bgrl_vertex_sptr &v2)
 Add an edge between v1 and v2.
bool purge ()
 Remove all edges to NULL vertices and vertices not found in this graph.
int size () const
 Returns the number of vertices in the graph.
virtual vcl_string is_a () const
 Return a platform independent string identifying the class.
virtual bgrl_graphclone () const
 Create a copy of the object on the heap.
void b_write (vsl_b_ostream &os) const
 Binary save self to stream.
void b_read (vsl_b_istream &is)
 Binary load self from stream.
short version () const
 Return IO version number;.
void print_summary (vcl_ostream &os) const
 Print an ascii summary to the stream.
iterator begin (const bgrl_search_func_sptr &func=NULL)
 Depth first search begin iterator.
iterator end ()
 Depth first search end iterator.
void ref ()
void unref ()
int get_references () const
bool is_referenced () const

Private Attributes

vcl_set< bgrl_vertex_sptrvertices_
 The vector of vertices.

Friends

class bgrl_graph::iterator

Detailed Description

The graph.

Definition at line 34 of file bgrl_graph.h.


Member Typedef Documentation

Definition at line 39 of file bgrl_graph.h.

Definition at line 38 of file bgrl_graph.h.


Constructor & Destructor Documentation

bgrl_graph::bgrl_graph ( )

Constructor.

Definition at line 12 of file bgrl_graph.cxx.

bgrl_graph::bgrl_graph ( const bgrl_graph graph)

Copy Constructor.

Note:
this provides a deep copy of the graph

Definition at line 18 of file bgrl_graph.cxx.

virtual bgrl_graph::~bgrl_graph ( ) [inline, virtual]

Destructor.

Definition at line 49 of file bgrl_graph.h.


Member Function Documentation

bgrl_edge_sptr bgrl_graph::add_edge ( const bgrl_vertex_sptr v1,
const bgrl_vertex_sptr v2,
const bgrl_edge_sptr model_edge = NULL 
)

Add an edge between v1 and v2.

Definition at line 77 of file bgrl_graph.cxx.

bool bgrl_graph::add_vertex ( const bgrl_vertex_sptr vertex)

Adds a new vertex to the graph.

Return values:
trueif the vertex was added
falseif the vertex could not be added

Definition at line 53 of file bgrl_graph.cxx.

void bgrl_graph::b_read ( vsl_b_istream is)

Binary load self from stream.

Definition at line 174 of file bgrl_graph.cxx.

void bgrl_graph::b_write ( vsl_b_ostream os) const

Binary save self to stream.

Definition at line 163 of file bgrl_graph.cxx.

iterator bgrl_graph::begin ( const bgrl_search_func_sptr func = NULL) [inline]

Depth first search begin iterator.

Definition at line 143 of file bgrl_graph.h.

bgrl_graph * bgrl_graph::clone ( ) const [virtual]

Create a copy of the object on the heap.

The caller is responsible for deletion

Definition at line 155 of file bgrl_graph.cxx.

iterator bgrl_graph::end ( ) [inline]

Depth first search end iterator.

Definition at line 145 of file bgrl_graph.h.

vcl_string bgrl_graph::is_a ( ) const [virtual]

Return a platform independent string identifying the class.

Definition at line 146 of file bgrl_graph.cxx.

void bgrl_graph::print_summary ( vcl_ostream &  os) const

Print an ascii summary to the stream.

Definition at line 202 of file bgrl_graph.cxx.

bool bgrl_graph::purge ( )

Remove all edges to NULL vertices and vertices not found in this graph.

Remove all edges to NULL vertices and vertex not found in this graph.

Return values:
trueif any edges have been purged
falseif all edges were found to be valid

Definition at line 103 of file bgrl_graph.cxx.

bool bgrl_graph::remove_edge ( const bgrl_vertex_sptr v1,
const bgrl_vertex_sptr v2 
)

Add an edge between v1 and v2.

Remove an edge between v1 and v2.

Definition at line 94 of file bgrl_graph.cxx.

bool bgrl_graph::remove_vertex ( const bgrl_vertex_sptr vertex)

Deletes a vertex in the graph.

Return values:
trueif the vertex was deleted
falseif the vertex was not found in the graph

Definition at line 63 of file bgrl_graph.cxx.

int bgrl_graph::size ( ) const

Returns the number of vertices in the graph.

Returns the number of vertices in the graph;.

Definition at line 138 of file bgrl_graph.cxx.

short bgrl_graph::version ( ) const

Return IO version number;.

Definition at line 210 of file bgrl_graph.cxx.


Friends And Related Function Documentation

friend class bgrl_graph::iterator [friend]

Definition at line 140 of file bgrl_graph.h.


Member Data Documentation

The vector of vertices.

Definition at line 98 of file bgrl_graph.h.


The documentation for this class was generated from the following files: