Overview     Modules     Class Hierarchy     Classes     Members  

tlp Namespace Reference

Classes

Typedefs

Enumerations

Functions

Variables


Detailed Description

This file is part of Tulip (www.tulip-software.org)

Authors: David Auber and the Tulip development Team from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest

Tulip is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Tulip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.


Typedef Documentation


Enumeration Type Documentation

Enumerator:
DIRECTED 
INV_DIRECTED 
UNDIRECTED 
Enumerator:
NODE 
EDGE 
Enumerator:
TLP_CONTINUE 
TLP_CANCEL 
TLP_STOP 

Function Documentation

TLP_SCOPE bool tlp::applyAlgorithm ( Graph *  graph,
std::string &  errorMsg,
DataSet *  dataSet = 0,
const std::string &  alg = "any",
PluginProgress *  plugProgress = 0 
)

Applies an algorithm plugin named alg (must be loaded) on graph . Algorithm plugins are objects implementing the tlp::Algorithm interface. Parameters can be transmit to the algorithm trough a DataSet object (refer to the plugin documentation to get its parameters list). If an error occurs, a message may have been stored by the algorithm in the errosMsg variable. Returns true if the algorithm has been successfully applied.

bool tlp::averageCluster ( Graph *  g,
double &  result,
PluginProgress *  pp = NULL 
) [inline]
TLP_SCOPE double tlp::averageClusteringCoefficient ( const Graph *  ,
PluginProgress *  = 0 
)

Returns the clustering coefficient of a graph as the average of the local clustering coefficients (see clusteringCoefficient function) of all the nodes. see http://en.wikipedia.org/wiki/Clustering_coefficient for more details.

bool tlp::averagePathLength ( Graph *  g,
double &  result,
PluginProgress *  pp = NULL 
) [inline]
TLP_SCOPE double tlp::averagePathLength ( const Graph *  g,
PluginProgress *  = NULL 
)

Returns the average path length of a graph, that is the sum of the shortest distances for all pair of distinct nodes in that graph divided by the number of those pairs. For a pair of non connected nodes, the shorted distance is set to 0. see http://en.wikipedia.org/wiki/Average_path_length for more details

TLP_SCOPE void tlp::clusteringCoefficient ( const Graph *  g,
MutableContainer< double > &  result,
unsigned int  maxDepth = 1,
PluginProgress *  = NULL 
)

Assigns to each node its local clustering coefficient that is the proportion of edges between the nodes within its neighbourhood divided by the number of edges that could possibly exist between them. This quantifies how close its neighbors are to being a clique. see http://en.wikipedia.org/wiki/Clustering_coefficient for more details

TLP_SCOPE BoundingBox tlp::computeBoundingBox ( Iterator< node > *  itN,
Iterator< edge > *  itE,
const LayoutProperty *  layout,
const SizeProperty *  size,
const DoubleProperty *  rotation,
const BooleanProperty *  selection = 0 
)

Compute the bounding box of graph elements according to node position edge bends node z-rotation, and size of elements

Iterator itN and itE will be deleted after the computations (ie. no need to delete them yourself)

TLP_SCOPE BoundingBox tlp::computeBoundingBox ( const Graph *  graph,
const LayoutProperty *  layout,
const SizeProperty *  size,
const DoubleProperty *  rotation,
const BooleanProperty *  selection = 0 
)

add a "Circle computeBoundingCircle(...)" function (the code to compute it correctly is already available in Circle.h)

Compute the bounding box of a graph according to node position edge bends node z-rotation, and size of elements

TLP_SCOPE std::pair<Coord, Coord> tlp::computeBoundingRadius ( const Graph *  graph,
const LayoutProperty *  layout,
const SizeProperty *  size,
const DoubleProperty *  rotation,
const BooleanProperty *  selection = 0 
)

Compute a bounding sphere of a graph according to node position edge bends node z-rotation, and size of elements

Todo:

make that fucntion return a new type of class called BoundingSphere

test if that function correctly compute a bounding sphere.

TLP_SCOPE std::vector<std::vector<node> > tlp::computeCanonicalOrdering ( PlanarConMap *  ,
std::vector< edge > *  dummyEdges = 0,
PluginProgress *  pluginProgress = 0 
)

This ordering was first introduced by C. Gutwenger and P. Mutzel in
"Grid embeddings of biconnected planar graphs",
"Extended Abstract, Max-Planck-Institut für Informatik,"
"Saarbrücken, Germany, 1997"
Let n be the number of nodes, the original algorithm complexity is in O(n).
But the implementation of the canonical ordering has not been made in O(n).

TLP_SCOPE std::vector<Coord> tlp::computeConvexHull ( const Graph *  graph,
const LayoutProperty *  layout,
const SizeProperty *  size,
const DoubleProperty *  rotation,
const BooleanProperty *  selection = 0 
)

Compute a convexHull of a graph according to node position edge bends node z-rotation, and size of elements. Only works in 2D.

Todo:
refactor code from GlConvexHull here
TLP_SCOPE bool tlp::computeEqualValueClustering ( Graph *  graph,
PropertyInterface *  property,
bool  onNodes = true,
bool  connected = false,
PluginProgress *  pluginProgress = 0 
)

Compute the subgraphs whose elements have the same value for property

TLP_SCOPE std::vector<node> tlp::computeGraphCenters ( Graph *  graph  ) 

Find all the graph centers, that version does not manage edge weight. complexity O(n * m). Only works on connected graphs.

TLP_SCOPE void tlp::copyToGraph ( Graph *  outG,
const Graph *  inG,
BooleanProperty *  inSelection = 0,
BooleanProperty *  outSelection = 0 
)

Appends the selected part of the graph inG (properties, nodes and edges) into the graph outG. If no selection is done (inSel=NULL), the whole inG graph is appended. The output selection is used to select the appended nodes & edges

Warning:
The input selection is extended to all selected edge ends.
node tlp::createMetaNode ( Graph *  graph,
const std::set< node > &  nodeSet 
) [inline]

Function to close a 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.

TLP_SCOPE void tlp::dagLevel ( const Graph *  graph,
MutableContainer< unsigned int > &  level,
PluginProgress *  = NULL 
)

Assigns to each node of a Directed Acyclic Graph a level such that if the edge e(u,v) exists level(u) < level(v). The algorithm ensures that the number of level used is minimal.

Warning : the graph must be acyclic (no self loops).

TLP_SCOPE std::string tlp::demangleTlpClassName ( const char *  className  ) 

Demangles the name of a C++ class defined in the tlp namespace. Simply removes the 'tlp::' prefix from the class name.

Returns:
string The demangled name of a Tulip C++ class.
TLP_SCOPE bool tlp::exportGraph ( Graph *  graph,
std::ostream &  os,
const std::string &  alg,
DataSet &  dataSet,
PluginProgress *  plugProgress = 0 
)

Exports a graph using the Tulip export plugin named alg (must be loaded) with parameters stored in dataSet. An output stream os (can be file stream, string stream, ..) has to be provided as parameter and will be used by the export plugin. Returns true if the graph was successfully exported.

TLP_SCOPE const std::string& tlp::getCurrentPluginFileName (  ) 

Gets the plugin library currently loading Returns the absolute file name of the plugin library currently loading.

TLP_SCOPE std::istream* tlp::getIgzstream ( const char *  name,
int  open_mode = std::ios::in 
)

Returns an istream to read from a gzipped file (uses gzstream lib). The stream has to be deleted after use.

Parameters:
name The name of the file to read from.
open_mode The mode to open the file with. Defaults to std::ios::in.
Returns:
istream gzipped input stream from a file.
TLP_SCOPE std::string tlp::getMajor ( const std::string &  release  ) 

Splits the string and returns everything before the first dot ('.'). This is used to return major version number, as version numbers are formatted as X.Y.Z, X being the major, Y the minor, and Z the patch version.

Returns:
string The part of the string before the first dot.
TLP_SCOPE std::string tlp::getMinor ( const std::string &  release  ) 

Splits the string and return the minor version. If the string does not contain any dot, then 0 is returned. If the string contains only one dot (X.Y), then everything after the first dot is returned (Y). If the string is a full version with two dots (X.Y.Z), everything between the first and last dots is returned (Y). If there are more than two dots, everything between the first and last dots is returned.

TLP_SCOPE std::ostream* tlp::getOgzstream ( const char *  name,
int  open_mode = std::ios::out 
)

Returns an ostream to write to a gzipped file (uses gzstream lib). The stream has to be deleted after use.

Warning:
Don't forget to check the stream with ios::bad()!
Parameters:
name The name of the file to write to.
open_mode The mode to open the file with. Defaults to std::ios::out.
Returns:
ostream gzipped output stream to a file.
TLP_SCOPE bool tlp::getSource ( const Graph *  ,
node &  n 
)

Finds the first node whose input degree equals 0. If no node exists, returns false else true.

TLP_SCOPE node tlp::graphCenterHeuristic ( Graph *  graph,
PluginProgress *  pluginProgress = 0 
)

return a node that can be considered as the graph center. It is an heuristic, thus it is not absolutely sure that this node is a graph center. Only works on connected graphs.

TLP_SCOPE Graph* tlp::importGraph ( const std::string &  alg,
DataSet &  dataSet,
PluginProgress *  plugProgress = 0,
Graph *  newGraph = 0 
)

Imports a graph using the Tulip import plugin named alg (must be loaded) with parameters stored in dataSet. If newGraph is not NULL, imported graph elements will be added to it. Otherwise, returns a new graph or NULL if the import fails.

Graph* tlp::inducedSubGraph ( Graph *  graph,
const std::set< node > &  nodeSet 
) [inline]

Return the subgraph induced by a set of nodes

TLP_SCOPE void tlp::initTulipLib ( const char *  appDirPath = 0  ) 

Initializes the Tulip library. Looks for the Tulip plugins directory and fills the Tulip path variables : tlp::TulipLibDir, tlp::TulipPluginsPath, ... The plug-ins directory can be defined in different ways, given by order of prevalence : 1. the TLP_DIR environment variable, if it has a value 2. the appDirPath parameter, if it is not NULL 3. a fallback value of 'C:/Tulip/lib/' on windows, or '/usr/local/lib/' on unix.

TLP_SCOPE Graph* tlp::loadGraph ( const std::string &  filename  ) 

Loads a graph in the tlp format from a file (extension can be .tlp or .tlp.gz). Returns NULL if the import fails. Warning : this function uses "tlp" import plugin (must be loaded).

TLP_SCOPE bool tlp::loadPlugin ( const std::string &  filename,
PluginLoader *  plug = 0 
)

Loads a plugin from a specific shared library.

Parameters:
filename the path to the shared library containing the Tulip plugin (file extension : .so on linux, .dylib on mac, .dll on windows)
plug A PluginLoader to output what is going on. Defaults to 0.
Returns:
bool true if the plugin was correctly loaded
TLP_SCOPE void tlp::loadPlugins ( PluginLoader *  plug = 0  ) 

Calls loadPluginsFromDir for each directory in TulipPluginsPath.

Loads plugins installed in the directories listed in the tlp::TulipPluginsPath variable (in the form "<path1>;<path2>" on windows and "<path1>:<path2>" on unix)

Parameters:
plug A PluginLoader to output what is going on. Defaults to 0.
TLP_SCOPE void tlp::loadPluginsCheckDependencies ( PluginLoader *  loader = 0  ) 

Checks the dependencies of all plugins loaded so far. If a plugin does not have all its dependencies fulfilled, it is unloaded and removed from the current plugins database.

Parameters:
loader A PluginLoader to output what is going on. Defaults to 0.
TLP_SCOPE void tlp::loadPluginsFromDir ( std::string  dir,
std::string  type,
PluginLoader *  loader = 0 
)

Loads plugins located in a specific directory

Parameters:
dir the path to the directory containing the Tulip plugins
type a string used by the plugin loader (if any) to output the type of plugin being loaded
loader A PluginLoader to output what is going on. Defaults to 0.
TLP_SCOPE void tlp::makeProperDag ( Graph *  graph,
std::list< node > &  addedNodes,
TLP_HASH_MAP< edge, edge > &  replacedEdges,
IntegerProperty *  edgeLength = 0 
)
TLP_SCOPE node tlp::makeSimpleSource ( Graph *  graph  ) 

return a new node connected to all previously existing nodes which had a null indegree

TLP_SCOPE unsigned int tlp::maxDegree ( const Graph *   ) 

Returns the maximum value of the degree of the graph's nodes.

TLP_SCOPE unsigned int tlp::maxDistance ( const Graph *  graph,
const node  n,
MutableContainer< unsigned int > &  distance,
EDGE_TYPE  direction = UNDIRECTED 
)

Computes the maximum distance from n to all the other nodes of the graph and store it into distance (stored value is UINT_MAX for non connected nodes). If direction is set to 2 use undirected graph, 0 use directed graph and 1 use reverse directed graph (ie. all edges are reversed). All the edge's weight is set to 1. (it uses a bfs thus the complexity is o(m), m = |E|).

TLP_SCOPE unsigned int tlp::minDegree ( const Graph *   ) 

Returns the minimum value of the degree of the graph's nodes.

TLP_SCOPE Graph* tlp::newCloneSubGraph ( Graph *  root,
std::string  name = "unnamed" 
)

Creates and returns a subgraph of root that is equal to root (a clone subgraph).

TLP_SCOPE Graph* tlp::newGraph (  ) 

Returns a new empty graph.

Examples:
PrintObserver.
TLP_SCOPE Graph* tlp::newSubGraph ( Graph *  root,
std::string  name = "unnamed" 
)

Creates and returns an empty subgraph of root.

void tlp::openMetaNode ( Graph *  graph,
node  n 
) [inline]

Function to open a metanode and replace all edges between that meta node and other nodes in the graph.

TLP_SCOPE std::ostream& tlp::operator<< ( std::ostream &  os,
const tlp::Color  
)
TLP_SCOPE std::istream& tlp::operator>> ( std::istream &  is,
tlp::Color  
)
TLP_SCOPE void tlp::reachableNodes ( const Graph *  graph,
const node  startNode,
std::set< node > &  result,
unsigned int  maxDistance,
EDGE_TYPE  direction = UNDIRECTED 
)

Adds to a result set, all the nodes, according to direction, at distance less or equal to maxDistance of startNode.

TLP_SCOPE void tlp::removeFromGraph ( Graph *  ioG,
BooleanProperty *  inSelection = 0 
)

Removes the selected part of the graph ioG (properties values, nodes and edges). If no selection is done (inSel=NULL), the whole graph is reseted to default value.

Warning:
The selection is extended to all selected edge ends.
TLP_SCOPE bool tlp::saveGraph ( Graph *  ,
const std::string &  filename 
)

Saves a graph to a file in the tlp format. Extension of the destination file can be either .tlp (raw export) or .tlp.gz (compressed export).

Returns true if the graph was successfully exported. Warning : this function use "tlp" export plugin (must be loaded).

TLP_SCOPE void tlp::selectMinimumSpanningTree ( Graph *  graph,
BooleanProperty *  selectionProperty,
DoubleProperty *  weight = 0,
PluginProgress *  pluginProgress = 0 
)

Select the minimum spanning tree (Kruskal algorithm) of a weighted graph, i.e for all graph elements (nodes or edges) belonging to that tree the selectionProperty associated value is true. The value is false for the other elements

TLP_SCOPE void tlp::selectSpanningForest ( Graph *  graph,
BooleanProperty *  selectionProperty,
PluginProgress *  pluginProgress = 0 
)

Select a spanning forest of the graph, i.e for all graph elements (nodes or edges) belonging to that forest the selectionProperty associated value is true. The value is false for the other elements

TLP_SCOPE void tlp::selectSpanningTree ( Graph *  graph,
BooleanProperty *  selection,
PluginProgress *  pluginProgress = 0 
)

Select a spanning tree of a graph assuming it is connected; i.e for all graph elements (nodes or edges) belonging to that tree the selectionProperty associated value is true. The value is false for the other elements


Variable Documentation

TLP_SCOPE const char tlp::PATH_DELIMITER
TLP_SCOPE std::string tlp::TulipBitmapDir
TLP_SCOPE std::string tlp::TulipDocProfile
TLP_SCOPE std::string tlp::TulipLibDir
TLP_SCOPE std::string tlp::TulipPluginsPath
TLP_SCOPE std::string tlp::TulipUserHandBookIndex


Tulip Software by LaBRI Visualization Team    2001 - 2011