#include <graph.h>
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::NodeIter * | getNodes () const |
Get all nodes. | |
libgexf::EdgeIter * | getEdges () 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) |
void libgexf::Graph::addNode | ( | const libgexf::t_id | id | ) |
Add a node.
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.
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.
id | : node ID |
void libgexf::Graph::removeEdge | ( | const libgexf::t_id | source_id, | |
const libgexf::t_id | target_id | |||
) |
Remove an edge.
source_id | : source node ID | |
target_id | : target node ID |
bool libgexf::Graph::containsNode | ( | const libgexf::t_id | id | ) | const |
Test node existence.
id | : node ID |
bool libgexf::Graph::containsEdge | ( | const libgexf::t_id | source_id, | |
const libgexf::t_id | target_id | |||
) | const |
Test edge existence.
source_id | : source node ID | |
target_id | : target node ID |
t_id libgexf::Graph::getEdge | ( | const libgexf::t_id | source_id, | |
const libgexf::t_id | target_id | |||
) | const |
Get the edge id.
source_id | : source node ID | |
target_id | : target node ID |
NodeIter * libgexf::Graph::getNodes | ( | ) | const |
Get all nodes.
EdgeIter * libgexf::Graph::getEdges | ( | ) | const |
Get all edges.
vector< t_id > libgexf::Graph::getNeighbors | ( | const libgexf::t_id | node_id | ) | const |
Get node neighbors.
node_id | : node ID |
unsigned int libgexf::Graph::getNodeCount | ( | ) | const |
Count the nodes.
unsigned int libgexf::Graph::getEdgeCount | ( | ) | const |
Count the edges.
unsigned int libgexf::Graph::getDegree | ( | const libgexf::t_id | node_id | ) | const |
Get node degree.
node_id | : node ID |
void libgexf::Graph::clearEdges | ( | const libgexf::t_id | node_id | ) |
Delete node links.
node_id | : node ID |
void libgexf::Graph::readLock | ( | ) | throw (libgexf::ReadLockException) |
void libgexf::Graph::writeLock | ( | ) | throw (libgexf::WriteLockException) |
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:.