![]() |
PhoenixGraph
01.0.0
Set of tools to simplify graph manipulation
|
Abstract Graph of Node. More...
#include <Graph.h>
Public Member Functions | |
void | clearAll () |
void | clearFirstNode () |
Clear the list of first Node. | |
void | clearIsUpdated () |
Clear the isUpdated attriburte of the Node. | |
void | clearLastNode () |
Clear the list of last Node. | |
void | clearMapNode () |
Clear the map of Node. | |
void | connectNode (UIdx parent, const std::list< UIdx > &listChildren) |
Connect a parent to its children. | |
void | connectNode (UIdx parent, const std::vector< UIdx > &vecChildren) |
Connect a parent to its children. | |
void | connectNode (UIdx parent, UIdx child) |
Connect a parent to its child. | |
UIdx | createNode (const T &data, const std::string &name) |
Create a node and get its index. | |
bool | createNode (const T &data, const UIdx &index, const std::string &name) |
Create a node and get its index. | |
Node< T, UIdx > * | createNodePtr (const T &data, const std::string &name) |
Create a node and get its pointer. | |
Node< T, UIdx > * | createNodePtr (const T &data, const UIdx &index, const std::string &name) |
Create a node and get its pointer. | |
Node< T, UIdx > * | getFirstNotUpdatedNode () |
Get the first node which is not udpated (getIsUpdated() == false) | |
const Node< T, UIdx > * | getFirstNotUpdatedNode () const |
Get the first node which is not udpated (getIsUpdated() == false) | |
const std::list< UIdx > & | getListFirstNode () const |
Get the list of the first nodes (without parent) | |
const std::list< UIdx > & | getListLastNode () const |
Get the list of the last nodes (without child) | |
Node< T, UIdx > * | getNode (UIdx index) |
Get a Node by pointer. | |
const Node< T, UIdx > * | getNode (UIdx index) const |
Get a Node by pointer. | |
Graph () | |
Default constructeur of Graph. | |
Graph (const Graph< T, UIdx > &other) | |
Copy constructor of Graph. | |
bool | isListNodeUdpated (const std::list< UIdx > &listNode) const |
Check if the list of given nodes are all updated or not. | |
bool | isNodeExist (UIdx index) const |
Say if the node at index does exit. | |
bool | iterateChildren (std::list< UIdx > &listNode) const |
Iterate from parents to chidren. | |
bool | iterateChildrenCheckUpdate (std::list< UIdx > &listNode) |
Iterate from parents to chidren (all node are iterated only once) | |
bool | iterateParent (std::list< UIdx > &listNode) const |
Iterate from children to parents. | |
bool | iterateParentCheckUpdate (std::list< UIdx > &listNode) |
Iterate from children to parents (all node are iterated only once) | |
Graph & | operator= (const Graph< T, UIdx > &other) |
Definition of equal operator of Graph. | |
void | removeNode (UIdx index, bool reconnectParentToChildren=false) |
Remove a Node from the Graph. | |
bool | saveDot (const std::string &fileName) const |
Save the Graph in a dot file. | |
bool | saveDot (std::ofstream &fs) const |
Save the Graph in a dot file. | |
bool | savePng (const std::string &fileNamePng) const |
Save a png file of the graph. | |
size_t | size () const |
Get the number of nodes inside the graph. | |
std::string | toDot () const |
Convert the graph to dot language. | |
void | updateFirstLastNode () |
Update the first and last Node of the Graph. | |
virtual | ~Graph () |
Destructeur of Graph. | |
Protected Member Functions | |
void | copyGraph (const Graph< T, UIdx > &other) |
Copy function of Graph. | |
Private Member Functions | |
void | initialisationGraph () |
Initialisation function of the class Graph. | |
Private Attributes | |
std::list< UIdx > | p_listFirstNode |
List of the first Node (without parent) | |
std::list< UIdx > | p_listLastNode |
List of the last Node (without child) | |
std::map< UIdx, Node< T, UIdx > > | p_mapNode |
Map of the Node. | |
T : type of the data to be connected in the graph UIdx : type of the index to be used to connect the Node together
Default constructeur of Graph.
Definition at line 17 of file Graph_impl.h.
References initialisationGraph().
Referenced by copyGraph(), Graph(), and operator=().
Copy constructor of Graph.
other | : class to copy |
Definition at line 25 of file Graph_impl.h.
References copyGraph(), and Graph().
void Graph< T, UIdx >::clearAll | ( | ) |
Definition at line 199 of file Graph_impl.h.
References clearFirstNode(), clearLastNode(), and clearMapNode().
void Graph< T, UIdx >::clearFirstNode | ( | ) |
Clear the list of first Node.
Definition at line 191 of file Graph_impl.h.
References p_listFirstNode.
Referenced by clearAll(), and updateFirstLastNode().
void Graph< T, UIdx >::clearIsUpdated | ( | ) |
Clear the isUpdated attriburte of the Node.
Definition at line 179 of file Graph_impl.h.
References p_mapNode.
Referenced by iterateChildrenCheckUpdate(), and iterateParentCheckUpdate().
void Graph< T, UIdx >::clearLastNode | ( | ) |
Clear the list of last Node.
Definition at line 195 of file Graph_impl.h.
References p_listLastNode.
Referenced by clearAll(), and updateFirstLastNode().
void Graph< T, UIdx >::clearMapNode | ( | ) |
Clear the map of Node.
Definition at line 187 of file Graph_impl.h.
References p_mapNode.
Referenced by clearAll().
void Graph< T, UIdx >::connectNode | ( | UIdx | parent, |
const std::list< UIdx > & | listChildren ) |
Connect a parent to its children.
parent | : index of the parent Node |
listChildren | : list of the children index |
Definition at line 282 of file Graph_impl.h.
References Node< T, UIdx >::addChild(), Node< T, UIdx >::addParent(), and getNode().
void Graph< T, UIdx >::connectNode | ( | UIdx | parent, |
const std::vector< UIdx > & | vecChildren ) |
Connect a parent to its children.
parent | : index of the parent Node |
vecChildren | : vector of the children index |
Definition at line 299 of file Graph_impl.h.
References Node< T, UIdx >::addChild(), Node< T, UIdx >::addParent(), and getNode().
void Graph< T, UIdx >::connectNode | ( | UIdx | parent, |
UIdx | child ) |
Connect a parent to its child.
Definition at line 268 of file Graph_impl.h.
References Node< T, UIdx >::addChild(), Node< T, UIdx >::addParent(), and getNode().
Referenced by removeNode().
|
protected |
Copy function of Graph.
other | : class to copy |
Definition at line 553 of file Graph_impl.h.
References Graph(), p_listFirstNode, p_listLastNode, and p_mapNode.
Referenced by Graph(), and operator=().
UIdx Graph< T, UIdx >::createNode | ( | const T & | data, |
const std::string & | name ) |
Create a node and get its index.
Definition at line 123 of file Graph_impl.h.
References getNode(), p_mapNode, and Node< T, UIdx >::setIndex().
Referenced by createNodePtr(), and createNodePtr().
bool Graph< T, UIdx >::createNode | ( | const T & | data, |
const UIdx & | index, | ||
const std::string & | name ) |
Create a node and get its index.
Definition at line 152 of file Graph_impl.h.
References getNode(), p_mapNode, and Node< T, UIdx >::setIndex().
Node< T, UIdx > * Graph< T, UIdx >::createNodePtr | ( | const T & | data, |
const std::string & | name ) |
Create a node and get its pointer.
Definition at line 140 of file Graph_impl.h.
References createNode(), and getNode().
Node< T, UIdx > * Graph< T, UIdx >::createNodePtr | ( | const T & | data, |
const UIdx & | index, | ||
const std::string & | name ) |
Create a node and get its pointer.
Definition at line 169 of file Graph_impl.h.
References createNode(), and getNode().
Get the first node which is not udpated (getIsUpdated() == false)
Definition at line 356 of file Graph_impl.h.
References p_mapNode.
const Node< T, UIdx > * Graph< T, UIdx >::getFirstNotUpdatedNode | ( | ) | const |
Get the first node which is not udpated (getIsUpdated() == false)
Definition at line 343 of file Graph_impl.h.
References p_mapNode.
const std::list< UIdx > & Graph< T, UIdx >::getListFirstNode | ( | ) | const |
Get the list of the first nodes (without parent)
Definition at line 387 of file Graph_impl.h.
References p_listFirstNode.
Referenced by iterateChildren(), and iterateChildrenCheckUpdate().
const std::list< UIdx > & Graph< T, UIdx >::getListLastNode | ( | ) | const |
Get the list of the last nodes (without child)
Definition at line 395 of file Graph_impl.h.
References p_listLastNode.
Referenced by iterateParent(), and iterateParentCheckUpdate().
Get a Node by pointer.
index | : index of the node to be used |
Definition at line 330 of file Graph_impl.h.
References p_mapNode.
const Node< T, UIdx > * Graph< T, UIdx >::getNode | ( | UIdx | index | ) | const |
Get a Node by pointer.
index | : index of the node to be used |
Definition at line 316 of file Graph_impl.h.
References p_mapNode.
Referenced by connectNode(), connectNode(), connectNode(), createNode(), createNode(), createNodePtr(), createNodePtr(), isListNodeUdpated(), iterateChildren(), iterateChildrenCheckUpdate(), iterateParent(), iterateParentCheckUpdate(), removeNode(), and toDot().
|
private |
Initialisation function of the class Graph.
Definition at line 561 of file Graph_impl.h.
Referenced by Graph().
bool Graph< T, UIdx >::isListNodeUdpated | ( | const std::list< UIdx > & | listNode | ) | const |
Check if the list of given nodes are all updated or not.
listNode | : list of nodes to be checked |
Definition at line 460 of file Graph_impl.h.
References Node< T, UIdx >::getIsUpdated(), and getNode().
Referenced by iterateChildrenCheckUpdate(), and iterateParentCheckUpdate().
bool Graph< T, UIdx >::isNodeExist | ( | UIdx | index | ) | const |
Say if the node at index does exit.
index | : index of the node to be searched |
Definition at line 370 of file Graph_impl.h.
References p_mapNode.
bool Graph< T, UIdx >::iterateChildren | ( | std::list< UIdx > & | listNode | ) | const |
Iterate from parents to chidren.
[out] | listNode | : list node which can be treated simultaneously |
Definition at line 404 of file Graph_impl.h.
References Node< T, UIdx >::getListChild(), getListFirstNode(), and getNode().
bool Graph< T, UIdx >::iterateChildrenCheckUpdate | ( | std::list< UIdx > & | listNode | ) |
Iterate from parents to chidren (all node are iterated only once)
[out] | listNode | : list node which can be treated simultaneously |
Definition at line 476 of file Graph_impl.h.
References clearIsUpdated(), Node< T, UIdx >::getIsUpdated(), Node< T, UIdx >::getListChild(), getListFirstNode(), Node< T, UIdx >::getListParent(), getNode(), isListNodeUdpated(), and Node< T, UIdx >::setIsUpdated().
bool Graph< T, UIdx >::iterateParent | ( | std::list< UIdx > & | listNode | ) | const |
Iterate from children to parents.
[out] | listNode | : list node which can be treated simultaneously |
Definition at line 432 of file Graph_impl.h.
References getListLastNode(), Node< T, UIdx >::getListParent(), and getNode().
bool Graph< T, UIdx >::iterateParentCheckUpdate | ( | std::list< UIdx > & | listNode | ) |
Iterate from children to parents (all node are iterated only once)
[out] | listNode | : list node which can be treated simultaneously |
Definition at line 515 of file Graph_impl.h.
References clearIsUpdated(), Node< T, UIdx >::getIsUpdated(), Node< T, UIdx >::getListChild(), getListLastNode(), Node< T, UIdx >::getListParent(), getNode(), isListNodeUdpated(), and Node< T, UIdx >::setIsUpdated().
Graph< T, UIdx > & Graph< T, UIdx >::operator= | ( | const Graph< T, UIdx > & | other | ) |
Definition of equal operator of Graph.
other | : class to copy |
Definition at line 40 of file Graph_impl.h.
References copyGraph(), and Graph().
void Graph< T, UIdx >::removeNode | ( | UIdx | index, |
bool | reconnectParentToChildren = false ) |
index | : index of the Node to be removed |
reconnectParentToChildren | : true to reconnect parents of the node to be removed to its children |
Definition at line 210 of file Graph_impl.h.
References connectNode(), Node< T, UIdx >::getListChild(), Node< T, UIdx >::getListParent(), getNode(), listindex_remove(), p_listFirstNode, p_listLastNode, p_mapNode, Node< T, UIdx >::removeChild(), and Node< T, UIdx >::removeParent().
bool Graph< T, UIdx >::saveDot | ( | const std::string & | fileName | ) | const |
Save the Graph in a dot file.
fileName | : name of the file to be created |
Definition at line 69 of file Graph_impl.h.
References saveDot().
Referenced by saveDot(), and savePng().
bool Graph< T, UIdx >::saveDot | ( | std::ofstream & | fs | ) | const |
Save the Graph in a dot file.
[out] | fs | : file stream to be modified |
Definition at line 86 of file Graph_impl.h.
References toDot().
bool Graph< T, UIdx >::savePng | ( | const std::string & | fileNamePng | ) | const |
Save a png file of the graph.
fileNamePng | : name of the png file |
Definition at line 50 of file Graph_impl.h.
References saveDot().
size_t Graph< T, UIdx >::size | ( | ) | const |
Get the number of nodes inside the graph.
Definition at line 379 of file Graph_impl.h.
References p_mapNode.
std::string Graph< T, UIdx >::toDot | ( | ) | const |
Convert the graph to dot language.
Definition at line 95 of file Graph_impl.h.
References Node< T, UIdx >::getDotName(), getNode(), and p_mapNode.
Referenced by saveDot().
void Graph< T, UIdx >::updateFirstLastNode | ( | ) |
Update the first and last Node of the Graph.
Definition at line 250 of file Graph_impl.h.
References clearFirstNode(), clearLastNode(), p_listFirstNode, p_listLastNode, and p_mapNode.
|
private |
List of the first Node (without parent)
Definition at line 80 of file Graph.h.
Referenced by clearFirstNode(), copyGraph(), getListFirstNode(), removeNode(), and updateFirstLastNode().
|
private |
List of the last Node (without child)
Definition at line 82 of file Graph.h.
Referenced by clearLastNode(), copyGraph(), getListLastNode(), removeNode(), and updateFirstLastNode().
|
private |
Map of the Node.
Definition at line 78 of file Graph.h.
Referenced by clearIsUpdated(), clearMapNode(), copyGraph(), createNode(), createNode(), getFirstNotUpdatedNode(), getFirstNotUpdatedNode(), getNode(), getNode(), isNodeExist(), removeNode(), size(), toDot(), and updateFirstLastNode().