1 #include <mapstorage.h>
3 MapStorage::MapStorage(Graph & graph):g(graph)
5 for(int i=0;i<EDGE_PROPERTY_NUM;i++)
7 Graph::EdgeMap<double> emd(g,edge_property_defaults[i]);
8 default_edgemaps.push_back(emd);
11 for(int i=0;i<NODE_PROPERTY_NUM;i++)
13 Graph::NodeMap<double> nmd(g,node_property_defaults[i]);
14 default_nodemaps.push_back(nmd);
17 for(int i=0;i<EDGE_PROPERTY_NUM;i++)
19 for (EdgeIt j(g); j!=INVALID; ++j)
21 (default_edgemaps[i])[j]=edge_property_defaults[i];
23 addEdgeMap(edge_property_strings[i],&(default_edgemaps[i]));
26 for(int i=0;i<NODE_PROPERTY_NUM;i++)
28 for (NodeIt j(g); j!=INVALID; ++j)
30 (default_nodemaps[i])[j]=node_property_defaults[i];
32 addNodeMap(node_property_strings[i],&(default_nodemaps[i]));
37 int MapStorage::addNodeMap(const std::string & name, Graph::NodeMap<double> *nodemap)
39 nodemap_storage[name]=nodemap;
43 int MapStorage::addEdgeMap(const std::string & name, Graph::EdgeMap<double> *edgemap)
45 edgemap_storage[name]=edgemap;
49 double MapStorage::maxOfNodeMap(const std::string & name)
52 for (NodeIt j(g); j!=INVALID; ++j)
54 if( (*nodemap_storage[name])[j]>max )
56 max=(*nodemap_storage[name])[j];
62 double MapStorage::maxOfEdgeMap(const std::string & name)
65 for (EdgeIt j(g); j!=INVALID; ++j)
67 if( (*edgemap_storage[name])[j]>max )
69 max=(*edgemap_storage[name])[j];
75 double MapStorage::minOfNodeMap(const std::string & name)
78 double min=(*nodemap_storage[name])[j];
79 for (; j!=INVALID; ++j)
81 if( (*nodemap_storage[name])[j]<min )
83 min=(*nodemap_storage[name])[j];
89 double MapStorage::minOfEdgeMap(const std::string & name)
92 double min=(*edgemap_storage[name])[j];
93 for (EdgeIt j(g); j!=INVALID; ++j)
95 if( (*edgemap_storage[name])[j]<min )
97 min=(*edgemap_storage[name])[j];
103 void MapStorage::init_maps_for_edge(Graph::Edge e)
106 // beragad, aztan csovez
107 // std::map< std::string,Graph::EdgeMap<double> * >::iterator ems_it;
108 // for(ems_it=edgemap_storage.begin();ems_it!=edgemap_storage.end();ems_it++)
110 // std::cout << "szevasz\n";
111 // (*((*ems_it).second))[e]=0;
113 // std::cout << std::endl;
115 // g_closure_invoke...
116 // for(int i=0;i<EDGE_PROPERTY_NUM;i++)
118 // (default_edgemaps[i])[e]=property_defaults[i];