Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

EdgeWeightedGraph.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/GraphCopy.h>
35 
36 namespace ogdf {
37 
38 template<typename T>
39 class EdgeWeightedGraph: public Graph {
40 public:
42  : Graph()
43  , m_edgeWeight(*this, 0)
44  {
45  }
46 
48  {
49  }
50 
52  {
53  }
54 
56  {
57  edge e = Graph::newEdge(v, w);
58  m_edgeWeight[e] = weight;
59  return e;
60  }
61 
63  {
64  node u = Graph::newNode();
65  return u;
66  }
67 
68  T weight(const edge e) const
69  {
70  return m_edgeWeight[e];
71  }
72 
73  const EdgeArray<T> &edgeWeights() const
74  {
75  return m_edgeWeight;
76  }
77 
78  void setWeight(const edge e, T weight)
79  {
80  m_edgeWeight[e] = weight;
81  }
82 
83 protected:
85 };
86 
87 }
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:472
void setWeight(const edge e, T weight)
const EdgeArray< T > & edgeWeights() const
EdgeWeightedGraph(GraphCopy &gC)
Dynamic arrays indexed with edges.
Definition: EdgeArray.h:112
T weight(const edge e) const
edge newEdge(node v, node w, T weight)
edge newEdge(node v, node w)
Creates a new edge (v,w) and returns it.
Declaration of graph copy classes.
Class for the representation of edges.
Definition: Graph_d.h:291
Copies of graphs supporting edge splitting.
Definition: GraphCopy.h:250
Class for the representation of nodes.
Definition: Graph_d.h:167
The namespace for all OGDF objects.
node newNode()
Creates a new node and returns it.