GraphTool
1.0
Tool for analyzing and graphically visualizing code dependencies for Ericsson.
|
#include <grapher.h>
Public Types | |
enum | LayoutType { FORCE, HIERARCHY, BUBBLE } |
Layout types available to use. | |
typedef Grapher< V_type, E_type, V_CompareFunctor, E_CompareFunctor > | GraphType |
This type of graph. | |
typedef unsigned int | index_type_t |
The type of index used for the nodes in the graph. | |
typedef V_type | node_value_type |
Accessor for the type of value stored in the nodes. | |
typedef E_type | edge_value_type |
Accessor for the type of value stored in the edges. | |
typedef V_CompareFunctor | comparator |
Accessor for the type of comparator used. | |
typedef std::map< index_type_t, std::set< index_type_t > > | incoming_map_t |
Type for datastructure that holds all in-edges for every node. | |
typedef std::map< V_type, index_type_t, V_CompareFunctor > | node_map_t |
Type for the map between node values and index types (used to find an index given a node) | |
typedef std::map< index_type_t, V_type > | node_data_t |
Type for the map between nodes and indexes (used to find the node given a node index) | |
typedef std::map< std::pair < index_type_t, index_type_t > , E_type > | edge_map_t |
Type used to map between an edge (pairs of index types) and data stored in that edge. | |
typedef std::vector< std::pair < int, int > > | position_map_t |
typedef std::map< std::string, std::string > | property_map_t |
Type used to map a property (as string) to a value (as string) | |
typedef std::map< V_type, property_map_t *, V_CompareFunctor > | node_property_map_t |
Type used to map a node type to its propertymap. | |
typedef std::map< E_type, property_map_t *, E_CompareFunctor > | edge_property_map_t |
Type used to map an edge type to its propertymap. | |
typedef node_data_t::iterator | node_iterator |
Type used to iterate over nodes. | |
typedef node_data_t::const_iterator | const_node_iterator |
typedef edge_map_t::iterator | edge_iterator |
Type used to iterate over edges. | |
typedef edge_map_t::const_iterator | const_edge_iterator |
Public Member Functions | |
Grapher (const Grapher &g) | |
Copy-constructor, required to ensure the position_map_ is appropriately copied. | |
node_iterator | node_begin () |
node_iterator | node_end () |
edge_iterator | edge_begin () |
edge_iterator | edge_end () |
void | Layout (double width, double height, LayoutType l=HIERARCHY) |
Runs a layout on the graph. | |
void | Layout (V_type v, double width, double height, LayoutType l=HIERARCHY) |
bool | has_layout () |
Returns true if there is a layout. | |
GraphProperties< GraphType > & | properties () |
Fetch the properties. | |
unsigned int | num_nodes () |
Returns the current number of nodes in the graph. | |
unsigned int | num_edges () |
Returns the current number of edges in the graph. | |
unsigned int | num_nodedata () |
Returns the size of the node data (1 edge has 2 data entries) | |
position_map_t::value_type | position (const V_type v) |
Fetches the position in a std::pair<int, int> of a specific vertex data. | |
bool | exists (V_type v) |
Check a specific vertex exists in the graph. | |
bool | add_node (V_type v) |
bool | add_edge (V_type from, V_type to, E_type edge_data) |
index_type_t | vertex (V_type node) |
V_type | vertex (index_type_t index) |
std::vector< E_type > * | edges (V_type v) |
std::vector< E_type > * | incoming_edges (V_type v) |
const GraphFilterList < GraphType > * | filter () |
void | set_filter (GraphFilterList< GraphType > *filter) |
Generic class for managing graphs. A datastructure for managing graphs storing arbitrary elements as members of the nodes as well as members of the edges. Takes three template arguments, the first one being the datatype to store in the nodes, the second the datatype to store in the edges and the first a comparision function for comparing nodes with each other.
Grapher itself makes no assumption about what type of data is stored in the Grapher, whether it is pointers, references or actual objects does not matter. However filters and other helper functions used together with the Grapher might, so make sure that the GraphActions/GraphFilterLists/GraphFilters you are using are compatible with the Grapher you have.
typedef std::vector< std::pair<int, int> > Grapher< V_type, E_type, V_CompareFunctor, E_CompareFunctor >::position_map_t |
Vector to store the result of the latest run positioning on this graph TODO: This should really be a std::map<index_type_t, std::pair<int, int>>
|
inline |
Adds an edge between the node with data from to data to providing the data edge_data to store in the node
to | The data point from which to draw the edge from |
to | The data point to which to draw the edge to |
edge_data | The data to store in the edge. |
|
inline |
Adds a data node to the graph. If a filter has been given to the graph using the set_filter method then the node will be checked via the filter first. If the filter returns false then the node will not be included in the graph.
|
inline |
Get all edges for a given node
|
inline |
Returns the currently used filter for this graph. Remember that filters can be chained meaning that this filter in turn might lead to others.
|
inline |
Get all incoming edges for a given node
|
inline |
Runs a layout on the graph centered around node v. This only works in case the layout type is Bubble or Hierarchy, if the layout type is FORCE then a regular layout is run.
|
inline |
Set the filter that is to be used for this graph when adding nodes to it. The filter will only be applied to nodes added after the filter is set using set_filter, that is not to nodes already added to the graph.
|
inline |
Fetch the index of a specific node in the graph
node | The node to fetch the data for |
|
inline |
Fetch the node of a specific index
index | The index of the node to get |