tlp::Graph Class Reference
[Graphs]
#include <Graph.h>
Inherits tlp::ObservableGraph.
Inheritance diagram for tlp::Graph:
[legend]Collaboration diagram for tlp::Graph:
[legend]List of all members.
Detailed Description
Interface for a graph.
The class Graph is the interface of a Graph in the Tulip Library.
Public Member Functions
- Graph ()
- virtual ~Graph ()
- virtual void clear ()=0
- virtual Graph * addSubGraph (BooleanProperty *selection=0)=0
- virtual void delSubGraph (Graph *)=0
- virtual void delAllSubGraphs (Graph *)=0
- virtual Graph * getSuperGraph () const =0
- Graph * getFather () const
- virtual Graph * getRoot () const =0
- virtual void setSuperGraph (Graph *)=0
- void setFather (Graph *sg)
- virtual Iterator< Graph * > * getSubGraphs () const =0
- virtual node addNode ()=0
- virtual void addNode (const node)=0
- virtual void delNode (const node)=0
- virtual void delAllNode (const node)=0
- virtual edge addEdge (const node, const node)=0
- virtual void addEdge (const edge)=0
- virtual void delEdge (const edge)=0
- virtual void delAllEdge (const edge)=0
- virtual void setEdgeOrder (const node, const std::vector< edge > &)=0
- virtual void swapEdgeOrder (const node, const edge, const edge)=0
- virtual void reverse (const edge)=0
- virtual node getOneNode () const =0
- Return an existing node of the graph.
- virtual Iterator< node > * getNodes () const =0
- Return an iterator on the nodes.
- virtual node getInNode (const node, unsigned int) const =0
- Return the ith successor of a node.
- virtual Iterator< node > * getInNodes (const node) const =0
- Return an iterator on the predecessors of a node.
- virtual node getOutNode (const node, unsigned int) const =0
- Return the ith predecessor of a node.
- virtual Iterator< node > * getOutNodes (const node) const =0
- Return an iterator on the successors of a node.
- virtual Iterator< node > * getInOutNodes (const node) const =0
- Return an iterator on the neighbours of a node.
- virtual Iterator< edge > * getEdges () const =0
- Return an iterator on the edges.
- virtual edge getOneEdge () const =0
- Return an existing edge of the graph.
- virtual Iterator< edge > * getOutEdges (const node) const =0
- Return an iterator on the out-edges of a node.
- virtual Iterator< edge > * getInOutEdges (const node) const =0
- Return an iterator on the in-out-edges of a node.
- virtual Iterator< edge > * getInEdges (const node) const =0
- Return an iterator on the in--edges of a node.
- int getId () const
- Return the graph's id, this id is unique.
- virtual unsigned int numberOfNodes () const =0
- Return the number of nodes in the graph.
- virtual unsigned int numberOfEdges () const =0
- Return the number of edges in the graph.
- virtual unsigned int deg (const node) const =0
- Return degree of a node.
- virtual unsigned int indeg (const node) const =0
- Return indegree of a node.
- virtual unsigned int outdeg (const node) const =0
- Return outdegree of a node.
- virtual node source (const edge) const =0
- Return the source of the edge.
- virtual node target (const edge) const =0
- Return the target of the edge.
- virtual node opposite (const edge, const node) const =0
- Return the opposite node for s in the edge e.
- virtual bool isElement (const node) const =0
- Return true if the node is element of the graph.
- virtual bool isElement (const edge) const =0
- Return true if the edge is element of the graph.
- virtual edge existEdge (const node, const node) const =0
- virtual DataSet & getAttributes ()=0
- Return graph attributes.
- template<typename ATTRIBUTETYPE> ATTRIBUTETYPE getAttribute (const std::string &name)
- Get an attribute of the graph.
- template<typename ATTRIBUTETYPE> void setAttribute (const std::string &name, const ATTRIBUTETYPE &value)
- Set an attribute of the graph.
- template<typename Proxytype> Proxytype * getLocalProperty (const std::string &name)
- template<typename Proxytype> bool computeProperty (const std::string &algorithm, Proxytype result, std::string &msg, PluginProgress *progress=0, DataSet *data=0)
- template<typename Proxytype> Proxytype * getProperty (const std::string &name)
- virtual PropertyInterface * getProperty (const std::string &name)=0
- virtual bool existProperty (const std::string &name)=0
- virtual bool existLocalProperty (const std::string &name)=0
- virtual void delLocalProperty (const std::string &name)=0
- virtual void addLocalProperty (const std::string &name, PropertyInterface *prop)=0
- virtual Iterator< std::string > * getLocalProperties ()=0
- virtual Iterator< std::string > * getInheritedProperties ()=0
- virtual Iterator< std::string > * getProperties ()=0
Constructor & Destructor Documentation
virtual tlp::Graph::~Graph |
( |
|
) |
[virtual] |
|
Member Function Documentation
virtual void tlp::Graph::addEdge |
( |
const |
edge |
) |
[pure virtual] |
|
|
Add an existing edge in the graph. this edge is also added in all the super-graph of the graph to maintain the sub-graph relation between graphs. Warning, the edge must be element of the graph hierarchy, thus it must be element of the root graph. Warning : One can't add an existing edge to the root graph |
virtual edge tlp::Graph::addEdge |
( |
const |
node, |
|
|
const |
node |
|
) |
[pure virtual] |
|
|
Add a new edge in the graph and return it. This edge is also added in all the super-graph of the graph to maintain the sub-graph relation between graphs. If the second parameter is true the ordering of edges will be preserved. |
virtual void tlp::Graph::addLocalProperty |
( |
const std::string & |
name, |
|
|
PropertyInterface * |
prop |
|
) |
[pure virtual] |
|
|
add a property to the graph Be aware that the PropertyInterface will now belong to the graph object; and so it will be deleted automatically. Using of delete on that property will cause a segmentation violation (use delLocalProperty instead). |
virtual void tlp::Graph::addNode |
( |
const |
node |
) |
[pure virtual] |
|
|
Add an existing node in the graph. this node is also added in all the graph ancestors to maintain the sub_graph relation between graphs. Warning, the node must be element of the graph hierarchy, thus it must be element of the root graph. |
virtual node tlp::Graph::addNode |
( |
|
) |
[pure virtual] |
|
|
Add a new node in the graph and return it. This node is also added in all the graph ancestors to maintain the sub_graph relation between graphs. |
|
Create and return a new SubGraph of the graph The elements of the new SubGraph is those selected in the selection if there is no selection an empty SubGraph is return. |
virtual void tlp::Graph::clear |
( |
|
) |
[pure virtual] |
|
|
Remove all nodes, edges and subgraphs of the supergraph |
template<typename Proxytype> |
bool tlp::Graph::computeProperty |
( |
const std::string & |
algorithm, |
|
|
Proxytype |
result, |
|
|
std::string & |
msg, |
|
|
PluginProgress * |
progress = 0 , |
|
|
DataSet * |
data = 0 |
|
) |
|
|
|
Compute a property on this graph using an external algorithm (plug-in) The result is stored in result, Warning all information in result will be deleted If the function return false error message are stored in msg. One can give a PluginProgress to the algortihm in order to have feed back or to stop the algorithm during its computation. One can give parameter to the algorithm using the DataSet. In some cases algorithms can use this DataSet in order to give as result external information (not stored in result). |
virtual unsigned int tlp::Graph::deg |
( |
const |
node |
) |
const [pure virtual] |
|
virtual void tlp::Graph::delAllEdge |
( |
const |
edge |
) |
[pure virtual] |
|
|
Delete an edge in all the hierarchy of graphs. The ordering of edges around the node is preserved. |
virtual void tlp::Graph::delAllNode |
( |
const |
node |
) |
[pure virtual] |
|
|
Delete a node in all the hierarchy of graphs. |
virtual void tlp::Graph::delAllSubGraphs |
( |
Graph * |
|
) |
[pure virtual] |
|
|
Del the SubGraph of the graph and all its SubGraphs. |
virtual void tlp::Graph::delEdge |
( |
const |
edge |
) |
[pure virtual] |
|
|
Delete an edge in the graph. this edge is also removed in all the sub-graph of the graph to maintain the sub-graph relation between graphs. The ordering of edges is preserved. |
virtual void tlp::Graph::delLocalProperty |
( |
const std::string & |
name |
) |
[pure virtual] |
|
virtual void tlp::Graph::delNode |
( |
const |
node |
) |
[pure virtual] |
|
|
Delete a node in the graph. this node is also removed in all the sub-graph of the graph to maintain the sub-graph relation between graphs. Warning : One can't add an existing node to the root graph |
virtual void tlp::Graph::delSubGraph |
( |
Graph * |
|
) |
[pure virtual] |
|
|
Del a SubGraph of this graph. The SubGraph's SubGraphs become SubGraphs of the graph. |
virtual edge tlp::Graph::existEdge |
( |
const |
node, |
|
|
const |
node |
|
) |
const [pure virtual] |
|
|
Returns the edge if it exists an edge between two node sens of the edge is not taken into account) If no edge is found return an invalid edge. |
virtual bool tlp::Graph::existLocalProperty |
( |
const std::string & |
name |
) |
[pure virtual] |
|
|
Returns true if the propertyProxy is in the graph |
virtual bool tlp::Graph::existProperty |
( |
const std::string & |
name |
) |
[pure virtual] |
|
|
Return true if a property of that name exists in the graph or in an ancestor |
template<typename ATTRIBUTETYPE> |
ATTRIBUTETYPE tlp::Graph::getAttribute |
( |
const std::string & |
name |
) |
|
|
|
Get an attribute of the graph.
|
virtual DataSet& tlp::Graph::getAttributes |
( |
|
) |
[pure virtual] |
|
virtual Iterator<edge>* tlp::Graph::getEdges |
( |
|
) |
const [pure virtual] |
|
|
Return an iterator on the edges.
|
Graph* tlp::Graph::getFather |
( |
|
) |
const [inline] |
|
int tlp::Graph::getId |
( |
|
) |
const [inline] |
|
|
Return the graph's id, this id is unique.
|
virtual Iterator<edge>* tlp::Graph::getInEdges |
( |
const |
node |
) |
const [pure virtual] |
|
|
Return an iterator on the in--edges of a node.
|
virtual Iterator<std::string>* tlp::Graph::getInheritedProperties |
( |
|
) |
[pure virtual] |
|
|
Returns an iterator on the inherited properties |
virtual node tlp::Graph::getInNode |
( |
const |
node, |
|
|
unsigned |
int |
|
) |
const [pure virtual] |
|
|
Return the ith successor of a node.
|
virtual Iterator<node>* tlp::Graph::getInNodes |
( |
const |
node |
) |
const [pure virtual] |
|
|
Return an iterator on the predecessors of a node.
|
virtual Iterator<edge>* tlp::Graph::getInOutEdges |
( |
const |
node |
) |
const [pure virtual] |
|
|
Return an iterator on the in-out-edges of a node.
|
virtual Iterator<node>* tlp::Graph::getInOutNodes |
( |
const |
node |
) |
const [pure virtual] |
|
|
Return an iterator on the neighbours of a node.
|
virtual Iterator<std::string>* tlp::Graph::getLocalProperties |
( |
|
) |
[pure virtual] |
|
|
Returns an iterator on the local properties |
template<typename Proxytype> |
Proxytype* tlp::Graph::getLocalProperty |
( |
const std::string & |
name |
) |
|
|
|
Returns a pointer to a propertyProxy which is in the pool. The real type of the propertyproxy is tested with the template parameter. If the propertyProxy is not in the pool, a new one is created and returned. Using of delete on that property will cause a segmentation violation (use delLocalProperty instead). |
virtual Iterator<node>* tlp::Graph::getNodes |
( |
|
) |
const [pure virtual] |
|
|
Return an iterator on the nodes.
|
virtual edge tlp::Graph::getOneEdge |
( |
|
) |
const [pure virtual] |
|
|
Return an existing edge of the graph.
|
virtual node tlp::Graph::getOneNode |
( |
|
) |
const [pure virtual] |
|
|
Return an existing node of the graph.
|
virtual Iterator<edge>* tlp::Graph::getOutEdges |
( |
const |
node |
) |
const [pure virtual] |
|
|
Return an iterator on the out-edges of a node.
|
virtual node tlp::Graph::getOutNode |
( |
const |
node, |
|
|
unsigned |
int |
|
) |
const [pure virtual] |
|
|
Return the ith predecessor of a node.
|
virtual Iterator<node>* tlp::Graph::getOutNodes |
( |
const |
node |
) |
const [pure virtual] |
|
|
Return an iterator on the successors of a node.
|
virtual Iterator<std::string>* tlp::Graph::getProperties |
( |
|
) |
[pure virtual] |
|
|
Returns an iterator on the properties |
virtual PropertyInterface* tlp::Graph::getProperty |
( |
const std::string & |
name |
) |
[pure virtual] |
|
|
Returns a pointer on an existing property. If the property does not exist return 0. In DEBUG the existence of a property is checked using an assertion. |
template<typename Proxytype> |
Proxytype* tlp::Graph::getProperty |
( |
const std::string & |
name |
) |
|
|
|
Returns a pointer to a propertyProxy which is in the pool or in the pool of an ascendant The real type of the propertyproxy is tested with the template parameter. If the propertyProxy is not the pool it creates a new one and return it. Using of delete on that property will cause a segmentation violation (use delLocalProperty instead). |
virtual Graph* tlp::Graph::getRoot |
( |
|
) |
const [pure virtual] |
|
|
Returns the root graph of the graph hierarchy |
virtual Iterator<Graph *>* tlp::Graph::getSubGraphs |
( |
|
) |
const [pure virtual] |
|
|
Returns an iterator on all the SubGraphs of the graph |
virtual Graph* tlp::Graph::getSuperGraph |
( |
|
) |
const [pure virtual] |
|
|
Returns the parent of the graph, if it has no parent (is the root graph), it returns itself. |
virtual unsigned int tlp::Graph::indeg |
( |
const |
node |
) |
const [pure virtual] |
|
|
Return indegree of a node.
|
virtual bool tlp::Graph::isElement |
( |
const |
edge |
) |
const [pure virtual] |
|
|
Return true if the edge is element of the graph.
|
virtual bool tlp::Graph::isElement |
( |
const |
node |
) |
const [pure virtual] |
|
|
Return true if the node is element of the graph.
|
virtual unsigned int tlp::Graph::numberOfEdges |
( |
|
) |
const [pure virtual] |
|
|
Return the number of edges in the graph.
|
virtual unsigned int tlp::Graph::numberOfNodes |
( |
|
) |
const [pure virtual] |
|
|
Return the number of nodes in the graph.
|
virtual node tlp::Graph::opposite |
( |
const |
edge, |
|
|
const |
node |
|
) |
const [pure virtual] |
|
|
Return the opposite node for s in the edge e.
|
virtual unsigned int tlp::Graph::outdeg |
( |
const |
node |
) |
const [pure virtual] |
|
|
Return outdegree of a node.
|
virtual void tlp::Graph::reverse |
( |
const |
edge |
) |
[pure virtual] |
|
|
Reverse the direction of an edge, the source becomes the target and the target. becomes the source. Warning : The ordering is global to the entire graph hierarchy. Thus, by changing The ordering of a graph you change the ordering of the hierarchy. |
template<typename ATTRIBUTETYPE> |
void tlp::Graph::setAttribute |
( |
const std::string & |
name, |
|
|
const ATTRIBUTETYPE & |
value |
|
) |
|
|
|
Set an attribute of the graph.
|
virtual void tlp::Graph::setEdgeOrder |
( |
const |
node, |
|
|
const std::vector< edge > & |
|
|
) |
[pure virtual] |
|
|
Set the order of the edges around a node. This operation ensure that adjacent edges of a node will be odered and consecutive as they are in the vector given in parameter. |
void tlp::Graph::setFather |
( |
Graph * |
sg |
) |
[inline] |
|
virtual void tlp::Graph::setSuperGraph |
( |
Graph * |
|
) |
[pure virtual] |
|
|
Set the parent of a graph (use very carefully) Standard user should never use this function. |
virtual node tlp::Graph::source |
( |
const |
edge |
) |
const [pure virtual] |
|
|
Return the source of the edge.
|
virtual void tlp::Graph::swapEdgeOrder |
( |
const |
node, |
|
|
const |
edge, |
|
|
const |
edge |
|
) |
[pure virtual] |
|
|
Swap two edges in the adjacent list of a node. |
virtual node tlp::Graph::target |
( |
const |
edge |
) |
const [pure virtual] |
|
|
Return the target of the edge.
|
|