32 int mVertexIdGenerator;
69 static inline SP::GPM_Graph
New() {
122 SP::GPM_Vertex vertex=
newNode();
132 SP::GPM_Vertex vertex=
newNode();
167 void getVertices(vector<tVertexIID>& vertexIIDs)
const;
170 void getVertices(SV::GPM_Vertex& vertexIIDs)
const;
202 virtual SP::GPM_Edge
newEdge(
const int&
id)
const {
208 virtual SP::GPM_Edge
newEdge(SP::GPM_Vertex source,SP::GPM_Vertex target)
const {
218 if (sourceIID==NULL_VERTEX) sourceIID=
addNode(source);
220 if (targetIID==NULL_VERTEX) targetIID=
addNode(target);
224 return addEdge(sourceIID,targetIID,edge,iid);
242 if (!
addEdge(from,to,edge,eiid)) edge.reset();
251 if (!succeeds) edge.reset();
281 void getEdges(vector<tEdgeIID>& ids)
const;
285 void getEdges(SV::GPM_Edge& edges)
const;
403 const vector<tVertexIID>& mapping,
411 void updateGroupIdMap(map<tString,unsigned int>& groupIds)
const;
426 if (g.get()==
null)
return false;
435 vector<tVertexIID> verticesMap;
444 vector<tVertexIID> verticesMap;
452 vector<vector<tVertexIID> >& homomorphisms,
CORE_Out& io)
const;
458 vector<vector<tVertexIID> >& homomorphisms,
CORE_Out& io)
const {
459 if (pattern.get()==
null)
throw CORE_Exception(
"gpm/core",
"GPM_Graph::getPatterns",
"null graph pattern !");
460 getPatterns(*pattern.get(),isUpToAutomorphism,upToAutomorphismType,homomorphisms,io);
466 getPatterns(pattern,
false,UP_TO_AUTOMORPHISM_ALL,homomorphisms,io);
471 inline void getPatterns(SPC::GPM_Graph pattern,vector<vector<tVertexIID> >& homomorphisms,
CORE_Out& io)
const {
472 getPatterns(pattern,
false,UP_TO_AUTOMORPHISM_ALL,homomorphisms,io);
486 void saveToStream(ofstream& f)
const;
tBoolean saveToFile(const tString &fileName) const
save graph to txt file
Definition: GPM_Graph.cpp:793
virtual tBoolean exportToCurveFile(const tString &fileName, const tString &title, const tString &XLabel, const tString &YLabel) const
export to a curve file
Definition: GPM_Graph.cpp:1120
tBoolean removeEdges(const tVertexIID &vertexIID)
remove all edges from vertex with internal id WARNING: the edgeIID of all the edges may changed ! ...
Definition: GPM_Graph.cpp:499
virtual SP::GPM_Node newNode() const
create a node
Definition: GPM_Graph.h:102
tBoolean isIsomorph(const GPM_Graph &g, CORE_Out &io) const
return true if graph is isomorph
Definition: GPM_Graph.h:443
tBoolean isIsomorph(SPC::GPM_Graph g, CORE_Out &io) const
return true if graph is isomorph
Definition: GPM_Graph.h:434
static SP::GPM_Graph New()
create a graphs
Definition: GPM_Graph.h:69
void getConnectedVertices(const tVertexIID &iid, vector< tVertexIID > &vertexIIDs) const
get the internal id vertices connected to vertex with internal iid
Definition: GPM_Graph.cpp:380
virtual void copy(const GPM_Graph &graph)
void copy
Definition: GPM_Graph.cpp:215
const tGraph & getGraphImplement() const
get the graph implementation
Definition: GPM_Graph.h:80
virtual SP::GPM_Edge addEdge(const tVertexIID &from, const tVertexIID &to)
add an edge with name label between vertices from & to
Definition: GPM_Graph.h:238
tGraph::edge_descriptor tEdgeIID
Definition: GPM_Types.h:50
int getVertexId(const tVertexIID &iid) const
get the id of vertex with internal id
Definition: GPM_Graph.cpp:300
void getEdgeVertices(const tEdgeIID &id, tVertexIID &source, tVertexIID &target) const
get vertices of edges
Definition: GPM_Graph.cpp:587
void printGroupId(CORE_Out &io) const
print the group id
Definition: GPM_Graph.cpp:1178
boost::adjacency_list< boost::listS, boost::vecS, boost::undirectedS, VertexProperties, EdgeProperties > tGraph
Definition: GPM_Types.h:36
tVertexIID addNode()
add vertex
Definition: GPM_Graph.h:121
int getEdgeId(const tEdgeIID &iid) const
get id of edge with internal id iid
Definition: GPM_Graph.cpp:546
void clear()
clear the graph
Definition: GPM_Graph.cpp:601
void getEdges(vector< tEdgeIID > &ids) const
get the index of edges of the graph
Definition: GPM_Graph.cpp:528
int getDegree(const tVertexIID &id) const
get the edges number connected to vertex with id
Definition: GPM_Graph.cpp:399
void getPatterns(SPC::GPM_Graph pattern, const tBoolean &isUpToAutomorphism, const tFlag &upToAutomorphismType, vector< vector< tVertexIID > > &homomorphisms, CORE_Out &io) const
get all the patterns in graph this thanks to homomorphism mappings pattern must be smaller ...
Definition: GPM_Graph.h:457
tBoolean getEdgeIID(const int &id, tEdgeIID &iid) const
get the internal id of edge with id (for convenience use)
Definition: GPM_Graph.cpp:552
#define tBoolean
Definition: types.h:35
tBoolean isIsomorph(const GPM_Graph &g, vector< tVertexIID > &verticesMap, CORE_Out &io) const
return true if graph is isomorph
Definition: GPM_Graph.cpp:1222
static SP::GPM_Node New()
create a node
Definition: GPM_Node.h:47
virtual tBoolean isMappingValid(const SV::GPM_Vertex &smallGraphVertices, const vector< tVertexIID > &mapping, CORE_Out &io) const
return true if the mapping is valid
Definition: GPM_Graph.h:402
void getPatterns(const GPM_Graph &pattern, const tBoolean &isUpToAutomorphism, const tFlag &upToAutomorphismType, vector< vector< tVertexIID > > &homomorphisms, CORE_Out &io) const
get all the patterns in graph this thanks to homomorphism mappings pattern must be smaller ...
Definition: GPM_Graph.cpp:1261
tBoolean addEdgeFromIds(const int &source, const int &target, tEdgeIID &iid)
add ad edge from vertex ids (convenience method)
Definition: GPM_Graph.h:215
void getPatterns(const GPM_Graph &pattern, vector< vector< tVertexIID > > &homomorphisms, CORE_Out &io) const
get all the patterns in graph this thanks to homomorphism mappings pattern must be smaller ...
Definition: GPM_Graph.h:465
virtual tBoolean addEdge(const tVertexIID &from, const tVertexIID &to, SP::GPM_Edge edge, tEdgeIID &iid)
add an edge with name label between vertices from & to
Definition: GPM_Graph.cpp:444
#define null
Definition: types.h:13
tBoolean loadFromFile(const tString &fileName, CORE_Out &io)
load graph from txt file
Definition: GPM_Graph.cpp:859
virtual ~GPM_Graph(void)
destroy an object.
Definition: GPM_Graph.cpp:208
tBoolean getEdge(const tVertexIID &e1, const tVertexIID &e2, tEdgeIID &iid) const
get edge between vertices e1 & e2
Definition: GPM_Graph.cpp:409
GPM_Graph(void)
create an object
Definition: GPM_Graph.cpp:199
tBoolean merge(const tVertexIID &from, const tVertexIID &to, CORE_Out &io)
merge two vertex
Definition: GPM_Graph.cpp:608
this class describes the exceptions raised for CORE package
Definition: CORE_Exception.h:15
This class describes a edge.
Definition: GPM_Edge.h:15
tVertexIID addVertex(SP::GPM_Vertex vertex)
add vertex vertex with id
Definition: GPM_Graph.cpp:306
tGraph::vertex_descriptor tVertexIID
Definition: GPM_Types.h:45
virtual tBoolean addEdge(const tVertexIID &from, const tVertexIID &to, tEdgeIID &eiid)
add an edge with name label between vertices from & to
Definition: GPM_Graph.h:247
void getPatterns(SPC::GPM_Graph pattern, vector< vector< tVertexIID > > &homomorphisms, CORE_Out &io) const
get all the patterns in graph this thanks to homomorphism mappings pattern must be smaller ...
Definition: GPM_Graph.h:471
tBoolean isIsomorph(SPC::GPM_Graph g, vector< tVertexIID > &verticesMap, CORE_Out &io) const
return true if graph is isomorph
Definition: GPM_Graph.h:425
SP::GPM_Vertex getVertex(const tVertexIID &iid) const
get vertex with internal id
Definition: GPM_Graph.cpp:330
static SP::GPM_Edge New()
create an edge
Definition: GPM_Edge.h:67
int getEdgesNumber() const
get the edges number
Definition: GPM_Graph.cpp:522
void removeVertex(const tVertexIID &iid)
remove vertex with internal id: iid WARNING: the vertexIID of all the nodes may changed ! ...
Definition: GPM_Graph.cpp:346
static const tFlag UP_TO_AUTOMORPHISM_PORT
Definition: GPM_Graph.h:27
void getVertices(vector< tVertexIID > &vertexIIDs) const
get the internal id of all vertices
Definition: GPM_Graph.cpp:361
static const tFlag UP_TO_AUTOMORPHISM_NODE
Definition: GPM_Graph.h:26
tVertexIID getVertexIID(const int &id) const
get the internal id of vertex with id (for convenience use)
Definition: GPM_Graph.cpp:284
int generateVertexId()
generate a vertex id
Definition: GPM_Graph.cpp:275
#define tString
Definition: types.h:36
virtual SP::GPM_GraphElement newInstance(const tString &className) const
create a new instance of token
Definition: GPM_Graph.cpp:251
tGraph & getGraphImplement()
get the graph implementation
Definition: GPM_Graph.h:86
void close()
close the graph
virtual SP::GPM_Edge newEdge(SP::GPM_Vertex source, SP::GPM_Vertex target) const
create a node
Definition: GPM_Graph.h:208
virtual tString toString() const
set the graph to string
Definition: GPM_Graph.cpp:754
static const tVertexIID NULL_VERTEX
Definition: GPM_Graph.h:24
this class describes the output by default write on standart output
Definition: CORE_Out.h:21
static const tFlag UP_TO_AUTOMORPHISM_ALL
Definition: GPM_Graph.h:25
tBoolean getEdgeFromIds(const int &e1, const int &e2) const
get edge between vertices e1 & e2 (convenience method)
Definition: GPM_Graph.h:303
virtual SP::GPM_Edge newEdge() const
get the edge internal id
Definition: GPM_Graph.h:197
int generateEdgeId()
generate a edge id
Definition: GPM_Graph.cpp:279
tVertexIID addNode(const int &id)
add vertex with id
Definition: GPM_Graph.h:131
tBoolean addEdge_(const tVertexIID &from, const tVertexIID &to, SP::GPM_Edge edge, tEdgeIID &iid)
add edge without verifications if edge or vertices exists
Definition: GPM_Graph.cpp:482
int getVerticesNumber() const
the the vertices numbers
Definition: GPM_Graph.cpp:340
This class is the base class of all graph classes.
Definition: GPM_Object.h:17
void addSubGraph(const GPM_Graph &graph, map< tVertexIID, tVertexIID > &connections)
add sub graph
Definition: GPM_Graph.cpp:641
This class describes a graph which is a list of nodes & ports.
Definition: GPM_Graph.h:19
void updateGroupId()
update the group Id of all elements of graph
Definition: GPM_Graph.cpp:1191
tBoolean removeEdge(const tEdgeIID &edgeId)
remove edge with id WARNING: the edgeIID of all the edges may changed !
Definition: GPM_Graph.cpp:491
tBoolean addEdgeFromIds(const int &source, const int &target)
add vertex from vertex ids (convenience method)
Definition: GPM_Graph.h:228
void executeTriggerActions(CORE_Out &io)
execute trigger actions
Definition: GPM_Graph.cpp:697
virtual SP::GPM_Edge newEdge(const int &id) const
create a node
Definition: GPM_Graph.h:202
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106
#define tFlag
Definition: types.h:14
tBoolean getEdgeFromIds(const int &e1, const int &e2, tEdgeIID &iid) const
get edge between vertices e1 & e2 (convenience method)
Definition: GPM_Graph.h:298