SMIL  0.9
Graph< NodeT, WeightT > Class Template Reference

Non-oriented graph. More...

#include <DGraph.hpp>

+ Inheritance diagram for Graph< NodeT, WeightT >:
+ Collaboration diagram for Graph< NodeT, WeightT >:

Public Types

typedef std::vector< Edge< NodeT, WeightT > > EdgeListType
 
typedef Edge< NodeT, WeightT > EdgeType
 
typedef WeightT EdgeWeightType
 
typedef Graph< NodeT, WeightT > GraphType
 
typedef std::map< NodeT, NodeEdgesType > NodeEdgeListType
 
typedef std::vector< size_t > NodeEdgesType
 
typedef set< NodeT > NodeListType
 
typedef NodeT NodeType
 
typedef std::map< NodeT, WeightT > NodeValuesType
 
typedef WeightT NodeWeightType
 
- Public Types inherited from BaseObject
typedef void parentClass
 
typedef void(BaseObject::* voidMemberFunc) ()
 

Public Member Functions

void addEdge (const EdgeType &e, bool checkIfExists=true)
 Add an edge to the graph. More...
 
void addEdge (const NodeT src, const NodeT targ, WeightT weight=0, bool checkIfExists=true)
 Add an edge to the graph given two nodes src and targ and an optional weight If checkIfExists is true: If the edge doen't exist, create a new one. More...
 
void addNode (const NodeT &ind)
 Add a node given its index and its optional value.
 
void addNode (const NodeT &ind, const WeightT &val)
 
void clear ()
 Clear graph content.
 
GraphType clone ()
 
GraphType computeMST ()
 Compute the Minimum Spanning Tree graph.
 
int findEdge (const EdgeType &e)
 
int findEdge (const NodeT &src, const NodeT &targ)
 
size_t getEdgeNbr ()
 
const EdgeListType & getEdges () const
 
EdgeListType & getEdges ()
 Get a vector containing the graph edges.
 
const NodeEdgeListType & getNodeEdges () const
 
NodeEdgeListType & getNodeEdges ()
 
NodeEdgesType getNodeEdges (const size_t &node)
 Get a map containing the edges linked to a given node.
 
size_t getNodeNbr ()
 
const NodeListType & getNodes () const
 
NodeListType & getNodes ()
 
const NodeValuesType & getNodeValues () const
 
NodeValuesType & getNodeValues ()
 
 Graph ()
 Default constructor.
 
 Graph (const Graph &rhs)
 Copy constructor.
 
map< NodeT, NodeT > labelizeNodes () const
 Labelize the nodes. Give a different label to each group of connected nodes. Return a map [ node, label_value ].
 
Graphoperator= (const Graph &rhs)
 
virtual void printSelf (ostream &os=std::cout, string s="") const
 
void removeEdge (const size_t index)
 Remove an edge.
 
void removeEdge (const NodeT src, const NodeT targ)
 Find and remove an edge linking src to targ.
 
void removeEdge (const EdgeType &edge)
 
void removeHighEdges (EdgeWeightType EdgeThreshold)
 
void removeLowEdges (EdgeWeightType EdgeThreshold)
 
void removeNodeEdges (const NodeT node)
 Remove all edges linked to the node nodeIndex.
 
void sortEdges (bool reverse=false)
 
- Public Member Functions inherited from BaseObject
 BaseObject (const char *_className, bool _register=true)
 
 BaseObject (const BaseObject &rhs, bool _register=true)
 
virtual size_t getAllocatedSize () const
 
virtual const char * getClassName () const
 
CoregetCoreInstance ()
 
virtual const char * getInfoString (const char *="") const
 
virtual const char * getName () const
 
BaseObjectoperator= (const BaseObject &rhs)
 
virtual void setName (const char *_name)
 

Protected Member Functions

void propagateLabel (const NodeT ind, const NodeT lbl, map< NodeT, NodeT > &lookup, set< NodeT > &nList) const
 
void removeNode (const NodeT ind)
 
void removeNodeEdge (const NodeT node, const size_t edgeIndex)
 

Protected Attributes

size_t edgeNbr
 
EdgeListType edges
 
NodeEdgeListType nodeEdgeList
 
NodeListType nodes
 
NodeValuesType nodeValues
 
- Protected Attributes inherited from BaseObject
string className
 
string name
 
bool registered
 

Additional Inherited Members

- Public Attributes inherited from BaseObject
bool triggerEvents
 

Detailed Description

template<class NodeT = size_t, class WeightT = size_t>
class smil::Graph< NodeT, WeightT >

Non-oriented graph.

See also
Edge

Member Function Documentation

void addEdge ( const EdgeType e,
bool  checkIfExists = true 
)
inline

Add an edge to the graph.

If checkIfExists is true: If the edge doen't exist, create a new one. If the edge already exists, the edge weight will be the minimum between the existing a the new weight.

void addEdge ( const NodeT  src,
const NodeT  targ,
WeightT  weight = 0,
bool  checkIfExists = true 
)
inline

Add an edge to the graph given two nodes src and targ and an optional weight If checkIfExists is true: If the edge doen't exist, create a new one.

If the edge already exists, the edge weight will be the minimum between the existing a the new weight.


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