data: Switched Graph implementation to use std::map with Id as key for Nodes and Edges

This commit is contained in:
Eberhard Graether
2014-07-26 23:32:16 +02:00
parent 16d49e58cc
commit 473e26f072
2 changed files with 41 additions and 60 deletions
+5 -5
View File
@@ -1,10 +1,10 @@
#ifndef GRAPH_H
#define GRAPH_H
#include <map>
#include <memory>
#include <ostream>
#include <deque>
#include <vector>
#include "data/graph/Edge.h"
#include "data/graph/Node.h"
@@ -49,8 +49,8 @@ public:
void clear();
protected:
const std::vector<std::shared_ptr<Node> >& getNodes() const;
const std::vector<std::shared_ptr<Edge> >& getEdges() const;
const std::map<Id, std::shared_ptr<Node>>& getNodes() const;
const std::map<Id, std::shared_ptr<Edge>>& getEdges() const;
private:
static const std::string DELIMITER;
@@ -63,8 +63,8 @@ private:
const std::string m_delimiter;
std::vector<std::shared_ptr<Node> > m_nodes;
std::vector<std::shared_ptr<Edge> > m_edges;
std::map<Id, std::shared_ptr<Node>> m_nodes;
std::map<Id, std::shared_ptr<Edge>> m_edges;
friend std::ostream& operator<<(std::ostream& ostream, const Graph& graph);
};