Tulip
4.2.0
Better Visualization Through Research
|
#include <Graph.h>
Inherits tlp::Observable.
Public Member Functions | |
virtual Graph * | addCloneSubGraph (std::string name="unnamed") |
virtual edge | addEdge (const node source, const node target)=0 |
virtual void | addEdge (const edge e)=0 |
virtual void | addEdges (const std::vector< std::pair< node, node > > &edges, std::vector< edge > &addedEdges)=0 |
virtual void | addEdges (Iterator< edge > *edges)=0 |
void _DEPRECATED | addGraphObserver (Observable *) const |
virtual void | addLocalProperty (const std::string &name, PropertyInterface *prop)=0 |
virtual node | addNode ()=0 |
virtual void | addNode (const node n)=0 |
virtual void | addNodes (unsigned int nbNodes, std::vector< node > &addedNodes)=0 |
virtual void | addNodes (Iterator< node > *nodes)=0 |
virtual Graph * | addSubGraph (BooleanProperty *selection=NULL, std::string name="unnamed")=0 |
Graph * | addSubGraph (std::string name) |
bool | applyAlgorithm (const std::string &algorithm, std::string &errorMessage, DataSet *dataSet=NULL, PluginProgress *progress=NULL) |
bool | applyPropertyAlgorithm (const std::string &algorithm, PropertyInterface *result, std::string &errorMessage, PluginProgress *progress=NULL, DataSet *parameters=NULL) |
bool | attributeExist (const std::string &name) |
virtual Iterator< node > * | bfs (const node root=node()) const =0 |
virtual bool | canPop ()=0 |
virtual bool | canPopThenUnpop ()=0 |
virtual bool | canUnpop ()=0 |
virtual void | clear ()=0 |
template<typename PropertyType > | |
_DEPRECATED bool | computeProperty (const std::string &algorithm, PropertyType *result, std::string &msg, PluginProgress *progress=NULL, DataSet *data=NULL) |
node | createMetaNode (const std::set< node > &nodeSet, bool multiEdges=true, bool delAllEdge=true) |
node | createMetaNode (Graph *subGraph, bool multiEdges=true, bool delAllEdge=true) |
void | createMetaNodes (Iterator< Graph * > *itS, Graph *quotientGraph, std::vector< node > &metaNodes) |
virtual unsigned int | deg (const node n) const =0 |
virtual void | delAllSubGraphs (Graph *graph)=0 |
virtual void | delEdge (const edge e, bool deleteInAllGraphs=false)=0 |
virtual void | delEdges (Iterator< edge > *itE, bool deleteInAllGraphs=false)=0 |
virtual void | delLocalProperty (const std::string &name)=0 |
virtual void | delNode (const node n, bool deleteInAllGraphs=false)=0 |
virtual void | delNodes (Iterator< node > *it, bool deleteInAllGraphs=false)=0 |
virtual Iterator< node > * | dfs (const node root=node()) const =0 |
virtual const std::pair< node, node > & | ends (const edge e) const =0 |
virtual edge | existEdge (const node source, const node target, bool directed=true) const =0 |
virtual bool | existLocalProperty (const std::string &name) const =0 |
virtual bool | existProperty (const std::string &name) const =0 |
template<typename ATTRIBUTETYPE > | |
bool | getAttribute (const std::string &name, ATTRIBUTETYPE &value) const |
DataType * | getAttribute (const std::string &name) const |
const DataSet & | getAttributes () const |
virtual Graph * | getDescendantGraph (unsigned int id) const =0 |
virtual Graph * | getDescendantGraph (const std::string &name) const =0 |
virtual Iterator< edge > * | getEdgeMetaInfo (const edge metaEdge) const =0 |
virtual Iterator< edge > * | getEdges () const =0 |
virtual std::vector< edge > | getEdges (const node source, const node target, bool directed=true) const =0 |
unsigned int | getId () const |
virtual Iterator< edge > * | getInEdges (const node n) const =0 |
virtual Iterator < PropertyInterface * > * | getInheritedObjectProperties () const =0 |
virtual Iterator< std::string > * | getInheritedProperties () const =0 |
virtual node | getInNode (const node n, unsigned int i) const =0 |
virtual Iterator< node > * | getInNodes (const node n) const =0 |
virtual Iterator< edge > * | getInOutEdges (const node n) const =0 |
virtual Iterator< node > * | getInOutNodes (const node n) const =0 |
virtual Iterator < PropertyInterface * > * | getLocalObjectProperties () const =0 |
virtual Iterator< std::string > * | getLocalProperties () const =0 |
template<typename PropertyType > | |
PropertyType * | getLocalProperty (const std::string &name) |
PropertyInterface * | getLocalProperty (const std::string &propertyName, const std::string &propertyType) |
virtual std::string | getName () const =0 |
virtual Graph * | getNodeMetaInfo (const node metaNode) const =0 |
virtual Iterator< node > * | getNodes () const =0 |
virtual Graph * | getNthSubGraph (unsigned int n) const |
virtual Iterator < PropertyInterface * > * | getObjectProperties () const =0 |
virtual edge | getOneEdge () const =0 |
virtual node | getOneNode () const =0 |
virtual Iterator< edge > * | getOutEdges (const node n) const =0 |
virtual node | getOutNode (const node n, unsigned int i) const =0 |
virtual Iterator< node > * | getOutNodes (const node n) const =0 |
virtual Iterator< std::string > * | getProperties () const =0 |
virtual PropertyInterface * | getProperty (const std::string &name) const =0 |
template<typename PropertyType > | |
PropertyType * | getProperty (const std::string &name) |
PropertyInterface * | getProperty (const std::string &propertyName, const std::string &propertyType) |
virtual Graph * | getRoot () const =0 |
virtual tlp::node | getSource () const |
virtual Graph * | getSubGraph (unsigned int id) const =0 |
virtual Graph * | getSubGraph (const std::string &name) const =0 |
virtual Iterator< Graph * > * | getSubGraphs () const =0 |
virtual Graph * | getSuperGraph () const =0 |
virtual bool | hasEdge (const node source, const node target, bool directed=true) const |
virtual unsigned int | indeg (const node n) const =0 |
Graph * | inducedSubGraph (const std::set< node > &nodeSet, Graph *parentSubGraph=NULL) |
virtual bool | isDescendantGraph (const Graph *subGraph) const =0 |
virtual bool | isElement (const node n) const =0 |
virtual bool | isElement (const edge e) const =0 |
virtual bool | isMetaEdge (const edge e) const =0 |
virtual bool | isMetaNode (const node n) const =0 |
virtual bool | isSubGraph (const Graph *subGraph) const =0 |
virtual unsigned int | numberOfDescendantGraphs () const =0 |
virtual unsigned int | numberOfEdges () const =0 |
virtual unsigned int | numberOfNodes () const =0 |
virtual unsigned int | numberOfSubGraphs () const =0 |
void | openMetaNode (node n, bool updateProperties=true) |
virtual node | opposite (const edge e, const node n) const =0 |
virtual unsigned int | outdeg (const node n) const =0 |
virtual void | pop (bool unpopAllowed=true)=0 |
virtual void | push (bool unpopAllowed=true, std::vector< PropertyInterface * > *propertiesToPreserveOnPop=NULL)=0 |
void | removeAttribute (const std::string &name) |
void _DEPRECATED | removeGraphObserver (Observable *) const |
virtual void | reserveEdges (unsigned int nbEdges)=0 |
virtual void | reserveNodes (unsigned int nbNodes)=0 |
virtual void | reverse (const edge e)=0 |
template<typename ATTRIBUTETYPE > | |
void | setAttribute (const std::string &name, const ATTRIBUTETYPE &value) |
void | setAttribute (const std::string &name, const DataType *value) |
virtual void | setEdgeOrder (const node n, const std::vector< edge > &edges)=0 |
virtual void | setEnds (const edge e, const node source, const node target)=0 |
virtual void | setName (const std::string &name)=0 |
virtual void | setSource (const edge e, const node source)=0 |
virtual void | setSuperGraph (Graph *)=0 |
virtual void | setTarget (const edge e, const node target)=0 |
virtual node | source (const edge e) const =0 |
virtual void | swapEdgeOrder (const node n, const edge e1, const edge e2)=0 |
virtual node | target (const edge e) const =0 |
virtual void | unpop ()=0 |
Public Member Functions inherited from tlp::Observable | |
void | addListener (Observable *const listener) const |
void | addObserver (Observable *const observer) const |
unsigned int | countListeners () const |
unsigned int | countObservers () const |
unsigned int | getReceived () const |
unsigned int | getSent () const |
void | removeListener (Observable *const listener) const |
void | removeObserver (Observable *const observerver) const |
Protected Member Functions | |
virtual bool | canDeleteProperty (Graph *g, PropertyInterface *prop) |
virtual void | clearSubGraphs ()=0 |
virtual DataSet & | getNonConstAttributes ()=0 |
void | notifyAddEdge (const edge e) |
void | notifyAddEdge (Graph *, const edge e) |
void | notifyAddLocalProperty (const std::string &) |
void | notifyAddLocalProperty (Graph *, const std::string &name) |
void | notifyAddNode (const node n) |
void | notifyAddNode (Graph *, const node n) |
void | notifyAfterAddDescendantGraph (const Graph *) |
void | notifyAfterAddSubGraph (const Graph *) |
void | notifyAfterAddSubGraph (Graph *, const Graph *sg) |
void | notifyAfterDelDescendantGraph (const Graph *) |
void | notifyAfterDelLocalProperty (const std::string &) |
void | notifyAfterDelSubGraph (const Graph *) |
void | notifyAfterDelSubGraph (Graph *, const Graph *sg) |
void | notifyAfterSetAttribute (const std::string &) |
void | notifyAfterSetAttribute (Graph *, const std::string &name) |
void | notifyAfterSetEnds (const edge e) |
void | notifyAfterSetEnds (Graph *, const edge e) |
void | notifyBeforeAddDescendantGraph (const Graph *) |
void | notifyBeforeAddLocalProperty (const std::string &) |
void | notifyBeforeAddSubGraph (const Graph *) |
void | notifyBeforeAddSubGraph (Graph *, const Graph *sg) |
void | notifyBeforeDelDescendantGraph (const Graph *) |
void | notifyBeforeDelLocalProperty (const std::string &) |
void | notifyBeforeDelSubGraph (const Graph *) |
void | notifyBeforeDelSubGraph (Graph *, const Graph *sg) |
void | notifyBeforeSetAttribute (const std::string &) |
void | notifyBeforeSetAttribute (Graph *, const std::string &name) |
void | notifyBeforeSetEnds (const edge e) |
void | notifyBeforeSetEnds (Graph *, const edge e) |
void | notifyDelEdge (const edge e) |
void | notifyDelEdge (Graph *, const edge e) |
void | notifyDelLocalProperty (Graph *, const std::string &name) |
void | notifyDelNode (const node n) |
void | notifyDelNode (Graph *, const node n) |
void | notifyDestroy () |
void | notifyDestroy (Graph *) |
void | notifyRemoveAttribute (const std::string &) |
void | notifyRemoveAttribute (Graph *, const std::string &name) |
void | notifyReverseEdge (const edge e) |
void | notifyReverseEdge (Graph *, const edge e) |
virtual void | removeEdge (const edge)=0 |
virtual void | removeNode (const node)=0 |
virtual void | removeSubGraph (Graph *)=0 |
virtual edge | restoreEdge (edge, node source, node target)=0 |
virtual void | restoreEdges (const std::vector< edge > &edges, const std::vector< std::pair< node, node > > &ends)=0 |
virtual node | restoreNode (node)=0 |
virtual void | restoreNodes (const std::vector< node > &nodes)=0 |
virtual void | restoreSubGraph (Graph *)=0 |
virtual void | setSubGraphToKeep (Graph *)=0 |
Protected Member Functions inherited from tlp::Observable | |
Observable (const Observable &) | |
tlp::Iterator< tlp::Observable * > * | getObservables () const |
bool | hasOnlookers () const |
void | notifyObservers () |
void | observableDeleted () |
Observable & | operator= (const Observable &) |
void | sendEvent (const Event &message) |
virtual void | treatEvent (const Event &message) |
virtual void | treatEvents (const std::vector< Event > &events) |
Protected Attributes | |
TLP_HASH_MAP< std::string, tlp::PropertyInterface * > | circularCalls |
unsigned int | id |
Friends | |
class | GraphAbstract |
class | GraphDecorator |
class | GraphUpdatesRecorder |
class | PropertyManager |
Additional Inherited Members | |
Static Public Member Functions inherited from tlp::Observable | |
static Observable * | getObject (tlp::node n) |
static const tlp::VectorGraph & | getObservableGraph () |
static void | holdObservers () |
static bool | isAlive (tlp::node n) |
static unsigned int | observersHoldCounter () |
static void | unholdObservers () |
The class Graph is the interface of a Graph in the Tulip Library.
There are a few principles to know when working with a Tulip Graph.
Directed Every edge is directed in a Tulip Graph. You can choose to ignore this, but every edge has a source and destination.
Inheritance
Subgraphs inherit from their parent graph. This is true of nodes and edges; every node and edge in a subgraph also exists in each of its parent graphs. This is also true of properties; every property in a graph exist in all of its subgraphs, except if it has been replaced by a local property.
For instance, ig you have the following graph hierarchy: root / \ A B
Every node in A is in root, and every node in B is in root. Nodes can be in A and root but not B; or in B and root but not A.
For instance, imagine a graph. You want to compare it to its Delaunay triangulation. You need to create a subgraph that is a clone of the original (say this is A) to keep the original graph, and another copy (say this one is B) on which you will perform the delaunay triangulation.
B will have none of the original edges, and A will have only the original edges.
As for properties; let's imagine the same graph hierarchy. You want to compare two different layouts on the same graph. You need to create two clone subgraphs, on each you make the 'viewLayout' property local. This results in A and B having different values for the layout, but everything else in common. You then can apply two different algorithms on A and B (e.g. Bubble Tree and Tree Radial).
Meta Nodes A meta node is a node representing a subgraph of the current graph.
Undo Redo The Tulip Graph object supports for undo and redo of modifications. *The operations affect the whole graph hierarchy, and cannot be limited to a subgraph.
|
virtual |
Creates and returns a subgraph of this graph that contains all its elements.
name | The name of the newly created subgraph. Defaults to "unnamed". |
Adds a new edge in the graph This edge is also added in all the super-graph of the graph.
source | The source of the edge. |
target | The target of the edge. |
|
pure virtual |
Adds an existing edge in the graph. This edge is also added in all the ancestor graphs. The edge must be an element of the graph hierarchy, thus it must be an element of the root graph.
e | The edge to add to this subgraph. |
|
pure virtual |
Adds new edges in the graph and returns them the addedEdges vector. The new edges are also added in all the graph ancestors.
edges | A vector describing between which nodes to add edges. The first element of the pair is the source, the second is the destination. |
addedEdges | The newly added edges. This vector is cleared before being filled. |
|
pure virtual |
Adds existing edges in the graph. The edges are also added in all the ancestor graphs. The added edges must be elements of the graph hierarchy, thus they must be elements of the root graph.
edges | The edges to add on this subgraph. |
|
pure virtual |
Adds a property to the graph. The graph takes ownership of the property. If you want to delete it, use Graph::delLocalProperty().
name | The unique identifier of the property. |
prop | The property to add. |
|
pure virtual |
Adds a new node in the graph and returns it. This node is also added in all the ancestor graphs.
|
pure virtual |
Adds an existing node in the graph. This node is also added in all the ancestor graphs. This node must exists in the graph hierarchy (which means it must exist in the root graph). You cannot add a node to the root graph this way (as it must already be an element of the root graph).
n | The node to add to a subgraph. This node must exist in the root graph. |
|
pure virtual |
|
pure virtual |
Adds existing nodes in the graph. The nodes are also added in all the ancestor graphs. as with addNode(const tlp::node), the nodes must exist in the graph hierarchy and thus exist in the root graph, and node cannot be added this way to the root graph.
nodes | An iterator over nodes to add to this subgraph. The graph does not takes ownership of this iterator. |
|
pure virtual |
Creates and returns a new sub-graph of this graph.
If a BooleanProperty is provided, all the nodes and edges for which it is true will be added to the subgraph. If none is provided, then the subgraph will be empty.
The id parameter should only be provided if you know exactly what you are doing; as Tulip will manage the subgraphs IDs when left to 0. It is only used by the Graph loading as subgraphs ids are preserved when saving/loading a Graph.
selection | The elements to add to the new subgraph. Defaults to 0. |
name | The name of the newly created subgraph. Defaults to "unnamed". |
Graph* tlp::Graph::addSubGraph | ( | std::string | name | ) |
Creates and returns a new named sub-graph of this graph.
name | The name of the newly created subgraph. |
bool tlp::Graph::applyAlgorithm | ( | const std::string & | algorithm, |
std::string & | errorMessage, | ||
DataSet * | dataSet = NULL , |
||
PluginProgress * | progress = NULL |
||
) |
Applies an algorithm plugin, identified by its name. Algorithm plugins are subclasses of the tlp::Algorithm interface. Parameters are transmitted to the algorithm trough the DataSet. To determine a plugin's parameters, you can either:
If an error occurs, a message describing the error should be stored in errorMessage.
algorithm | The algorithm to apply. |
errorMessage | A string that will be modified to contain an error message should an error occur. |
dataSet | The parameters to the algorithm. Defaults to NULL. |
progress | A PluginProgress to report the progress of the operation, as well as final state. Defaults to NULL. |
bool tlp::Graph::applyPropertyAlgorithm | ( | const std::string & | algorithm, |
PropertyInterface * | result, | ||
std::string & | errorMessage, | ||
PluginProgress * | progress = NULL , |
||
DataSet * | parameters = NULL |
||
) |
Runs a plugin on the graph, whose result is a property.
algorithm | The name of the plugin to run. |
result | The property in which to put the results. All previous values will be erased. |
errorMessage | Stores the error message if the plugin fails. |
progress | A means of feedback during the plugin execution. Some plugins support being stopped or cancelled through this. |
parameters | The parameters of the algorithm. Some algorithms use this DataSet to output some additional informations. |
|
inline |
Gets an iterator performing a breadth-first search on the graph.
root | The node from whom to start the BFS. If not provided, the root node will be assigned to a source node in the graph (node with input degree equals to 0). If there is no source node in the graph, a random node will be picked. |
|
pure virtual |
|
pure virtual |
Checks if it is possible to call pop() and then unPop(), to undo then re-do modifications.
|
pure virtual |
Checks if the last undone modifications can be redone.
|
pure virtual |
Removes all nodes, edges and sub-graphs from this graph.
Contrarily to creating a new Graph, this keeps attributes and properties.
node tlp::Graph::createMetaNode | ( | const std::set< node > & | nodeSet, |
bool | multiEdges = true , |
||
bool | delAllEdge = true |
||
) |
Creates a meta-node from a set of nodes. Every edges from any node in the set to another node of the graph will be replaced with meta edges from the meta node to the other nodes.
nodeSet | The nodes to put into the meta node. |
multiEdges | Whether a meta edge should be created for each underlying edge. |
delAllEdge | Whether the underlying edges will be removed from the whole hierarchy. |
node tlp::Graph::createMetaNode | ( | Graph * | subGraph, |
bool | multiEdges = true , |
||
bool | delAllEdge = true |
||
) |
Closes an existing subgraph into a metanode. Edges from nodes in the subgraph to nodes outside the subgraph are replaced with edges from the metanode to the nodes outside the subgraph.
subGraph | an existing subgraph |
multiEdges | indicates if a meta edge will be created for each underlying edge |
delAllEdge | indicates if the underlying edges will be removed from the entire hierarchy |
void tlp::Graph::createMetaNodes | ( | Iterator< Graph * > * | itS, |
Graph * | quotientGraph, | ||
std::vector< node > & | metaNodes | ||
) |
Populates a quotient graph with one meta node for each iterated graph.
itS | a Graph iterator, (typically a subgraph iterator) |
quotientGraph | the graph that will contain the meta nodes |
metaNodes | will contains all the added meta nodes after the call |
|
pure virtual |
n | The node to get the degree of. |
|
pure virtual |
Deletes a sub-graph of this graph. All subgraphs of the removed graph are re-parented to this graph. For instance, with a graph hierarchy as follows : root / \ A B /|\ C D E.
would result in the following hierarchy: root | A
graph | The subgraph to delete. |
|
pure virtual |
Deletes an edge in the graph. The edge is also removed in the sub-graphs hierarchy. The ordering of remaining edges is preserved.
e | The edge to delete. |
deleteInAllGraphs | Whether to delete in all its parent graphs or only in this graph. By default only removes in the current graph. |
|
pure virtual |
Deletes edges in the graph. These edges are also removed in the sub-graphs hierarchy. The ordering of remaining edges is preserved.
itE | |
deleteInAllGraphs | Whether to delete in all its parent graphs or only in this graph. By default only removes in the current graph. |
|
pure virtual |
Removes and deletes a property from this graph. The property is removed from the graph's property pool, meaning its name can now be used by another property. The object is deleted and the memory freed.
name | The unique identifier of the property. |
|
pure virtual |
Deletes a node in the graph. This node is also removed in the sub-graphs hierarchy of the current graph.
n | The node to delete. |
deleteInAllGraphs | Whether to delete in all its parent graphs or only in this graph. By default only removes in the current graph. |
|
pure virtual |
Deletes nodes in the graph. Thess nodes are also removed in the sub-graphs hierarchy of the current graph.
it | The nodes to delete. |
deleteInAllGraphs | Whether to delete in all its parent graphs or only in this graph. By default only removes in the current graph. |
Gets an iterator performing a depth-first search on the graph.
root | The node from whom to start the DFS. If not provided, the root node will be assigned to a source node in the graph (node with input degree equals to 0). If there is no source node in the graph, a random node will be picked. |
Gets the source and the target of an edge.
e | The edge to get the ends of. |
|
pure virtual |
Returns the first edge found between the two given nodes.
source | The source of the hypothetical edge. |
target | The target of the hypothetical edge. |
directed | When set to false an edge from target to source may also be returned |
|
pure virtual |
Checks if a property exists in this graph.
The | unique identifier of the property. |
|
pure virtual |
Checks if a property exists in this graph or one of its ancestors.
The | unique identifier of the property. |
bool tlp::Graph::getAttribute | ( | const std::string & | name, |
ATTRIBUTETYPE & | value | ||
) | const |
DataType* tlp::Graph::getAttribute | ( | const std::string & | name | ) | const |
Gets a copy of the attribute.
name | The name of the attribute to retrieve. |
|
inline |
|
pure virtual |
Returns a pointer on the descendant with the corresponding id or NULL if there is no descendant with that id.
id | The id of the descendant graph to retrieve. |
|
pure virtual |
Returns a pointer on the first descendant graph with the corresponding name or NULL if there is no descendant graph with that name.
name | The name of the descendant graph to look for. |
Gets an iterator over the edges composing a meta edge.
metaEdge | The metaEdge to get the real edges of. |
|
pure virtual |
Get an iterator over all the graph's edges.
|
pure virtual |
Returns all the edges between two nodes.
source | The source of the hypothetical edges. |
target | The target of the hypothetical edges. |
directed | When set to false edges from target to source are also considered |
|
inline |
Gets an iterator over the input edges of a node.
n | The node to get the input edges from. |
|
pure virtual |
Gets an iterator over the properties inherited from this graph's ancestors, excluding this graph's local properties.
|
pure virtual |
Gets an iterator over the names of the properties inherited from this graph's ancestors, excluding this graph's local properties.
Gets the i-th node in the input nodes of a given node. An input node 'in' of a node 'N' is the source of an edge going from 'in' to 'N'. e.g.
If you have 5 input nodes on a node N, then graph->getInNode(2); will return the second of those nodes. It will ignore the output nodes of this node.
n | The node to get an input node of. |
i | The index of the input node to get. |
Gets an iterator over the input nodes of a node.
n | The node to get the input nodes of. |
Gets an iterator over the edges of a node.
n | The node to get the edges from. |
Gets an iterator over the neighbors of a given node.
n | The node to retrieve the neighbors of. |
|
pure virtual |
Gets an iterator over the local properties of this graph.
|
pure virtual |
Gets an iterator over the names of the local properties of this graph.
PropertyType * tlp::Graph::getLocalProperty | ( | const std::string & | name | ) |
Gets a property on this graph. The name of a property indentifies it uniquely. Either there already exists a property with the given name, in which case it is returned. Either no such porperty exists and it is created.
The graph keeps ownership of the property, if you wish to remove it fgrom the graph use Graph::delLocalProperty().
The | unique identifier of the property. |
PropertyInterface* tlp::Graph::getLocalProperty | ( | const std::string & | propertyName, |
const std::string & | propertyType | ||
) |
Gets a property on this graph, and this graph only. This forwards the call to the template version of getLocalProperty(), with the correct template parameter deduced from the propertyType parameter.
The graph keeps ownership of the property, if you wish to remove it from the graph use Graph::delLocalProperty().
propertyName | The unique identifier of the property. |
propertyType | A string describing the type of the property. |
|
pure virtual |
Retrieves the name of the graph.
Gets the underlying graph of a meta node.
metaNode | The metanode. |
|
pure virtual |
Gets an iterator over this graph's nodes.
|
virtual |
This method returns the nth subgraph. Since subgraphs order cannot be ensured in every implementation, this method should be equivalent to:
n | the index of the subgraph to retrieve. |
|
pure virtual |
Gets an iterator over the properties attached to this graph, whether they are local or inherited.
|
pure virtual |
Gets an edge of the graph.
|
pure virtual |
Gets a node on the graph.
Gets an iterator over the output edges of a node.
n | The node to get the output edges from. |
Gets the i-th node in the output nodes of a given node. An output node 'out' of a node 'N' is the target of an edge going from 'N' to 'out'. e.g.
If you have 5 output nodes on a node N, then graph->getOutNode(2); will return the second of those nodes. It will ignore the input nodes of this node.
n | The node to get an output node of. |
i | The index of the output node to get. |
Gets an iterator over the output nodes of a node.
n | The node to get the output nodes of. |
|
pure virtual |
Gets an iterator over the names of all the properties attached to this graph, whether they are local or inherited.
|
pure virtual |
Gets an existing property. In DEBUG mode an assertion checks the existence of the property.
The graph keeps ownership of the property, if you wish to remove it from the graph use Graph::delLocalProperty().
name | The unique identifier of the property. |
PropertyType * tlp::Graph::getProperty | ( | const std::string & | name | ) |
Gets a property on this graph or one of its ancestors. If the property already exists on the graph or in one of its ancestors, it is returned. Otherwise a new property is created on this graph.
The graph keeps ownership of the property, if you wish to remove it from the graph use Graph::delLocalProperty().
name | The unique identifier of the property. |
PropertyInterface* tlp::Graph::getProperty | ( | const std::string & | propertyName, |
const std::string & | propertyType | ||
) |
Gets a property on this graph or one of its ancestors. This forwards the call to the template version of getProperty(), with the correct template parameter deduced from the propertyType parameter.
The graph keeps ownership of the property, if you wish to remove it from the graph use Graph::delLocalProperty().
propertyName | The unique identifier of the property. |
propertyType | A string describing the type of the property. |
|
pure virtual |
Gets the root graph of the graph hierarchy.
|
virtual |
Finds the first node whose input degree equals 0.
|
pure virtual |
Returns a pointer on the sub-graph with the corresponding id or NULL if there is no sub-graph with that id.
id | The id of the subgraph to retrieve. |
|
pure virtual |
Returns a pointer on the sub-graph with the corresponding name or NULL if there is no sub-graph with that name.
name | The name of the subgraph to retrieve. |
|
pure virtual |
Gets an iterator on all the sub-graphs of the graph. For instance, in the followong graph hierarchy: root / \ A B /|\ C D E.
root->getSubGraphs(); Will return an iterator over A and B, but not C, D and E.
|
pure virtual |
Returns the parent of the graph. If called on the root graph, it returns itself.
|
pure virtual |
Get the input degree of a node.
n | The node to get the input degree of. |
Graph* tlp::Graph::inducedSubGraph | ( | const std::set< node > & | nodeSet, |
Graph * | parentSubGraph = NULL |
||
) |
Creates and returns a new sub-graph of the graph induced by a set of nodes. Every node contained in the given set of nodes is added to the subgraph. Every edge connecting any two nodes in the set of given nodes is also added.
nodeSet | The nodes to add to the subgraph. All the edges between these nodes are added too. |
parentSubGraph | If provided, is used as parent graph for the newly created subgraph instead of the Graph this method is called on. |
|
pure virtual |
Indicates if the graph argument is a descendant of this graph.
subGraph | The graph to check is a descendant of this graph. |
|
pure virtual |
Checks if an element belongs to this graph.
n | The node to check if it is an element of the graph. |
|
pure virtual |
Checks if an element belongs to this graph.
e | The edge to check if it is an element of the graph. |
|
pure virtual |
Checks if an edge is a meta edge.
e | The edge to check if it is a meta edge. |
|
pure virtual |
Checks if a node is a meta node.
n | The node to check if it is a meta node. |
|
pure virtual |
Indicates if the graph argument is a direct sub-graph.
subGraph | The graph to check is a subgraph of this graph. |
|
pure virtual |
Return the number of descendant sub-graphs. For instance, in the followong graph hierarchy: root / \ A B /|\ C D E.
root->numberOfSubGraphs(); Will return 5.
|
pure virtual |
Gets the number of edges in this graph.
|
pure virtual |
Gets the number of nodes in this graph.
|
pure virtual |
Return the number of direct sub-graphs. For instance, in the followong graph hierarchy: root / \ A B /|\ C D E.
root->numberOfSubGraphs(); Will return 2.
void tlp::Graph::openMetaNode | ( | node | n, |
bool | updateProperties = true |
||
) |
Opens a metanode and replaces all edges between that meta node and other nodes in the graph.
n | The meta node to open. |
updateProperties | If set to true, open meta node will update inner nodes layout, color, size, etc |
Gets the opposite node of n through e.
e | The edge linking the two nodes. |
n | The node at one end of e. |
|
pure virtual |
Get the output degree of a node.
n | The node to get the output degree of. |
|
pure virtual |
Undoes modifications and reverts the whole graph hierarchy back to a previous state.
unpopAllowed | Whether or not it is possible to redo what will be undoe by this call. |
|
pure virtual |
Saves the current state of the whole graph hierarchy and allows to revert to this state later on, using pop(). All modifications except those altering the ordering of the edges will be undone.
This allows to undo/redo modifications on a graph. This is mostly useful from a user interface point of view, but some algorithms use this mechanism to clean up before finishing. For instance:
unpopAllowed | Whether or not to allow to re-do the modifications once they are undone. |
propertiesToPreserveOnPop | A collection of properties whose state to preserve when using pop(). |
|
inline |
|
pure virtual |
Reverses the direction of an edge, the source becomes the target and the target becomes the source.
e | The edge top reverse. |
void tlp::Graph::setAttribute | ( | const std::string & | name, |
const ATTRIBUTETYPE & | value | ||
) |
void tlp::Graph::setAttribute | ( | const std::string & | name, |
const DataType * | value | ||
) |
Sets an attribute on the graph.
name | The name of the attribute to set. |
value | The value to set. |
|
pure virtual |
Sets the order of the edges around a node. This operation ensures that adjacent edges of a node will be ordered as they are in the vector of edges given in parameter.
This can be useful if you want to make sure you retrieve the edges in a specific order when iterating upon them.
n | The node whose edges to order. |
edges | The edges, in the order you want them. |
|
pure virtual |
Sets both the source and the target of an edge.
e | The edge to set the source and target of. |
source | The new source of the edge. |
target | The new target of the edge. |
|
pure virtual |
Sets the name of the graph. The name does not have to be unique, it is used for convenience.
name | The new name of the graph. |
Sets the source of an edge to be the given node.
e | The edge to change the source of. |
source | The new source of the edge. |
Sets the target of an edge to be the given node.
e | The edge to change the target of. |
target | The new target of the edge. |
Gets the source of an edge.
e | The edge to get the source of. |
Swaps two edges in the adjacency list of a node.
n | The node on whoch to swap the edges order. |
e1 | The first edge, that will take the second edge's position. |
e2 | The second edge, that will take the first edge's position. |
Gets the target of an edge.
e | The edge to get the target of. |
|
pure virtual |
Re-perform actions that were undone using pop().
For instance: