I'm trying to code Ad Hoc On Demand Distance Vector (AODV) Routing Protocol in Matlab. I'll briefly describe how the protocol works:
This protocol can be used for mobile ad hoc networks. The source initiates a route to the destination whose IP is known. The source node broadcasts a Route Request (RREQ) to it's first hop. If any node within the first hop (TTL), knows the the destination, or a route to the destination, a Route Reply (RRP) is forwarded to the source. In case, any route is found broken, a Route Error (RERR) message is generated to the destination. The source selects the shortest (least hop ) path to the destination to deliver the packets. If, the source doesn't get any RREP within a specified time, the TTL is increased and new RREQ is sent. The wiki link is here for detail description: [AODV_Wiki][1]
EDIT The coding is entirely dependent on the connection of nodes with each other as was stated in the hint. I'm finalizing the code. I think, Ill upload shortly.
Hint: Distance Vectors algorithms work by maintaining a vector of distances in each network node. The distane vector measures the distance from the current node to every other node in te network. The algorithm works by iteratively updating this vector.
Combining all of these distance vectors into a matrix, you get a matrix where element i,j measures the distance between node i and j.
So I would start with computing the connectivity matrix a[i,j]=1 if i can directly communicate with j, 0 otherwise -- and proceed from there.
Related
Can someone please point me to the part in the documentation explaining the difference between nodes and indices? I'm going over code that was written by someone else and it seems to use nodes and indices interchangeably. Also, when I apply NodeToIndex or IndexToNode on a variable, the value does not change.
Please read: https://developers.google.com/optimization/routing
indices are internal object belonging to the solver, nodes are linked to the distance matrix and the user visits.
In the underlying constraint programming model of routing problems, each stop is exactly visited once. Each stop is a index. The routing library allows several vehicles to start and end at a stop. This causes a conflict because a stop may be visited by several vehicles. In ortools this conflict is resolved by creating dummy indices for nodes that are visited by several vehicles. Hence there may be several indicies that are map to the same node. The depot is a typical example.
This page about the auxillary graph helped me: https://acrogenesis.com/or-tools/documentation/user_manual/manual/tsp/model_behind_scenes.html#the-auxiliary-graph
I am using http://networkrepository.com/socfb-B-anon.php dataset for my analysis. I would like to do some analysis of how this present graph is formed from scratch. Is there any existing social network simulation framework for this kind of problem?
I am also open to use any other dataset if available. I would need the timestamp for every edge( nodes connected at).
The Barabási–Albert (BA) model describes a preferential attachment model for generating networks, or graphs. It iteratively builds a graph by adding new nodes and connecting them to previously added nodes. The new node is attached to some other nodes with a probability proportional to the degree of the old node with relation to the total number of edges in the graph.
This algorithm has been shown to produce graphs that are scale-free, which means the distribution of degrees follows a power law, which is a typical property of social networks.
This can be seen as a 'simulation' of a growing social network, where users are more likely to 'befriend' or 'follow' popular existing users. Of course it's not a complete simulation because it assumes a new user is done befriending or following other users right after they created an account, but it might be a good starting point for your exploration.
A timestamp for each edge or node creation can be generated by maintaining one during the creation process and increment it as you add more edges or nodes to the graph.
Hopefully this answer gives you enough terminology to further your research.
Problem: It appears to me that a fundamental property of a clustering method c() is whether we can combine the results c(A) and c(B) by some function f() of two clusterings in a way that we do not have to apply the full clustering c(A+B) again but instead do f(c(A),c(B)) and still end up with the same result:
c(A+B) == f(c(A),c(B))
I suppose that a necessary condition for some c() to have this property is that it is determistic, that is the order of its internal processing is irrelevant for the result. However, this might not be sufficient.
It would be really nice to have some reference where to look up which cluster methods support this and what a good f() looks like in the respective case.
Example: At the moment I am thinking about DBSCAN which should be deterministic if I allow border points to belong to multiple clusters at the same time (without connecting them):
One point is reachable from another point if it is in its eps-neighborhood
A core point is a point with at least minPts reachable
An edge goes from every core point to all points reachable from it
Every point with incoming edge from a core point is in the same cluster as the latter
If you miss the noise points then assume that each core node reaches itself (reflexivity) and afterwards we define noise points to be clusters of size one. Border points are non-core points. Afterwards if we want a partitioning, we can assign randomly the border points that are in multiple clusters to one of them. I do not consider this relevant for the method itself.
Supposedly the only clustering where this is efficiently possible is single linkage hierarchical clustering, because edges removed from A x A and B x B are not necessary for finding the MST of the joined set.
For DBSCAN precisely, you have the problem that the core point property can change when you add data. So c(A+B) likely has core points that were not core in either A not B. This can cause clusters to merge. f() supposedly needs to re-check all data points, i.e., rerun DBSCAN. While you can exploit that core points of the subset must be core of the entire set, you'll still need to find neighbors and missing core points.
I would like to know how does EAP-SIM and RADIUS work together.
Assume we have something like this:
[client-1]----+
|
[client-2]----+----[AP]----------[RADIUS Server]------------[HSS]
|
[client-3]----+
|- Diameter -|
EAP-SIM and RADIUS should work between the client and the radius server, right?
Is one above the other? (like IP & TCP)
What is the content of the message(s) sent during the negocation(s) for both EAP-SIM and radius? (let's assume client-1 wants to connect and need to authenticate. The HSS is the component used by the RADIUS to check the 'credentials')
The EAP SIM protocol operates between the client (supplicant) and the RADIUS server. The RADIUS server will use the IMSI or ephemeral IMSI it got during the start of the EAP-SIM conversation to send a separate request to the HSS requesting authentication vectors.
The HSS will return multiple sets of UMTS quintuplets or GSM triplets. The RADIUS server forwards the RAND component from a variable number of these vectors (2-3 in GSM) to the client, which feeds them to the SIM card to produce challenge responses.
The challenge responses and authentication vectors never go across the wire in plaintext, instead a PRF (Pseudo Random Function) is used to derive session keys. This derivation occurs on both the RADIUS server, and the client (supplicant).
If the SIM card does not produce the correct responses for the RAND challenge, then the session keys will not match and authentication will fail.
Note that if the HSS returns UMTS vectors, and EAP-SIM is being performed, there's a separate step to derive GSM vectors from the UMTS vectors.
Example code for the derivation is here: https://github.com/FreeRADIUS/freeradius-server/blob/v4.0.x/src/modules/rlm_eap/types/rlm_eap_sim/sim_vector.c#L157
It is possible to easily use the GPS functionality in the iPhone since sdk 3.0, but it is explicitly forbidden to use Google's Maps.
This has two implications, I think:
You will have to provide maps yourself
You will have to calculate the shortest routes yourself.
I know that calculating the shortest route has puzzled mathematicians for ages, but both Tom Tom and Google are doing a great job, so that issue seems to have been solved.
Searching on the 'net, not being a mathematician myself, I came across the Dijkstra Algorithm. Is there anyone of you who has successfully used this algorithm in a Maps-like app in the iPhone?
Would you be willing to share it with me/the community?
Would this be the right approach, or are the other options?
Thank you so much for your consideration.
I do not believe Dijkstra's algorithm would be useful for real-world mapping because, as Tom Leys said (I would comment on his post, but lack the rep to do so), it requires a single starting point. If the starting point changes, everything must be recalculated, and I would imagine this would be quite slow on a device like the iPhone for a significantly large data set.
Dijkstra's algorithm is for finding the shortest path to all nodes (from a single starting node). Game programmers use a directed search such as A*. Where Dijkstra processes the node that is closest to the starting position first, A* processes the one that is estimated to be nearest to the end position
The way this works is that you provide a cheap "estimate" function from any given position to the end point. A good example is how far a bird would fly to get there. A* adds this to the current distance from the start for each node and then chooses the node that seems to be on the shortest path.
The better your estimate, the shorter the time it will take to find a good path. If this time is still too long, you can do a path find on a simple map and then another on a more complex map to find the route between the places you found on the simple map.
Update
After much searching, I have found an article on A* for you to to read
Dijkstra's algorithm is O(m log n) for n nodes and m edges (for a single path) and is efficient enough to be used for network routing. This means that it's efficient enough to be used for a one-off computation.
Briefly, Dijkstra's algorithm works like:
Take the start node
Assign it a depth of zero
Insert it into a priority queue at its depth key
Repeat:
Pop the node with the lowest depth from the priority queue
Record the node that you came from so you can track the path back
Mark the node as having been visited
If this node is the destination:
Break
For each neighbour:
If the node has not previously been visited:
Calculate depth as depth of current node + distance to neighbour
Insert neighbour into the priority queue at the calculated depth.
Return the destination node and list of the nodes through which it was reached.
Contrary to popular belief, Dijkstra's algorithm is not necessarily an all-pairs shortest path calculator, although it can be adapted to do this.
You would have to get a graph of the streets and intersections with the distances between the intersections. If you had this data you could use Dijkstra's algorithm to compute a shortest route.
If you look at technology tomtom calls 'IQ routes', they measure actual speed and travel time per roadstretch per time of day. This makes the arrival time more accurate. So the expected arrival time is more fact-based http://www.tomtom.com/page/iq-routes
Calculating a route using the A* algorithm is plenty fast enough on an iPhone with offline map data. I have experience of doing this commercially. I use the A* algorithm as documented on Wikipedia, and I keep the road network in memory and re-use it; once it's loaded, routing even over a large area like Spain or the western half of Canada is practically instant.
I take data from OpenStreetMap or elswhere and convert it into a directed graph, assuming (which is the right way to do it according to those who know) that any two roads sharing a point with the same ID are joined. I assign weights to different types of roads based on expected speeds, and if a portion of a road is one-way I create only a single arc; two-way roads get two arcs, one in each direction. That's pretty much the whole thing apart from some ad-hoc code to prevent dangerous turns, and implementing routing restrictions.
This was discussed earlier here: What algorithms compute directions from point a to point b on a map?
Have a look at CloudMade. They offer a free service for iPhone and iPad that allows navigation based on your current location. It is built on open street maps and has some nifty features like making your own mapstyle. It is a little slow from time to time but its totally free.