19template<
typename T,
typename UIdx>
27 bool savePng(
const std::string & fileNamePng)
const;
28 bool saveDot(
const std::string & fileName)
const;
29 bool saveDot(std::ofstream & fs)
const;
30 std::string
toDot()
const;
32 UIdx
createNode(
const T & data,
const std::string & name);
35 bool createNode(
const T & data,
const UIdx & index,
const std::string & name);
44 void removeNode(UIdx index,
bool reconnectParentToChildren =
false);
49 void connectNode(UIdx parent,
const std::list<UIdx> & listChildren);
50 void connectNode(UIdx parent,
const std::vector<UIdx> & vecChildren);
UIdx createNode(const T &data, const std::string &name)
Create a node and get its index.
void initialisationGraph()
Initialisation function of the class Graph.
bool savePng(const std::string &fileNamePng) const
Save a png file of the graph.
void updateFirstLastNode()
Update the first and last Node of the Graph.
bool isListNodeUdpated(const std::list< UIdx > &listNode) const
Check if the list of given nodes are all updated or not.
bool iterateParent(std::list< UIdx > &listNode) const
Iterate from children to parents.
bool saveDot(const std::string &fileName) const
Save the Graph in a dot file.
void removeNode(UIdx index, bool reconnectParentToChildren=false)
Remove a Node from the Graph.
size_t size() const
Get the number of nodes inside the graph.
bool iterateChildrenCheckUpdate(std::list< UIdx > &listNode)
Iterate from parents to chidren (all node are iterated only once)
Graph()
Default constructeur of Graph.
const Node< T, UIdx > * getNode(UIdx index) const
Get a Node by pointer.
Node< T, UIdx > * createNodePtr(const T &data, const std::string &name)
Create a node and get its pointer.
const std::list< UIdx > & getListFirstNode() const
Get the list of the first nodes (without parent)
Graph & operator=(const Graph< T, UIdx > &other)
Definition of equal operator of Graph.
bool iterateChildren(std::list< UIdx > &listNode) const
Iterate from parents to chidren.
std::map< UIdx, Node< T, UIdx > > p_mapNode
Map of the Node.
bool isNodeExist(UIdx index) const
Say if the node at index does exit.
const std::list< UIdx > & getListLastNode() const
Get the list of the last nodes (without child)
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::string toDot() const
Convert the graph to dot language.
void copyGraph(const Graph< T, UIdx > &other)
Copy function of Graph.
void clearMapNode()
Clear the map of Node.
const Node< T, UIdx > * getFirstNotUpdatedNode() const
Get the first node which is not udpated (getIsUpdated() == false)
void clearIsUpdated()
Clear the isUpdated attriburte of the Node.
void connectNode(UIdx parent, UIdx child)
Connect a parent to its child.
void clearFirstNode()
Clear the list of first Node.
bool iterateParentCheckUpdate(std::list< UIdx > &listNode)
Iterate from children to parents (all node are iterated only once)
void clearLastNode()
Clear the list of last Node.
virtual ~Graph()
Destructeur of Graph.