ELVE  1
ELVE Logic Visualization Explorer
Elve::Graph Class Reference

The main class in elve, describing the graph and the numerous transformation that you can apply to it. More...

#include <Graph.h>

Public Member Functions

 Graph (const SharedData &data)
 construct the Graph from shared GraphData
 Graph (const SharedData &data, const SparseData &extraData, const Aliases &aliases, const NodeIDSet &excluded={})
 construct the Graph from shared GraphData and extra parameters
const NodesByID & nodes () const
 get the map from NodeID to Nodes
const Pin inputAlias (const Pin &id) const
 get alias Pin for a particular Pin
const Pin outputAlias (const Pin &id) const
 get alias Pin for a particular Pin
size_t nodeCount () const
 expanded nodes count
SharedGraph clusterize (size_t level)
 apply a greedy algorithm to simplify the graph
SharedGraph group (const NodeIDSet &toGroup, const NodeID &i, const NodeName &groupName)
 group several nodes as only one node
SharedGraph ungroup (const NodeID &cluster)
 ungroup the selected group back to the initial nodes
SharedGraph fastGroup (const std::vector< NodeIDSet > &groups, const NodeName &basename)
 group several set of node in a fast way
NodeName uniqueName (const NodeName &base) const
 generate a unique name from a basename
NodeLevel highestLevel () const
 the max of all nodes levels
size_t inputCount () const
 number of inputs
size_t outputCount () const
 number of outputs
size_t maxInputIndex () const
 max index of inputs
size_t maxOutputIndex () const
 max index of outputs
NodeID newID () const
 return a new unique (in this graph) node ID
const SharedData & datas () const
 get the underlying shared GraphData
const SparseData & extraData () const
 get the extra data used in this graph
const Aliasesaliases () const
 get the alias table of this graph
const NodeIDSet excluded () const
 get the excluded set from this graph
const NodeDatadata (const NodeID &id) const
 get NodeData for a particular node, including extra nodes
const Nodenode (const NodeID &id) const
 get the Node from its id
const NodePtrs & inputs ()
 get array of Node* containing all inputs
const NodePtrs & outputs ()
 get array of Node* containing all outputs
QJsonObject json () const
 construct the json representation of the Graph
const QString & filename () const
 get the original filename of the graph

Static Public Member Functions

static SharedGraph fromJson (const QJsonObject &obj)
 make a new shared graph from the given json

Detailed Description

The main class in elve, describing the graph and the numerous transformation that you can apply to it.

Graph is the abstract part of the Graph, it contains no information about layouting or drawing. It only stores the properties of the nodes and their relation to each other as a pointer-based graph structure that speed-up the access to GraphData. And exposes nodes and connexions in a convenient way.

The pointer based representation is expanded from the GraphData and auxiliary data passed to the graph that controls how the graph expands :

  • extraData : add Nodes to the graph
  • aliases : maps Pin to Pin to redirect edges to other nodes, especially extra Nodes
  • exluded : set of excluded Id's that prevent nodes being expanded

Layout, Selection, Looks... are stored and managed in ExtendedGraph

Definition at line 64 of file Graph.h.


Constructor & Destructor Documentation

Elve::Graph::Graph ( const SharedData &  data)

construct the Graph from shared GraphData

Parameters:
data

Definition at line 30 of file Graph.cpp.

Elve::Graph::Graph ( const SharedData &  data,
const SparseData &  extraData,
const Aliases aliases 
)

construct the Graph from shared GraphData and extra parameters

Parameters:
datashared GraphData
extraDataSparse collection of NodeData for extra nodes added on the fly
aliasesmapping from Pin to Pin that redirect edges
exludedset of exluded points

Member Function Documentation

const Aliases & Elve::Graph::aliases ( ) const

get the alias table of this graph

Returns:

Definition at line 315 of file Graph.cpp.

SharedGraph Elve::Graph::clusterize ( size_t  level)

apply a greedy algorithm to simplify the graph

Parameters:
level\xrefitemdeprecated 1.
Returns:
a new graph with the clusters grouped

Definition at line 165 of file Graph.cpp.

const NodeData & Elve::Graph::data ( const NodeID &  id) const

get NodeData for a particular node, including extra nodes

Parameters:
idid of the Node
Returns:

Definition at line 124 of file Graph.cpp.

const SharedData & Elve::Graph::datas ( ) const

get the underlying shared GraphData

Returns:

Definition at line 309 of file Graph.cpp.

const NodeIDSet Elve::Graph::excluded ( ) const

get the excluded set from this graph

Returns:

Definition at line 319 of file Graph.cpp.

const SparseData & Elve::Graph::extraData ( ) const

get the extra data used in this graph

Returns:

Definition at line 312 of file Graph.cpp.

SharedGraph Elve::Graph::fastGroup ( const std::vector< NodeIDSet > &  groups,
const NodeName &  basename 
)

group several set of node in a fast way

Parameters:
groupsarray of sets of node ids that each form a group
basenamebase name for the groups
Returns:
a new graph with all groups updated

This way created to allow to group multiple cluster at once without re-expanding the graph, this allow very fast clustering.

Definition at line 215 of file Graph.cpp.

const QString & Elve::Graph::filename ( ) const

get the original filename of the graph

Returns:

Definition at line 77 of file Graph.cpp.

SharedGraph Elve::Graph::fromJson ( const QJsonObject &  obj) [static]

make a new shared graph from the given json

Parameters:
objjson Objet
Returns:
a new Shared graph

Definition at line 407 of file Graph.cpp.

SharedGraph Elve::Graph::group ( const NodeIDSet &  toGroup,
const NodeID &  i,
const NodeName &  groupName 
)

group several nodes as only one node

Parameters:
toGroupids of node to group
iid of the new node
groupNamename of the new node
Returns:
new graph with updated group

Definition at line 293 of file Graph.cpp.

NodeLevel Elve::Graph::highestLevel ( ) const

the max of all nodes levels

Returns:

Definition at line 397 of file Graph.cpp.

const Pin Elve::Graph::inputAlias ( const Pin id) const

get alias Pin for a particular Pin

Parameters:
idthe desired Pin
Returns:
the aliased Pin

This resolve aliases recursively, so if there is a pin aliased to another one that is also aliased you'll get the last one

Definition at line 89 of file Graph.cpp.

size_t Elve::Graph::inputCount ( ) const

number of inputs

Returns:

Definition at line 323 of file Graph.cpp.

const NodePtrs & Elve::Graph::inputs ( )

get array of Node* containing all inputs

Returns:

Definition at line 301 of file Graph.cpp.

QJsonObject Elve::Graph::json ( ) const

construct the json representation of the Graph

Returns:

Definition at line 355 of file Graph.cpp.

size_t Elve::Graph::maxInputIndex ( ) const

max index of inputs

Returns:

Definition at line 333 of file Graph.cpp.

size_t Elve::Graph::maxOutputIndex ( ) const

max index of outputs

Returns:

Definition at line 344 of file Graph.cpp.

NodeID Elve::Graph::newID ( ) const

return a new unique (in this graph) node ID

Returns:

Definition at line 73 of file Graph.cpp.

const Node & Elve::Graph::node ( const NodeID &  id) const

get the Node from its id

Parameters:
idid of the Node
Returns:

Definition at line 201 of file Graph.cpp.

size_t Elve::Graph::nodeCount ( ) const

expanded nodes count

Returns:

Definition at line 85 of file Graph.cpp.

const NodesByID & Elve::Graph::nodes ( ) const

get the map from NodeID to Nodes

Returns:
the map

Definition at line 81 of file Graph.cpp.

const Pin Elve::Graph::outputAlias ( const Pin id) const

get alias Pin for a particular Pin

Parameters:
idthe desired Pin
Returns:
the aliased Pin

This resolve aliases recursively, so if there is a pin aliased to another one that is also aliased you'll get the last one

Definition at line 96 of file Graph.cpp.

size_t Elve::Graph::outputCount ( ) const

number of outputs

Returns:

Definition at line 328 of file Graph.cpp.

const NodePtrs & Elve::Graph::outputs ( )

get array of Node* containing all outputs

Returns:

Definition at line 305 of file Graph.cpp.

SharedGraph Elve::Graph::ungroup ( const NodeID &  cluster)

ungroup the selected group back to the initial nodes

Parameters:
clusterid of the group
Returns:
a new graph with the cluster ungrouped

Definition at line 205 of file Graph.cpp.

NodeName Elve::Graph::uniqueName ( const NodeName &  base) const

generate a unique name from a basename

END OF CLUSTERING SECTION.

Parameters:
basebase name
Returns:
a new name suffixed with a number if base already taken

Definition at line 187 of file Graph.cpp.

List of all members.


The documentation for this class was generated from the following files:
 All Classes Functions