Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

EdgeWeightedGraph.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Graph.h>
35 
36 namespace ogdf {
37 class GraphCopy;
38 
39 template<typename T>
40 class EdgeWeightedGraph : public Graph {
41 public:
42  EdgeWeightedGraph() : Graph(), m_edgeWeight(*this, 0) { }
43 
44  explicit EdgeWeightedGraph(GraphCopy& gC) { }
45 
46  virtual ~EdgeWeightedGraph() { }
47 
49  edge e = Graph::newEdge(v, w);
50  m_edgeWeight[e] = weight;
51  return e;
52  }
53 
55  node u = Graph::newNode();
56  return u;
57  }
58 
59  T weight(const edge e) const { return m_edgeWeight[e]; }
60 
61  const EdgeArray<T>& edgeWeights() const { return m_edgeWeight; }
62 
63  void setWeight(const edge e, T weight) { m_edgeWeight[e] = weight; }
64 
65 protected:
67 };
68 
69 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
Graph.h
Includes declaration of graph class.
ogdf::EdgeWeightedGraph::newEdge
edge newEdge(node v, node w, T weight)
Definition: EdgeWeightedGraph.h:48
ogdf::EdgeWeightedGraph::weight
T weight(const edge e) const
Definition: EdgeWeightedGraph.h:59
ogdf::GraphCopy
Copies of graphs supporting edge splitting.
Definition: GraphCopy.h:391
ogdf::EdgeWeightedGraph::~EdgeWeightedGraph
virtual ~EdgeWeightedGraph()
Definition: EdgeWeightedGraph.h:46
ogdf::EdgeWeightedGraph::EdgeWeightedGraph
EdgeWeightedGraph()
Definition: EdgeWeightedGraph.h:42
ogdf::gml::Key::Graph
@ Graph
ogdf::EdgeWeightedGraph::edgeWeights
const EdgeArray< T > & edgeWeights() const
Definition: EdgeWeightedGraph.h:61
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::EdgeWeightedGraph::m_edgeWeight
EdgeArray< T > m_edgeWeight
Definition: EdgeWeightedGraph.h:66
ogdf::Graph::newNode
node newNode(int index=-1)
Creates a new node and returns it.
Definition: Graph_d.h:1064
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
ogdf::EdgeWeightedGraph::newNode
node newNode()
Definition: EdgeWeightedGraph.h:54
ogdf::EdgeWeightedGraph::EdgeWeightedGraph
EdgeWeightedGraph(GraphCopy &gC)
Definition: EdgeWeightedGraph.h:44
ogdf::EdgeWeightedGraph::setWeight
void setWeight(const edge e, T weight)
Definition: EdgeWeightedGraph.h:63
ogdf::Graph::newEdge
edge newEdge(node v, node w, int index=-1)
Creates a new edge (v,w) and returns it.
Definition: Graph_d.h:1083
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716