Home

gedge Class Reference
[Graph Theory]

Creates an instance of a graph edge for use in graph theory. More...

#include <generic_graph.hxx>

Inheritance diagram for gedge:

Inheritance graph
[legend]
Collaboration diagram for gedge:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void add () const
 The C++ classes of gvertex and gedge are use counted in the same way that laws are use counted.
void clear_kind ()
 Sets the user-defined kind array for this graph item to NULL,kind is actually a dynamic array.
 gedge ()
 C++ allocation constructor requests memory for this object but does not populate it.
 gedge (gvertex const *in_v1, gvertex const *in_v2, double in_weight=0.0)
 Creates an instance of gedge between the two graph vertices supplied.
virtual ENTITYget_entity () const
 Returns NULL.
int get_kind_size () const
 Returns the size of the kind array.
double get_weight () const
 Gets the weight of the gedge.
logical is_kind (int which) const
 Determines whether or not this graph vertex is of the specified kind.
logical is_loop () const
 Returns TRUE if the first vertex is the same as the last vertex, thus forming a loop.
logical operator!= (gedge const &in_edge) const
 Determines whether or not the supplied graph edge is not equal to this graph edge.
logical operator== (gedge const &in_edge) const
 Determines whether or not the supplied graph edge is equal to this graph edge.
void remove ()
 The C++ classes of gvertex and gedge are use counted in the same way that laws are use counted.
void set_kind (int which, logical value)
 Assigns a user-defined kind to this graph edge.
void set_weight (double in_weight) const
 Sets the weight of the gedge.
gvertex const * vertex1 () const
 Returns the first vertex associated with this graph edge.
gvertex const * vertex2 () const
 Returns the second vertex associated with this graph edge.


Detailed Description

Creates an instance of a graph edge for use in graph theory.



Role: The concepts of vertex, edge, and graph have been implemented as the C++ classes gvertex, gedge, and generic_graph. (entity_gvertex is derived from gvertex except that it contains a pointer to an entity in the model. Such an entity could be a cell or a face.) A gvertex may be created with an optional char *name. A gedge may be created with two gvertex pointers. An empty graph may be created and edges and vertices may be added to it by calling its add_vertex and add_edge methods. Once created, a graph may be interrogated, ordered, or subsetted in a number of ways.

The C++ classes of gvertex and gedge are use counted in the same way that laws are use counted. That is to say that the are copied by calling the add method and deleted by calling the remove method.

To make a gvertex or gedge contain data, derive a class from the base classes of gvertex and gedge. Use a technique similar to the entity_gvertex class which enables it to contain an entity pointer.

See also:
gvertex

Constructor & Destructor Documentation

gedge::gedge ( gvertex const *  in_v1,
gvertex const *  in_v2,
double  in_weight = 0.0 
)

Creates an instance of gedge between the two graph vertices supplied.



Parameters:
in_v1 vertex one.
in_v2 vertex two.
in_weight weight of the edge.

gedge::gedge (  ) 

C++ allocation constructor requests memory for this object but does not populate it.


Member Function Documentation

void gedge::add (  )  const

The C++ classes of gvertex and gedge are use counted in the same way that laws are use counted.



Role: That is to say that they are copied by calling the add method and deleted by calling the remove method.

void gedge::clear_kind (  ) 

Sets the user-defined kind array for this graph item to NULL,kind is actually a dynamic array.



Role: The value argument specifies whether or not this graph edge is of the kind number specified.

virtual ENTITY* gedge::get_entity (  )  const [virtual]

Returns NULL.

int gedge::get_kind_size (  )  const

Returns the size of the kind array.

double gedge::get_weight (  )  const

Gets the weight of the gedge.

logical gedge::is_kind ( int  which  )  const

Determines whether or not this graph vertex is of the specified kind.



Parameters:
which kind to test.

logical gedge::is_loop (  )  const [inline]

Returns TRUE if the first vertex is the same as the last vertex, thus forming a loop.

logical gedge::operator!= ( gedge const &  in_edge  )  const

Determines whether or not the supplied graph edge is not equal to this graph edge.



Parameters:
in_edge test graph edge.

logical gedge::operator== ( gedge const &  in_edge  )  const

Determines whether or not the supplied graph edge is equal to this graph edge.



Parameters:
in_edge test graph edge.

void gedge::remove (  ) 

The C++ classes of gvertex and gedge are use counted in the same way that laws are use counted.



Role: That is to say that they are copied by calling the add method and deleted by calling the remove method.

void gedge::set_kind ( int  which,
logical  value 
)

Assigns a user-defined kind to this graph edge.

kind is actually a dynamic array.

Role: The value argument specifies whether or not this graph edge is of the kind number specified.

Parameters:
which kind of use.
value turn on or off.

void gedge::set_weight ( double  in_weight  )  const

Sets the weight of the gedge.



Parameters:
in_weight weight.

gvertex const* gedge::vertex1 (  )  const

Returns the first vertex associated with this graph edge.

gvertex const* gedge::vertex2 (  )  const

Returns the second vertex associated with this graph edge.