27 #include "../../datatype/SimpleData.h" 28 #include "../../graph/core/AbstractGraph.h" 29 #include "../../graph/core/Edge.h" 30 #include "../../graph/core/GraphMetadata.h" 31 #include "../../graph/core/Vertex.h" 32 #include "../../graph/iterator/MemoryIterator.h" 39 : m_normalize(normalize), m_a(a), m_factor(factor)
66 std::set<int>::iterator itNeighbours = neighbours.begin();
70 std::vector<double> weightVec;
72 while(itNeighbours != neighbours.end())
86 weight +=
m_a * (1. / (distance * distance));
102 weightVec.push_back(weight *
m_factor);
109 itNeighbours = neighbours.begin();
110 std::vector<double>::iterator itWeights = weightVec.begin();
112 while(itNeighbours != neighbours.end())
118 double weight = *itWeights;
122 weight = weight / tot;
virtual te::graph::Vertex * getFirstVertex()
It returns a pointer to the first vertex element of a graph.
void setAttributeVecSize(int size)
This function is used to set the number of attributes associated with the edge elements.
virtual te::graph::Vertex * getNextVertex()
It returns a pointer to the next vertex element of a graph.
This class defines a Generalized Proximity Matrix.
virtual void calculate(GeneralizedProximityMatrix *gpm)
bool getDistanceAttributeIndex(te::graph::GraphMetadata *gm, int &index)
Function used to get the distance attribute index.
GPMWeightsStrategyType m_type
Weight Type.
From the point of view of graph theory, vertices are treated as featureless and indivisible objects...
virtual te::graph::GraphMetadata * getMetadata()=0
Function used to access the graph metadata.
int createWeightAttribute(GeneralizedProximityMatrix *gpm)
Added to the edge a new attribute for weight information and return the attr index.
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
double getDistanceAttributeValue(te::graph::Edge *e, const int index)
Function used to get the distance value from a edge element.
Abstract class used to define the main functions of graph struct. All graph implementations must used...
GPMWeightsSquaredInverseDistanceStrategy(bool normalize, double a=1.0, double factor=1.0)
Default constructor.
std::set< int > & getSuccessors()
Returns the Successors vector.
virtual ~GPMWeightsSquaredInverseDistanceStrategy()
Virtual destructor.
A template for atomic data types (integers, floats, strings and others).
This class defines a class to calculates a weight for a GPM using Squared Inverse Distance strategy...
void addAttribute(int idx, te::dt::AbstractData *ad)
Add a new attribute to this element.
te::graph::AbstractGraph * getGraph()
This class defines the GPM class.