libgexf::Graph Class Reference

Topology structure of the graph. More...

#include <graph.h>

Inheritance diagram for libgexf::Graph:

libgexf::DirectedGraph libgexf::UndirectedGraph

List of all members.

Public Member Functions

 Graph (const Graph &orig)
 Copy constructor.
void addNode (const libgexf::t_id id)
 Add a node.
void addEdge (const libgexf::t_id id, const libgexf::t_id source_id, const libgexf::t_id target_id, const float weight=1.0, const libgexf::t_edge_type type=EDGE_UNDEF)
 Add an edge.
void removeNode (const libgexf::t_id id)
 Remove a node.
void removeEdge (const libgexf::t_id source_id, const libgexf::t_id target_id)
 Remove an edge.
bool containsNode (const libgexf::t_id id) const
 Test node existence.
bool containsEdge (const libgexf::t_id source_id, const libgexf::t_id target_id) const
 Test edge existence.
t_id getEdge (const libgexf::t_id source_id, const libgexf::t_id target_id) const
 Get the edge id.
libgexf::NodeItergetNodes () const
 Get all nodes.
libgexf::EdgeItergetEdges () const
 Get all edges.
std::vector< libgexf::t_id > getNeighbors (const libgexf::t_id node_id) const
 Get node neighbors.
unsigned int getNodeCount () const
 Count the nodes.
unsigned int getEdgeCount () const
 Count the edges.
unsigned int getDegree (const libgexf::t_id node_id) const
 Get node degree.
void clearEdges (const libgexf::t_id node_id)
 Delete node links.
void clear ()
 Clear the graph.
void clearEdges ()
 Delete all edges.
void readLock () throw (libgexf::ReadLockException)
 Set a lock on reading.
void readUnlock ()
 Unset a lock on reading.
void writeLock () throw (libgexf::WriteLockException)
 Get a lock on writing.
void writeUnlock ()
 Unset a lock on writing.
bool isReadLock ()
 Test if a read lock exists.
bool isWriteLock ()
 Test if a write lock exists.
bool isUnlock ()
 Unset all locks.

Protected Attributes

std::set< t_id > _nodes
std::map< t_id, std::map< t_id,
t_id > > 
_edges
std::map< t_id, std::set< t_id > > _reverse_edges
std::set< t_id > _bloom_edges
std::map< t_id, std::map
< t_edge_property,
t_edge_value > > 
_edges_properties
unsigned short int _rlock_count
char _lock_flag
 Flag used for determining the lock type:.

Friends

class NodeIter
class EdgeIter
std::ostream & operator<< (std::ostream &os, const Graph &o)


Detailed Description

Topology structure of the graph.

Member Function Documentation

void libgexf::Graph::addNode ( const libgexf::t_id  id  ) 

Add a node.

Parameters:
id : node ID

void libgexf::Graph::addEdge ( const libgexf::t_id  id,
const libgexf::t_id  source_id,
const libgexf::t_id  target_id,
const float  weight = 1.0,
const libgexf::t_edge_type  type = EDGE_UNDEF 
)

Add an edge.

Parameters:
id : edge ID
source_id : source node ID
target_id : target node ID
weight : weight of the edge (optional, 1.0 by default)
type : type of edge (optional, undef by default)

void libgexf::Graph::removeNode ( const libgexf::t_id  id  ) 

Remove a node.

Parameters:
id : node ID

void libgexf::Graph::removeEdge ( const libgexf::t_id  source_id,
const libgexf::t_id  target_id 
)

Remove an edge.

Parameters:
source_id : source node ID
target_id : target node ID

bool libgexf::Graph::containsNode ( const libgexf::t_id  id  )  const

Test node existence.

Parameters:
id : node ID
Returns:
true if the node exists, false otherwise

bool libgexf::Graph::containsEdge ( const libgexf::t_id  source_id,
const libgexf::t_id  target_id 
) const

Test edge existence.

Parameters:
source_id : source node ID
target_id : target node ID
Returns:
true if the edge exists, false otherwise

t_id libgexf::Graph::getEdge ( const libgexf::t_id  source_id,
const libgexf::t_id  target_id 
) const

Get the edge id.

Parameters:
source_id : source node ID
target_id : target node ID
Returns:
the edge id the edge exists, empty string otherwise

NodeIter * libgexf::Graph::getNodes (  )  const

Get all nodes.

Returns:
Iterator on the node collection

EdgeIter * libgexf::Graph::getEdges (  )  const

Get all edges.

Returns:
Iterator on the edge collection

vector< t_id > libgexf::Graph::getNeighbors ( const libgexf::t_id  node_id  )  const

Get node neighbors.

Parameters:
node_id : node ID
Returns:
Vector of nodes directly linked to the node

unsigned int libgexf::Graph::getNodeCount (  )  const

Count the nodes.

Returns:
Number of nodes

unsigned int libgexf::Graph::getEdgeCount (  )  const

Count the edges.

Returns:
Number of edges

unsigned int libgexf::Graph::getDegree ( const libgexf::t_id  node_id  )  const

Get node degree.

Parameters:
node_id : node ID
Returns:
Degree

void libgexf::Graph::clearEdges ( const libgexf::t_id  node_id  ) 

Delete node links.

Parameters:
node_id : node ID

void libgexf::Graph::readLock (  )  throw (libgexf::ReadLockException)

Set a lock on reading.

Exceptions:
ReadLockException { Unable to set the lock }

void libgexf::Graph::writeLock (  )  throw (libgexf::WriteLockException)

Get a lock on writing.

Exceptions:
WriteLockException { Unable to set the lock }


Member Data Documentation

std::set<t_id> libgexf::Graph::_nodes [protected]

Set of all nodes

std::map<t_id,std::map<t_id,t_id> > libgexf::Graph::_edges [protected]

map<source_id, map<target_id, edge_id> >

std::map<t_id,std::set<t_id> > libgexf::Graph::_reverse_edges [protected]

map<target_id, set<source_id> >

std::set<t_id> libgexf::Graph::_bloom_edges [protected]

Set of all edge_id used as a (poor) bloom filter

std::map<t_id,std::map<t_edge_property,t_edge_value> > libgexf::Graph::_edges_properties [protected]

Topological properties of edges

unsigned short int libgexf::Graph::_rlock_count [protected]

Number of read-locks

char libgexf::Graph::_lock_flag [protected]

Flag used for determining the lock type:.

  • 0 = unlocked
  • 1 = read locked
  • 2 = write locked


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

Generated on Fri Dec 11 00:33:34 2009 for libgexf by  doxygen 1.5.6