21 #ifndef TULIP_SUPERGRAPHABSTRACT_H 22 #define TULIP_SUPERGRAPHABSTRACT_H 26 #include <tulip/Graph.h> 27 #include <tulip/DataSet.h> 33 class PropertyManager;
37 class TLP_SCOPE GraphAbstract :
public Graph {
38 friend class PropertyManager;
42 std::vector<Graph *> subgraphs;
43 Graph *subGraphToKeep;
45 GraphProperty *metaGraphProperty;
48 GraphAbstract(Graph *supergraph,
unsigned int id = 0);
51 ~GraphAbstract()
override;
52 void clear()
override;
54 Graph *addSubGraph(
unsigned int id, BooleanProperty *selection =
nullptr,
55 const std::string &name =
"unnamed");
56 Graph *addSubGraph(BooleanProperty *selection =
nullptr,
57 const std::string &name =
"unnamed")
override {
58 return addSubGraph(0, selection, name);
60 void delSubGraph(Graph *)
override;
61 void delAllSubGraphs(Graph *)
override;
62 inline Graph *getSuperGraph()
const override {
65 inline Graph *getRoot()
const override {
68 Iterator<Graph *> *getSubGraphs()
const override;
69 inline const std::vector<Graph *> &subGraphs()
const override {
72 bool isSubGraph(
const Graph *sg)
const override;
73 bool isDescendantGraph(
const Graph *sg)
const override;
74 Graph *getSubGraph(
unsigned int id)
const override;
75 Graph *getSubGraph(
const std::string &name)
const override;
76 Graph *getDescendantGraph(
unsigned int id)
const override;
77 Graph *getDescendantGraph(
const std::string &name)
const override;
78 Graph *getNthSubGraph(
unsigned int n)
const override;
79 inline unsigned int numberOfSubGraphs()
const override {
80 return subgraphs.size();
82 unsigned int numberOfDescendantGraphs()
const override;
85 bool isMetaNode(
const node)
const override;
86 Graph *getNodeMetaInfo(
const node)
const override;
87 void delNodes(Iterator<node> *itN,
bool deleteInAllGraphs)
override;
88 bool isMetaEdge(
const edge)
const override;
89 Iterator<edge> *getEdgeMetaInfo(
const edge)
const override;
90 void delEdges(Iterator<edge> *itE,
bool deleteInAllGraphs =
false)
override;
92 node getOneNode()
const override;
93 node getRandomNode()
const override;
94 node getInNode(
const node,
unsigned int)
const override;
95 node getOutNode(
const node,
unsigned int)
const override;
96 edge getOneEdge()
const override;
97 edge getRandomEdge()
const override;
99 bool existProperty(
const std::string &)
const override;
100 bool existLocalProperty(
const std::string &)
const override;
101 void delLocalProperty(
const std::string &)
override;
102 void addLocalProperty(
const std::string &name, PropertyInterface *prop)
override;
103 Iterator<std::string> *getLocalProperties()
const override;
104 Iterator<std::string> *getInheritedProperties()
const override;
105 Iterator<std::string> *getProperties()
const override;
106 Iterator<PropertyInterface *> *getLocalObjectProperties()
const override;
107 Iterator<PropertyInterface *> *getInheritedObjectProperties()
const override;
108 Iterator<PropertyInterface *> *getObjectProperties()
const override;
109 PropertyInterface *getProperty(
const std::string &)
const override;
112 GraphProperty *getMetaGraphProperty();
114 void setName(
const std::string &name)
override;
115 std::string getName()
const override;
117 Iterator<node> *bfs(
const node root = node())
const override;
118 Iterator<node> *dfs(
const node root = node())
const override;
121 DataSet &getNonConstAttributes()
override {
124 void setSuperGraph(Graph *)
override;
125 PropertyManager *propertyContainer;
126 const std::set<edge> &getReferencedEdges(
const edge)
const;
128 bool renameLocalProperty(PropertyInterface *prop,
const std::string &newName)
override;
131 void clearSubGraphs()
override;
132 void removeSubGraph(Graph *)
override;
133 void restoreSubGraph(Graph *)
override;
134 void setSubGraphToKeep(Graph *)
override;
137 void delAllSubGraphs();
139 void notifyBeforeAddInheritedProperty(
const std::string &prop);
140 void notifyAddInheritedProperty(
const std::string &prop);
141 void notifyBeforeDelInheritedProperty(
const std::string &prop);
142 void notifyAfterDelInheritedProperty(
const std::string &prop);
144 void notifyBeforeRenameLocalProperty(PropertyInterface *prop,
const std::string &newName);
145 void notifyAfterRenameLocalProperty(PropertyInterface *prop,
const std::string &oldName);