Open
Graph Drawing
Framework
v.2012.07
Overview
Class Hierarchy
Class Index
Class List
Members
Namespaces
Source Files
NodePairEnergy.h
Go to the documentation of this file.
1
/*
2
* $Revision: 2523 $
3
*
4
* last checkin:
5
* $Author: gutwenger $
6
* $Date: 2012-07-02 20:59:27 +0200 (Mon, 02 Jul 2012) $
7
***************************************************************/
8
46
#ifdef _MSC_VER
47
#pragma once
48
#endif
49
50
#ifndef OGDF_NODE_PAIR_ENERGY_H
51
#define OGDF_NODE_PAIR_ENERGY_H
52
53
54
#include <
ogdf/internal/energybased/AdjacencyOracle.h
>
55
#include <
ogdf/internal/energybased/EnergyFunction.h
>
56
#include <
ogdf/internal/energybased/IntersectionRectangle.h
>
57
58
59
namespace
ogdf {
60
61
class
NodePairEnergy
:
public
EnergyFunction
{
62
public
:
63
//Initializes data dtructures to speed up later computations
64
NodePairEnergy
(
const
String
energyname,
GraphAttributes
&AG);
65
virtual
~NodePairEnergy
() {
delete
m_nodeNums
;
delete
m_pairEnergy
;}
66
//computes the energy of the initial layout
67
void
computeEnergy
();
68
protected
:
69
//computes the energy stored by a pair of vertices at the given positions
70
virtual
double
computeCoordEnergy
(
node
,
node
,
const
DPoint
&,
const
DPoint
&)
const
= 0;
71
//returns the internal number given to each vertex
72
int
nodeNum
(
node
v)
const
{
return
(*
m_nodeNums
)[v]; }
73
//returns true in constant time if two vertices are adjacent
74
bool
adjacent
(
const
node
v,
const
node
w)
const
{
return
m_adjacentOracle
.
adjacent
(v,w);}
75
//returns the shape of a vertex as an IntersectionRectangle
76
const
IntersectionRectangle
&
shape
(
const
node
v)
const
{
return
m_shape
[v];}
77
78
#ifdef OGDF_DEBUG
79
virtual
void
printInternalData()
const
;
80
#endif
81
82
private
:
83
NodeArray<int>
*
m_nodeNums
;
//stores internal number of each vertex
84
Array2D<double>
*
m_pairEnergy
;
//stores for each pair of vertices its energy
85
NodeArray<double>
m_candPairEnergy
;
//stores for each vertex its pair energy with
86
//respect to the vertex to be moved if its new position is chosen
87
NodeArray<IntersectionRectangle>
m_shape
;
//stores the shape of each vertex as
88
//an IntersectionRectangle
89
List<node>
m_nonIsolated
;
//list of vertices with degree greater zero
90
const
AdjacencyOracle
m_adjacentOracle
;
//structure for constant time adjacency queries
91
//function computes energy stored in a certain pair of vertices
92
double
computePairEnergy
(
const
node
v,
const
node
w)
const
;
93
//computes energy of whole layout if new position of the candidate vertex is chosen
94
void
compCandEnergy
();
95
//If a candidate change is chosen as the new position, this function sets the
96
//internal data accordingly
97
void
internalCandidateTaken
();
98
};
99
100
101
}
// namespace ogdf
102
103
#endif
ogdf
internal
energybased
NodePairEnergy.h
© 1999-2012 by
TU Dortmund
,
University of Jena
,
University of Cologne
,
University of Sydney
,
oreas GmbH