bpp-core3  3.0.0
DAGraph.h
Go to the documentation of this file.
1 //
2 // File: DAGraph.h
3 // Authors:
4 // Laurent Guéguen
5 // Last modified: lundi 19 décembre 2016, à 22h 46
6 //
7 
8 /*
9  Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
10 
11  This software is a computer program whose purpose is to provide utilitary
12  classes. This file belongs to the Bio++ Project.
13 
14  This software is governed by the CeCILL license under French law and
15  abiding by the rules of distribution of free software. You can use,
16  modify and/ or redistribute the software under the terms of the CeCILL
17  license as circulated by CEA, CNRS and INRIA at the following URL
18  "http://www.cecill.info".
19 
20  As a counterpart to the access to the source code and rights to copy,
21  modify and redistribute granted by the license, users are provided only
22  with a limited warranty and the software's author, the holder of the
23  economic rights, and the successive licensors have only limited
24  liability.
25 
26  In this respect, the user's attention is drawn to the risks associated
27  with loading, using, modifying and/or developing or reproducing the
28  software by the user in light of its specific status of free software,
29  that may mean that it is complicated to manipulate, and that also
30  therefore means that it is reserved for developers and experienced
31  professionals having in-depth computer knowledge. Users are therefore
32  encouraged to load and test the software's suitability as regards their
33  requirements in conditions enabling the security of their systems and/or
34  data to be ensured and, more generally, to use and operate it in the
35  same conditions as regards security.
36 
37  The fact that you are presently reading this means that you have had
38  knowledge of the CeCILL license and that you accept its terms.
39 */
40 
41 #ifndef BPP_GRAPH_DAGRAPH_H
42 #define BPP_GRAPH_DAGRAPH_H
43 
44 #include <algorithm>
45 #include <iostream>
46 #include <ostream>
47 #include <string>
48 #include <vector>
49 
50 #include "../Exceptions.h"
51 #include "../Numeric/VectorTools.h"
52 #include "Graph.h"
53 
54 namespace bpp
55 {
56 class DAGraph :
57  public virtual Graph
58 {
59 public:
64  virtual bool isValid() const = 0;
65 
72  virtual bool isRooted() const = 0;
73 
78  virtual bool hasFather(Graph::NodeId node) const = 0;
79 
84  virtual std::vector<Graph::NodeId> getFathers(Graph::NodeId node) const = 0;
85 
90  virtual size_t getNumberOfFathers(Graph::NodeId node) const = 0;
91 
96  virtual void addFather(Graph::NodeId node, Graph::NodeId father) = 0;
97 
98  virtual void addFather(Graph::NodeId node, Graph::NodeId father, Graph::EdgeId edgeId) = 0;
99 
104  virtual void removeFather(Graph::NodeId node, Graph::NodeId father) = 0;
105 
110  virtual std::vector<Graph::NodeId> removeFathers(Graph::NodeId node) = 0;
111 
118  virtual std::vector<Graph::NodeId> getLeavesUnderNode(Graph::NodeId node) const = 0;
119 
124  virtual std::vector<Graph::NodeId> getSons(Graph::NodeId node) const = 0;
125 
130  virtual size_t getNumberOfSons(Graph::NodeId node) const = 0;
131 
136  void addSon(Graph::NodeId node, Graph::NodeId sonNode);
137 
138  void addSon(Graph::NodeId node, Graph::NodeId sonNode, Graph::EdgeId edge);
139 
144  virtual std::vector<Graph::NodeId> removeSons(Graph::NodeId node) = 0;
145 
150  virtual void removeSon(Graph::NodeId node, Graph::NodeId son) = 0;
151 
156  virtual void rootAt(Graph::NodeId newRoot) = 0;
157 
162  virtual std::vector<Graph::NodeId> getBelowNodes(Graph::NodeId localRoot) const = 0;
163 
168  virtual std::vector<Graph::EdgeId> getBelowEdges(Graph::NodeId localRoot) const = 0;
169 };
170 }
171 #endif // BPP_GRAPH_DAGRAPH_H
virtual std::vector< Graph::NodeId > getLeavesUnderNode(Graph::NodeId node) const =0
virtual size_t getNumberOfSons(Graph::NodeId node) const =0
Get the number of sons node.
virtual void rootAt(Graph::NodeId newRoot)=0
virtual std::vector< Graph::EdgeId > getBelowEdges(Graph::NodeId localRoot) const =0
virtual std::vector< Graph::NodeId > getFathers(Graph::NodeId node) const =0
virtual void removeFather(Graph::NodeId node, Graph::NodeId father)=0
virtual void removeSon(Graph::NodeId node, Graph::NodeId son)=0
virtual std::vector< Graph::NodeId > removeFathers(Graph::NodeId node)=0
void addSon(Graph::NodeId node, Graph::NodeId sonNode)
virtual std::vector< Graph::NodeId > getSons(Graph::NodeId node) const =0
virtual std::vector< Graph::NodeId > getBelowNodes(Graph::NodeId localRoot) const =0
virtual void addFather(Graph::NodeId node, Graph::NodeId father, Graph::EdgeId edgeId)=0
virtual size_t getNumberOfFathers(Graph::NodeId node) const =0
Get the number of fathers nodes.
virtual std::vector< Graph::NodeId > removeSons(Graph::NodeId node)=0
virtual void addFather(Graph::NodeId node, Graph::NodeId father)=0
virtual bool hasFather(Graph::NodeId node) const =0
void addSon(Graph::NodeId node, Graph::NodeId sonNode, Graph::EdgeId edge)
virtual bool isValid() const =0
virtual bool isRooted() const =0
unsigned int NodeId
Definition: Graph.h:66
unsigned int EdgeId
Definition: Graph.h:67