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"
37 m_normalize(normalize),
51 int weightIdx = createWeightAttribute(gpm);
67 std::set<int>::iterator itNeighbours = neighbours.begin();
71 std::vector<double> weightVec;
73 while(itNeighbours != neighbours.end())
84 double distance = getDistanceAttributeValue(e, distanceIdx);
87 weight += m_a * (1. / distance);
103 weightVec.push_back(weight * m_factor);
110 itNeighbours = neighbours.begin();
111 std::vector<double>::iterator itWeights = weightVec.begin();
113 while(itNeighbours != neighbours.end())
119 double weight = *itWeights;
121 if(m_normalize && tot != 0.)
123 weight = weight / tot;
virtual te::graph::Vertex * getFirstVertex()
It returns a pointer to the first vertex element of a graph.
GPMWeightsInverseDistanceStrategy(bool normalize, double a=1.0, double factor=1.0)
Default constructor.
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.
virtual ~GPMWeightsInverseDistanceStrategy()
Virtual destructor.
This class defines a Generalized Proximity Matrix.
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.
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
Abstract class used to define the main functions of graph struct. All graph implementations must used...
std::set< int > & getSuccessors()
Returns the Successors vector.
This class defines a an Abstract class to calculates a weight for a GPM.
This class defines a class to calculates a weight for a GPM using Inverse Distance strategy...
A template for atomic data types (integers, floats, strings and others).
void addAttribute(int idx, te::dt::AbstractData *ad)
Add a new attribute to this element.
virtual void calculate(GeneralizedProximityMatrix *gpm)
te::graph::AbstractGraph * getGraph()
This class defines the GPM class.