SiGraph: sulcal graphs


vertexclique.h
Go to the documentation of this file.
1
2#ifndef SI_GRAPH_VERTEXCLIQUE_H
3#define SI_GRAPH_VERTEXCLIQUE_H
4
5#include <set>
6#include <graph/graph/vertex.h>
7#include <si/graph/clique.h>
8
9
10namespace sigraph
11{
12
14 typedef std::set<Vertex *> CComponent;
15
16
19 class VertexClique : public Clique
20 {
21 public:
22 typedef std::set<Vertex*>::iterator iterator;
23 typedef std::set<Vertex*>::const_iterator const_iterator;
24
26 VertexClique( const std::set<Vertex*> & vert );
30 virtual void clear();
31
32 virtual Clique* deepCopy() const;
33
36 const std::set<Vertex*> & vertices() const;
37 void addVertex( Vertex* vert );
38 void removeVertex( Vertex* vert );
39 const_iterator begin() const;
40 const_iterator end() const;
41 size_t size() const;
43
46
47 template <class T> std::set <Vertex*>
48 getVerticesWith( const std::string& s, const T& t ) const;
50 std::set <Vertex*> getVerticesWith( const std::string& s ) const;
56 virtual void edgesBetweenLabels( const std::string & label1,
57 const std::string & label2,
58 std::set<Edge *> & ed ) const;
60 virtual void edgesBetween( const std::set<Vertex *> & s1,
61 const std::set<Vertex *> & s2,
62 std::set<Edge *> & ed ) const;
64
67
76 virtual unsigned connectivity( const std::string & label,
77 std::set<CComponent *> *sc = 0,
78 const std::string & SyntType = "" ) const;
80 static unsigned connectivity( const std::set<Vertex *> & vx,
81 std::set<CComponent *> *sc = 0,
82 const std::string & syntType = "" );
85 static unsigned connectivity( const std::set<Vertex *> & vx,
86 std::set<CComponent *> *sc,
87 const std::set<std::string> & syntTypes );
94 static void connPropagate( Vertex* v, const std::set<Vertex *> & vx,
95 std::set<Vertex *> & done, CComponent *cc,
96 const std::set<std::string> & syntTypes );
98
99 protected:
100 std::set<Vertex*> _vertices;
101
103 iterator begin();
105 iterator end();
106
107 private:
108 };
109
110 // Fonctions inline
111
113 {
114 }
115
116
117 inline const std::set<Vertex*> & VertexClique::vertices() const
118 {
119 return _vertices;
120 }
121
122
124 {
125 return _vertices.begin();
126 }
127
128
130 {
131 return _vertices.begin();
132 }
133
134
136 {
137 return _vertices.end();
138 }
139
140
142 {
143 return _vertices.end();
144 }
145
146
147 inline size_t VertexClique::size() const
148 {
149 return _vertices.size();
150 }
151
152
153 template <class T> inline std::set <Vertex*>
154 VertexClique::getVerticesWith( const std::string& s, const T& t ) const
155 {
156 std::set<Vertex*> vertices;
157
158 for( const_iterator v = begin(); v != end(); ++v )
159 {
160 carto::Object tmp = (*v)->getProperty( s );
161 if( !tmp )
162 std::cerr << "in vertex " << *v << ": prop " << s
163 << " is None\n";
164 else
165 try
166 {
167 if( tmp->GenericObject::value<T>() == t )
168 vertices.insert( *v );
169 }
170 catch( ... )
171 {
172 }
173 }
174
175 return vertices;
176 }
177
178}
179
180namespace carto
181{
182 DECLARE_GENERIC_OBJECT_TYPE( std::set<sigraph::VertexClique *> * )
184}
185
186#endif
VertexClique - clique of graph vertices.
std::set< Vertex * > getVerticesWith(const std::string &s) const
Find the vertices which contain a given semantic attribute.
VertexClique(const std::set< Vertex * > &vert)
const_iterator end() const
virtual void clear()
virtual Clique * deepCopy() const
copies the clique and the elements it refers too
std::set< Vertex * > getVerticesWith(const std::string &s, const T &t) const
Find the vertices which contain a given semantic attribute/value pair.
static unsigned connectivity(const std::set< Vertex * > &vx, std::set< CComponent * > *sc, const std::set< std::string > &syntTypes)
Calcule les composantes connexes pour un ensemble de noeuds et de syntaxes de relations.
const_iterator begin() const
size_t size() const
static unsigned connectivity(const std::set< Vertex * > &vx, std::set< CComponent * > *sc=0, const std::string &syntType="")
Calcule les composantes connexes pour un ensemble de noeuds.
virtual void edgesBetweenLabels(const std::string &label1, const std::string &label2, std::set< Edge * > &ed) const
Trouve les relations qui relient les noeuds de label {\tt label1} aux noeuds de label {\tt label2}...
void addVertex(Vertex *vert)
VertexClique(const VertexClique &cl)
Ne copie que les attributs, pas les noeuds contenus !
std::set< Vertex * >::const_iterator const_iterator
virtual void edgesBetween(const std::set< Vertex * > &s1, const std::set< Vertex * > &s2, std::set< Edge * > &ed) const
Trouve les relations entre deux sous-ensembles.
std::set< Vertex * > _vertices
const std::set< Vertex * > & vertices() const
virtual unsigned connectivity(const std::string &label, std::set< CComponent * > *sc=0, const std::string &SyntType="") const
Calcule les composantes connexes pour une étiquette.
static void connPropagate(Vertex *v, const std::set< Vertex * > &vx, std::set< Vertex * > &done, CComponent *cc, const std::set< std::string > &syntTypes)
Propagation d'une composante connexe.
void removeVertex(Vertex *vert)
std::set< Vertex * >::iterator iterator
std::set< Vertex * > CComponent
Composante connexe.
#define DECLARE_GENERIC_OBJECT_TYPE(T)