1 #ifndef GRAPH_PROPERTIES_H_
2 #define GRAPH_PROPERTIES_H_
6 template<
typename GraphType>
18 typename node_property_map_t::iterator it = node_property_map_.begin();
19 for (; it != node_property_map_.end(); it++) {
24 typename edge_property_map_t::iterator edge_it = edge_property_map_.begin();
25 for (; edge_it != edge_property_map_.end(); edge_it++) {
26 delete edge_it->second;
36 void set_property(V_type node, std::string property, std::string value) {
37 typename node_property_map_t::iterator it = node_property_map_.find(node);
39 property_map_t* n = 0;
40 if (it != node_property_map_.end()) {
43 n =
new property_map_t();
44 node_property_map_.insert(node_property_map_.end(), std::make_pair(node, n));
46 (*n)[property] = value;
55 void set_property(E_type edge, std::string property, std::string value) {
56 typename edge_property_map_t::iterator it = edge_property_map_.find(edge);
58 property_map_t* prop_map = 0;
59 if (it != edge_property_map_.end()) {
60 prop_map = it->second;
63 prop_map =
new property_map_t();
64 edge_property_map_.insert(edge_property_map_.end(), std::make_pair(edge, prop_map));
66 (*prop_map)[property] = value;
75 typename node_property_map_t::iterator it = node_property_map_.find(node);
77 if (it != node_property_map_.end()) {
78 property_map_t property_map = *node_property_map_[node];
80 typename property_map_t::iterator it2 = property_map.find(property);
82 if (it2 != property_map.end()) {
83 return property_map[property];
95 typename edge_property_map_t::iterator it = edge_property_map_.find(edge);
97 if (it != edge_property_map_.end()) {
98 property_map_t property_map = *edge_property_map_[edge];
100 typename property_map_t::iterator it2 = property_map.find(property);
102 if (it2 != property_map.end()) {
103 return property_map[property];
114 typename node_property_map_t::iterator it = node_property_map_.find(node);
116 if (it != node_property_map_.end()) {
117 return node_property_map_[node];
127 typename edge_property_map_t::iterator it = edge_property_map_.find(edge);
129 if (it != edge_property_map_.end()) {
130 return edge_property_map_[edge];
138 typename node_property_map_t::iterator it = node_property_map_.begin();
139 for (; it != node_property_map_.end(); it++) {
142 node_property_map_.clear();
144 typename edge_property_map_t::iterator edge_it = edge_property_map_.begin();
146 for (; edge_it != edge_property_map_.end(); edge_it++) {
147 delete edge_it->second;
149 edge_property_map_.clear();
154 node_property_map_t node_property_map_;
157 edge_property_map_t edge_property_map_;
property_map_t * get_all_properties(E_type edge)
Definition: graph_properties.h:126
std::string get_property(E_type edge, std::string property)
Definition: graph_properties.h:94
void set_property(V_type node, std::string property, std::string value)
Definition: graph_properties.h:36
property_map_t * get_all_properties(V_type node)
Definition: graph_properties.h:113
Forward declarations for functors.
Definition: defines.h:32
void set_property(E_type edge, std::string property, std::string value)
Definition: graph_properties.h:55
void clear()
Clear all properties for both nodes and edges.
Definition: graph_properties.h:137
std::string get_property(V_type node, std::string property)
Definition: graph_properties.h:74
Definition: graph_properties.h:7
std::map< E_type, property_map_t *, E_CompareFunctor > edge_property_map_t
Type used to map an edge type to its propertymap.
Definition: grapher.h:86
std::map< V_type, property_map_t *, V_CompareFunctor > node_property_map_t
Type used to map a node type to its propertymap.
Definition: grapher.h:83
std::map< std::string, std::string > property_map_t
Type used to map a property (as string) to a value (as string)
Definition: grapher.h:80
unsigned int index_type_t
The type of index used for the nodes in the graph.
Definition: grapher.h:52