Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
Edge.h
Go to the documentation of this file.
1
32#pragma once
33
34#include <ogdf/basic/Graph.h>
35
36namespace ogdf {
37namespace energybased {
38namespace fmmm {
39
42class Edge {
44 friend std::ostream& operator<<(std::ostream& output, const Edge& E) {
45 output << "edge_index " << E.e->index() << " Graph_ptr " << E.Graph_ptr << " angle"
46 << E.angle << " cut vertex " << E.cut_vertex->index();
47 return output;
48 }
49
50#if 0
52 friend std::istream &operator>> (std::istream & input, Edge & E)
53 {
54 input >> E;//.e>>E.Graph_ptr;
55 return input;
56 }
57#endif
58
59public:
61 Edge() {
62 e = nullptr;
63 Graph_ptr = nullptr;
64 angle = 0;
65 cut_vertex = nullptr;
66 }
67
70 e = f;
71 }
72
73 void set_Edge(edge f, double i, node c) {
74 angle = i;
75 e = f;
76 cut_vertex = c;
77 }
78
79 Graph* get_Graph_ptr() const { return Graph_ptr; }
80
81 edge get_edge() const { return e; }
82
83 double get_angle() const { return angle; }
84
85 node get_cut_vertex() const { return cut_vertex; }
86
87private:
90 double angle;
92};
93
94class EdgeMaxBucketFunc : public BucketFunc<Edge> {
95public:
97
98 int getBucket(const Edge& E) override { return get_max_index(E); }
99
100private:
102 int get_max_index(const Edge& E) {
103 int source_index = E.get_edge()->source()->index();
104 int target_index = E.get_edge()->target()->index();
105 OGDF_ASSERT(source_index != target_index); // no self-loop
107 return target_index;
108 } else {
109 return source_index;
110 }
111 }
112};
113
114class EdgeMinBucketFunc : public BucketFunc<Edge> {
115public:
117
118 int getBucket(const Edge& E) override { return get_min_index(E); }
119
120private:
122 int get_min_index(const Edge& E) {
123 int source_index = E.get_edge()->source()->index();
124 int target_index = E.get_edge()->target()->index();
125 OGDF_ASSERT(source_index != target_index); // no self-loop
127 return source_index;
128 } else {
129 return target_index;
130 }
131 }
132};
133
134}
135}
136}
Includes declaration of graph class.
Abstract base class for bucket functions.
Definition basic.h:241
Class for the representation of edges.
Definition Graph_d.h:300
int index() const
Returns the index of the edge.
Definition Graph_d.h:332
node target() const
Returns the target node of the edge.
Definition Graph_d.h:338
node source() const
Returns the source node of the edge.
Definition Graph_d.h:335
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:521
Class for the representation of nodes.
Definition Graph_d.h:177
int index() const
Returns the (unique) node index.
Definition Graph_d.h:211
helping data structure for deleting parallel edges in class FMMMLayout and Multilevel (needed for the...
Definition Edge.h:42
void set_Edge(edge f, Graph *g_ptr)
Definition Edge.h:68
friend std::ostream & operator<<(std::ostream &output, const Edge &E)
outputstream for Edge
Definition Edge.h:44
node get_cut_vertex() const
Definition Edge.h:85
void set_Edge(edge f, double i, node c)
Definition Edge.h:73
edge get_edge() const
Definition Edge.h:81
Graph * get_Graph_ptr() const
Definition Edge.h:79
double get_angle() const
Definition Edge.h:83
int getBucket(const Edge &E) override
Definition Edge.h:98
int get_max_index(const Edge &E)
returns the maximum index of e
Definition Edge.h:102
int get_min_index(const Edge &E)
returns the minimum index of e
Definition Edge.h:122
int getBucket(const Edge &E) override
Definition Edge.h:118
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition basic.h:41
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
std::istream & operator>>(std::istream &is, TokenIgnorer token)