64 Node(
long id,
float x,
float y,
int ins);
210 void addIndicator(std::string aIndicator,
long aIndicatorValue );
282 Link(
long id,
long start_node,
long end_node,
float length);
418 DHeap(
unsigned long size,
unsigned int d);
426 DHeap(
unsigned int d,
long node_id, std::map<long, Node> &Nodes);
544 _Nodes[nodeId].addLinkOutId(linkId);
void setMaxY(float maxY)
Set maximum x coordinate.
Definition: Network.hpp:613
long _id
id of the node.
Definition: Network.hpp:40
void heapifydown(int index)
Ensure the heap invariant (up -> bottom), used during removal of a node.
Definition: Network.cpp:96
friend bool operator<(const Node &aNode1, const Node &aNode2)
Overloading '<' operator.
Definition: Network.cpp:339
std::map< long, Link > _Links
Links of the network (see Link class)
Definition: Network.hpp:484
void setKey(float key)
Setting the key value (used by Dijkstra algorithm).
Definition: Network.hpp:137
const std::map< long, Link > & getLinks() const
Returns the network's links.
Definition: Network.hpp:510
void setMinX(float minX)
Set minimum x coordinate.
Definition: Network.hpp:629
long getId() const
Return the link's id.
Definition: Network.hpp:307
float getMinY() const
Return the minimum y coordinate.
Definition: Network.hpp:637
void setMinY(float minY)
Set minimum y coordinate.
Definition: Network.hpp:645
virtual ~Link()
Destructor.
Definition: Network.hpp:285
A node class.
Definition: Network.hpp:36
Node()
Default Constructor.
Definition: Network.hpp:55
friend bool operator>(const Node &aNode1, const Node &aNode2)
Overloading '>' operator.
Definition: Network.cpp:345
virtual ~DHeap()
Destructor.
Definition: Network.cpp:54
void setMaxX(float maxX)
Set maximum x coordinate.
Definition: Network.hpp:597
bool operator<(Node &aNode)
Overloading '<' operator.
Definition: Network.hpp:237
float getX() const
Return the x coordinate.
Definition: Network.hpp:145
float getY() const
Return the y coordinate.
Definition: Network.hpp:161
float getMaxY() const
Return the maximum y coordinate.
Definition: Network.hpp:605
int parent(int child)
Return the index of the parent of child node.
Definition: Network.cpp:58
int _index
given the value of key, correspond to the index of a node inside a D-Heap
Definition: Network.hpp:47
Random number generators and related tools.
void decreaseKey(int index, float key)
Decrease the key of a given Node and update the heap structure.
Definition: Network.cpp:124
void addIndicator(std::string aIndicator, long aIndicatorValue)
Add an indicator and its value to the set of node's indicator.
Definition: Network.cpp:333
int getIndex() const
Get the index value (used by Dijkstra algorithm).
Definition: Network.hpp:177
void addLink(Link aLink)
Add a link to the network.
Definition: Network.cpp:182
float getKey() const
Get the key value (used by Dijkstra algorithm).
Definition: Network.hpp:129
long _start_node_id
source node's id.
Definition: Network.hpp:266
long _id
id of the link.
Definition: Network.hpp:265
int _d
degree of the heap, i.e. maximum number of childxs
Definition: Network.hpp:371
float getLength() const
Get the length (in meters) of the link.
Definition: Network.hpp:323
const Node deletemin()
Return the node's id with maximum priority (i.e. the first of the heap) and removes it...
Definition: Network.cpp:159
float getDistanceNodes(long source_id, long dest_id)
Compute the distance between two nodes in the network.
Definition: Network.cpp:266
float getMaxX() const
Return the maximum x coordinate.
Definition: Network.hpp:589
A Network class.
Definition: Network.hpp:479
void setId(long id)
Set the link's id.
Definition: Network.hpp:315
void setIndicators(const std::map< std::string, long > &indicators)
Set the indicators of the node.
Definition: Network.hpp:201
std::vector< long > _links_out_id
set of outgoing links.
Definition: Network.hpp:45
void setNodes(const std::map< long, Node > &nodes)
Setting the network's nodes.
Definition: Network.hpp:534
void addNode(Node aNode)
Add a node to the network.
Definition: Network.cpp:175
A link class.
Definition: Network.hpp:261
float _x
x coordinate.
Definition: Network.hpp:41
Network()
Constructor.
Definition: Network.hpp:494
void addLinkOutId(long linkId)
Add an link to the set of outgoing links.
Definition: Network.hpp:121
float getMinX() const
Return the minimum x coordinate.
Definition: Network.hpp:621
long getStartNodeId() const
Return the source node's id.
Definition: Network.hpp:339
A n-ary tree data structure used by Dijkstra's shortest path algorithm.
Definition: Network.hpp:365
int child(int parent, int ith)
Return the index of i-th child of a node.
Definition: Network.cpp:69
long getEndNodeId() const
Return the sink node's id.
Definition: Network.hpp:291
virtual ~Network()
Destructor.
Definition: Network.hpp:504
void setIns(int ins)
Set the INS code of the node (corresponding to the municipality to which the node belongs)...
Definition: Network.hpp:97
Fibonacci heap data structure implementation.
void addLinkOutToNode(long nodeId, long linkId)
Add a link to the set of outgoing link of a node.
Definition: Network.hpp:543
void setLinks(const std::map< long, Link > &links)
Setting the network's links.
Definition: Network.hpp:518
long _end_node_id
sink node's id.
Definition: Network.hpp:267
std::vector< Node > heap
heap of Node.
Definition: Network.hpp:369
void setStartNodeId(long startNodeId)
Set the source node's id.
Definition: Network.hpp:347
std::map< long, Node > _Nodes
Nodes of the network (see Node class)
Definition: Network.hpp:483
const std::map< std::string, long > & getIndicators() const
Return the indicators of the node.
Definition: Network.hpp:193
void setLinksOutId(const std::vector< long > &linksOutId)
Setter for the set of outgoing links of the node.
Definition: Network.hpp:113
const std::vector< long > & getLinksOutId() const
Return the set of outgoing links of the node.
Definition: Network.hpp:105
int size()
Compute the size of the heap.
Definition: Network.hpp:468
virtual ~Node()
Destructor.
Definition: Network.hpp:67
DHeap()
Default constructor.
Definition: Network.cpp:17
void insert(Node &element)
Insert a node in the heap.
Definition: Network.cpp:132
float max_x
Maximum x coordinate.
Definition: Network.hpp:487
float min_y
Minimum y coordinate.
Definition: Network.hpp:488
Link()
Default constructor.
Definition: Network.hpp:273
std::map< long, int > getMapNodeidIndex() const
Return the map <node id, node index>.
Definition: Network.hpp:460
void setId(long id)
Set the id of the node.
Definition: Network.hpp:81
void heapifyup(int index)
Ensure the heap invariant (bottom -> up), used to add a node to the heap.
Definition: Network.cpp:79
float _length
length of the link (unit: meters).
Definition: Network.hpp:268
float _key
key value of a node, corresponding to the distance between the node and a source one ...
Definition: Network.hpp:46
float _y
y coordinate.
Definition: Network.hpp:42
long getDestFromSource(long source_id, float dist)
Compute the set of destination nodes at a given distance from a source node.
Definition: Network.cpp:189
int _ins
ins code of the node, corresponding to the municipality to which the node belongs.
Definition: Network.hpp:43
bool operator>(Node &aNode)
Overloading '>' operator.
Definition: Network.hpp:248
const std::map< long, Node > & getNodes() const
Return the network's nodes.
Definition: Network.hpp:526
void setX(float x)
Set the x coordinate.
Definition: Network.hpp:153
long getId() const
Return the id of the node.
Definition: Network.hpp:73
float min_x
Minimum x coordinate.
Definition: Network.hpp:486
int getIns() const
Return the INS code of the node (corresponding to the municipality to which the node belongs)...
Definition: Network.hpp:89
void pushBack(Node &element)
Insert a node at the end of the heap.
Definition: Network.cpp:146
std::map< std::string, long > _indicators
a map of indicators related to the municipality to which the node belongs.
Definition: Network.hpp:49
void setEndNodeId(long endNodeId)
Set the sink node's id.
Definition: Network.hpp:299
void setLength(float length)
Set the length of the link.
Definition: Network.hpp:331
std::map< long, int > _map_nodeid_index
map of the node's id and their respective index.
Definition: Network.hpp:370
void setY(float y)
Set the y coordinate.
Definition: Network.hpp:169
float max_y
Maximum y coordinate.
Definition: Network.hpp:489
void setIndex(int index)
Set the index value (used by Dijkstra algorithm).
Definition: Network.hpp:185