Back to Top page.

EGTGraph< TSG, TF > Class Template Reference

Base class template for a Graph. More...

#include <EGTGraph.h>

Collaboration diagram for EGTGraph< TSG, TF >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef TSG SubGraph
typedef EGTVector< TSG * > SubGraphs
typedef SubGraphs::Iterator SubGraphsIterator
typedef SubGraphs::ConstIterator SubGraphsConstIterator
typedef TF Fitness
typedef SubGraph::Node Node
typedef EGTVector< Node * > Nodes
typedef Nodes::Iterator NodesIterator
typedef Nodes::ConstIterator NodesConstIterator
typedef EGTGraph< TSG, TF > Self

Public Methods

 EGTGraph ()
 Default constructor.

 EGTGraph (const Self &)
 Copy constructor.

virtual ~EGTGraph ()
 Destructor.

virtual bool InitGraph ()
 Initializes this Graph.

virtual bool InitGraph (const SubGraph &)
 Initializes this Graph by using the SubGraph.

virtual bool InitGraph (const SubGraph &, const SubGraph &, UInt ope=0)
 Initializes this Graph by using the two SubGraphs.

virtual bool LoadGraph (const char *pFileName)
 Loads the data of this Graph.

virtual void SaveGraph (std::ostream &) const
 Saves the data of this Graph.

virtual void Display (std::ostream &) const
 Outputs the data of this Graph.

virtual void DisplayDot (std::ostream &) const
 Outputs the data of this Graph in Dot file format.

SubGraphCreateComplementarySubGraph (UInt uNum, UInt uMax=0) const
 Generates the complement of the SubGraph.

SubGraphGetSubGraph (UInt)
 Returns the SubGraph with the ID number.

const SubGraphGetSubGraph (UInt) const
 Returns the SubGraph with the ID number.

const SubGraphGetSubGraph (const SubGraph &, UInt *) const
 Returns a compatible SubGraph with the SubGraph.

UInt GetNumSubGraphs () const
 Returns the number of SubGraphs.

bool GetEvaluated () const
 Checks the flag indicating whether this Graph has been already evaluated.

void SetEvaluated (bool ret)
 Sets the flag indicating whether this Graph has been already evaluated.

UInt GetGraphID () const
 Returns the ID number of this Graph.

void SetGraphID (UInt ret)
 Sets the ID number of this Graph.

UInt GetNumNodes () const
 Returns the number of nodes included in this Graph.

const NodeGetNode (UInt uNodeID) const
 Returns the Node with the specified Node ID number (const version).

NodeGetNode (UInt uNodeID)
 Returns the Node with the specified Node ID number.

Float GetFitness () const
 Returns the fitness value of this Graph.

void DisplayFitness (std::ostream &, bool) const
 Outputs the data of this Graph.

UInt GetOperator () const
void SetOperator (UInt n)
UInt GetMother () const
void SetMother (UInt n)
UInt GetFather () const
void SetFather (UInt n)
void SetOrigin (UInt n)

Static Public Attributes

Nodem_tCreator = 0

Protected Types

enum  { POWERSET_LIMIT = 6 }

Protected Methods

void CreateSubGraphs () const
 Generates a set of SubGraphs.

void CreateSubGraphsPowerSet () const
 Generates all the possible SubGraphs.

void CreateSubGraphsRandomly () const
 Generates a specified number of SubGraphs randomly.

SubGraphCreateSubGraph () const
 Generates a SubGraph.

SubGraphCreateSubGraphConstraint () const
 Generates a specified number of connected SubGraphs randomly.

bool IsConnected (Nodes nodes) const
 Checks whether each node in the specified array is connected to every other node.

Nodes GetCandidates () const
 Returns the array of Nodes available for constructing SubGraphs.

void CreatePowerSet (UInt) const
 Generates the power set of the set of integer from 0 to "to"-1. @@.

void ClearSubGraphs ()
 Deletes all the SubGraphs held in this Graph.

void AssignNodeID ()
 Assigns Node ID number to each Node.

bool IsSubGraphRegistered (const SubGraph &) const
 Checks whether the newly generated SubGraph has been already registered.


Protected Attributes

UInt m_uGraphID
 Graph ID number.

Nodes m_tNodes
 Array of Nodes.

Fitness m_tFitness
 Fitness of this Graph.

bool m_bEvaluated
 Flag indicating whether this Graph has been already evaluated.

SubGraphs m_tSubGraphs
 Array of SubGraphs.


Static Protected Attributes

EGTVector< EGTVector< UInt > > m_tPowerSet
 Table for creating a list of SubGraphs.

bool m_bConstraint = false
 Flag indicating whether all the SubGraphs held in this Graph are limited to connected ones. @.


Detailed Description

template<class TSG, class TF>
class EGTGraph< TSG, TF >

Base class template for a Graph.

It is assumed that <TSG> is a subclass of EGTSubGraph,
and <TF> is a subclass of EGFitness.


Member Typedef Documentation

template<class TSG, class TF>
typedef TF EGTGraph< TSG, TF >::Fitness
 

template<class TSG, class TF>
typedef SubGraph::Node EGTGraph< TSG, TF >::Node
 

template<class TSG, class TF>
typedef EGTVector<Node*> EGTGraph< TSG, TF >::Nodes
 

template<class TSG, class TF>
typedef Nodes::ConstIterator EGTGraph< TSG, TF >::NodesConstIterator
 

template<class TSG, class TF>
typedef Nodes::Iterator EGTGraph< TSG, TF >::NodesIterator
 

template<class TSG, class TF>
typedef EGTGraph<TSG, TF> EGTGraph< TSG, TF >::Self
 

template<class TSG, class TF>
typedef TSG EGTGraph< TSG, TF >::SubGraph
 

template<class TSG, class TF>
typedef EGTVector<TSG*> EGTGraph< TSG, TF >::SubGraphs
 

template<class TSG, class TF>
typedef SubGraphs::ConstIterator EGTGraph< TSG, TF >::SubGraphsConstIterator
 

template<class TSG, class TF>
typedef SubGraphs::Iterator EGTGraph< TSG, TF >::SubGraphsIterator
 


Member Enumeration Documentation

template<class TSG, class TF>
anonymous enum [protected]
 

If the number of the Nodes derived from GetCandidate() function is equal to or smaller than this value, all the possible SubGraphs will be generated.
Otherwise, a specified number of SubGraphs will be generated.

Enumeration values:
POWERSET_LIMIT 


Constructor & Destructor Documentation

template<class TSG, class TF>
EGTGraph< TSG, TF >::EGTGraph  
 

Default constructor.

template<class TSG, class TF>
EGTGraph< TSG, TF >::EGTGraph const Self   graph
 

Copy constructor.

template<class TSG, class TF>
EGTGraph< TSG, TF >::~EGTGraph   [virtual]
 

Destructor.


Member Function Documentation

template<class TSG, class TF>
void EGTGraph< TSG, TF >::AssignNodeID   [protected]
 

Assigns Node ID number to each Node.

template<class TSG, class TF>
void EGTGraph< TSG, TF >::ClearSubGraphs   [protected]
 

Deletes all the SubGraphs held in this Graph.

template<class TSG, class TF>
TSG * EGTGraph< TSG, TF >::CreateComplementarySubGraph UInt    uNum,
UInt    uMax = 0
const
 

Generates the complement of the SubGraph.

Parameters:
uNum  [in] ID number of the SubGraph.
uMax  [in] Maximum number of Nodes of the complement.
Return values:
Generated_SubGraph 
0  Operation failed.

template<class TSG, class TF>
void EGTGraph< TSG, TF >::CreatePowerSet UInt    to const [protected]
 

Generates the power set of the set of integer from 0 to "to"-1. @@.

Parameters:
to  [in] Maximum number of the set of integer. @@

template<class TSG, class TF>
TSG * EGTGraph< TSG, TF >::CreateSubGraph   const [protected]
 

Generates a SubGraph.

Generates a SubGraph using a set of randomly-selected Nodes. The set of Nodes is derived from GetCandidates() function.

Return values:
Generated_SubGraph 
0  Operation failed.

template<class TSG, class TF>
EGTGraph< TSG, TF >::SubGraph * EGTGraph< TSG, TF >::CreateSubGraphConstraint   const [protected]
 

Generates a specified number of connected SubGraphs randomly.

Returns:

template<class TSG, class TF>
void EGTGraph< TSG, TF >::CreateSubGraphs   const [protected]
 

Generates a set of SubGraphs.

Generation algorithm is chosen according to the number of Nodes.
Number of Nodes <= POWERSET_LIMIT: Generates all the possible SubGraphs.
Number of Nodes > POWERSET_LIMIT: Generates a specified number of SubGraphs.

template<class TSG, class TF>
void EGTGraph< TSG, TF >::CreateSubGraphsPowerSet   const [protected]
 

Generates all the possible SubGraphs.

template<class TSG, class TF>
void EGTGraph< TSG, TF >::CreateSubGraphsRandomly   const [protected]
 

Generates a specified number of SubGraphs randomly.

template<class TSG, class TF>
void EGTGraph< TSG, TF >::Display std::ostream &    out const [virtual]
 

Outputs the data of this Graph.

Parameters:
out  [out] Output stream

template<class TSG, class TF>
void EGTGraph< TSG, TF >::DisplayDot std::ostream &    out const [virtual]
 

Outputs the data of this Graph in Dot file format.

template<class TSG, class TF>
void EGTGraph< TSG, TF >::DisplayFitness std::ostream &    out,
bool    title = false
const
 

Outputs the data of this Graph.

Parameters:
out  [out] Output stream
title  [in]
Return values:
true 
false 

template<class TSG, class TF>
EGTGraph< TSG, TF >::Nodes EGTGraph< TSG, TF >::GetCandidates   const [protected]
 

Returns the array of Nodes available for constructing SubGraphs.

Returns:
Array of Nodes available for constructing SubGraphs

template<class TSG, class TF>
bool EGTGraph< TSG, TF >::GetEvaluated   const [inline]
 

Checks the flag indicating whether this Graph has been already evaluated.

template<class TSG, class TF>
UInt EGTGraph< TSG, TF >::GetFather   const [inline]
 

template<class TSG, class TF>
Float EGTGraph< TSG, TF >::GetFitness   const [inline]
 

Returns the fitness value of this Graph.

template<class TSG, class TF>
UInt EGTGraph< TSG, TF >::GetGraphID   const [inline]
 

Returns the ID number of this Graph.

template<class TSG, class TF>
UInt EGTGraph< TSG, TF >::GetMother   const [inline]
 

template<class TSG, class TF>
Node* EGTGraph< TSG, TF >::GetNode UInt    uNodeID [inline]
 

Returns the Node with the specified Node ID number.

template<class TSG, class TF>
const Node* EGTGraph< TSG, TF >::GetNode UInt    uNodeID const [inline]
 

Returns the Node with the specified Node ID number (const version).

template<class TSG, class TF>
UInt EGTGraph< TSG, TF >::GetNumNodes   const [inline]
 

Returns the number of nodes included in this Graph.

template<class TSG, class TF>
UInt EGTGraph< TSG, TF >::GetNumSubGraphs   const
 

Returns the number of SubGraphs.

Returns:
The number of SubGraphs.

template<class TSG, class TF>
UInt EGTGraph< TSG, TF >::GetOperator   const [inline]
 

template<class TSG, class TF>
const TSG * EGTGraph< TSG, TF >::GetSubGraph const SubGraph   subgraph,
UInt   uNum
const
 

Returns a compatible SubGraph with the SubGraph.

Parameters:
subgraph  [in] SubGraph.
uNum  [out] ID number of the compatible SubGraph.
Return values:
Compatible_SubGraph. 
0  No compatible SubGraph exists.

template<class TSG, class TF>
const TSG * EGTGraph< TSG, TF >::GetSubGraph UInt    uNum const
 

Returns the SubGraph with the ID number.

Parameters:
uNum  [in] ID number of the SubGraph.
Returns:
SubGraph with the ID number.

template<class TSG, class TF>
TSG * EGTGraph< TSG, TF >::GetSubGraph UInt    uNum
 

Returns the SubGraph with the ID number.

Parameters:
uNum  [in] ID number of the SubGraph.
Returns:
SubGraph with the ID number.

template<class TSG, class TF>
bool EGTGraph< TSG, TF >::InitGraph const SubGraph   sub1,
const SubGraph   sub2,
UInt    ope = 0
[virtual]
 

Initializes this Graph by using the two SubGraphs.

Parameters:
sub1  [in] SubGraph
sub2  [in] SubGraph
ope  [in]
Return values:
true  The initialization succeeded.
false  The initialization failed.

template<class TSG, class TF>
bool EGTGraph< TSG, TF >::InitGraph const SubGraph   subgraph [virtual]
 

Initializes this Graph by using the SubGraph.

Parameters:
subgraph  [in] SubGraph
Return values:
true  The initialization succeeded.
false  The initialization failed.

template<class TSG, class TF>
bool EGTGraph< TSG, TF >::InitGraph   [virtual]
 

Initializes this Graph.

Return values:
true  The initialization succeeded.
false  The initialization failed.

template<class TSG, class TF>
bool EGTGraph< TSG, TF >::IsConnected Nodes    nodes const [protected]
 

Checks whether each node in the specified array is connected to every other node.

Parameters:
nodes  [in] Array of nodes
Return values:
true  Each node in the specified array is connected to every other node.
false  Otherwise.

template<class TSG, class TF>
bool EGTGraph< TSG, TF >::IsSubGraphRegistered const SubGraph   subgraph const [protected]
 

Checks whether the newly generated SubGraph has been already registered.

Parameters:
subgraph  [in] SubGraph
Return values:
true  The same SubGraph has been already registered.
false  Otherwise.

template<class TSG, class TF>
bool EGTGraph< TSG, TF >::LoadGraph const char *    pFileName [virtual]
 

Loads the data of this Graph.

Parameters:
pFileName  [in] File name
Return values:
true  The data were loaded successfully.
false  Otherwise.

template<class TSG, class TF>
void EGTGraph< TSG, TF >::SaveGraph std::ostream &    out const [virtual]
 

Saves the data of this Graph.

Parameters:
out  [out] Output stream

template<class TSG, class TF>
void EGTGraph< TSG, TF >::SetEvaluated bool    ret [inline]
 

Sets the flag indicating whether this Graph has been already evaluated.

template<class TSG, class TF>
void EGTGraph< TSG, TF >::SetFather UInt    n [inline]
 

template<class TSG, class TF>
void EGTGraph< TSG, TF >::SetGraphID UInt    ret [inline]
 

Sets the ID number of this Graph.

template<class TSG, class TF>
void EGTGraph< TSG, TF >::SetMother UInt    n [inline]
 

template<class TSG, class TF>
void EGTGraph< TSG, TF >::SetOperator UInt    n [inline]
 

template<class TSG, class TF>
void EGTGraph< TSG, TF >::SetOrigin UInt    n
 

Parameters:
n  [in]


Member Data Documentation

template<class TSG, class TF>
bool EGTGraph< TSG, TF >::m_bConstraint = false [static, protected]
 

Flag indicating whether all the SubGraphs held in this Graph are limited to connected ones. @.

@

template<class TSG, class TF>
bool EGTGraph< TSG, TF >::m_bEvaluated [protected]
 

Flag indicating whether this Graph has been already evaluated.

template<class TSG, class TF>
EGTGraph< TSG, TF >::Node * EGTGraph< TSG, TF >::m_tCreator = 0 [static]
 

template<class TSG, class TF>
Fitness EGTGraph< TSG, TF >::m_tFitness [protected]
 

Fitness of this Graph.

template<class TSG, class TF>
Nodes EGTGraph< TSG, TF >::m_tNodes [protected]
 

Array of Nodes.

template<class TSG, class TF>
EGTVector< EGTVector< UInt > > EGTGraph< TSG, TF >::m_tPowerSet [static, protected]
 

Table for creating a list of SubGraphs.

template<class TSG, class TF>
SubGraphs EGTGraph< TSG, TF >::m_tSubGraphs [protected]
 

Array of SubGraphs.

template<class TSG, class TF>
UInt EGTGraph< TSG, TF >::m_uGraphID [protected]
 

Graph ID number.


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