The high adjacent degree resource search method of wireless sensor network
Technical field
The invention belongs to networking technology area, be specifically related to the high adjacent degree resource search method of a kind of wireless sensor network.
Background technology
Wireless sensor network (WSNs) comprises a large amount of network node (network node can be the equipment with wireless communication module: as be used for environment monitoring sensor, car-mounted computer, mobile phone, PDA etc.), and the resource distribution in the wireless sensor network is stored on each node.Application based on wireless sensor network often needs and can respond the resource searching request.Propose the resource searching request at any node in the wireless sensor network, each node of network needs and can the resource searching request be communicated to the node that has searched resource according to certain message transmission policy.For solving the problem of transmission of resource searching request between individual network node, need a kind of good resource searching transmission policy, make it possible to internodal message transmission at the least possible number of times, the resource searching request is delivered on as much as possible the node that has searched resource, thereby returns resource matched successful response as much as possible for the node that proposes the resource searching request.At present simple and direct resource searching request is the method broadcast resource searching request that the resource searching request proposes node neighbor node use towards periphery inundation, the broadcasting method of this inundation can be so that all contain the node that is requested resource in the fastest speed fixer network, but the size of message maximum that consumes.Another kind of route unicast method at random is to select a node to carry out the transmission of message at random from neighbor node at every turn, knows on the node that is requested resource address up to the resource searching request is delivered to one.This method can reduce the message transmission significantly with respect to the inundation method, but it is less successfully to locate the probability that is requested resource.
Summary of the invention
The present invention has overcome the deficiencies in the prior art, has proposed the high adjacent degree resource search method of a kind of wireless sensor network, and this method has designed a kind of clean culture strategy, has realized the resource searching strategy.
Technical scheme of the present invention is: the high adjacent degree resource search method of wireless sensor network, the network node that described searching method comprises for wireless sensor network is provided with adjacency list and database, described adjacency list comprises node ID and node adjacency degree, described node adjacency degree be the minute book node current can with the adjacent node number of own direct communication, the resource searching step of described searching method is:
1) node (source node) that resource searching is inquired about is proposed
At first whether query node its data storehouse stores by query resource, returns resource address if having then to proposing the resource searching requesting users; Whether the adjacency list of source node inspection oneself is empty then, if be not empty, then the set with node identification (ID) of oneself and all node ID compositions in the adjacency list is designated as T
Id, will gather T
IdAdd resource searching message; Last source node selects to have the node of largest contiguous degree and maximum ID number (establish not have for ID number and repeat) from its adjacency list, send a resource searching message to it, and described resource searching message comprises set T
Id
2) suppose that node Y sends resource searching message from nodes X, whether node Y at first inquires about its data storehouse and stores by query resource, returns resource address if having then to proposing the resource searching requesting users;
3) node Y is with the T of the last hop node (X) that comprises in the resource searching message of receiving
IdValue is X.T
Id, node Y creates the next-hop node collection T of oneself
Next=T
Id-X.T
Id);
4) node Y checks the next-hop node collection T of oneself
NextEmpty set whether, if, then abandon this resource searching message, stop the resource searching process; Otherwise node Y is with the T of oneself
IdAdd resource searching message, node Y is according to the adjacency list of oneself, from T
NextIn select to have the node of largest contiguous degree and maximum ID number, comprise set Y.T to its transmission
IdResource searching message;
5) all processes of receiving that the node of resource searching message all begins according to the 2nd step are carried out corresponding actions.
Described node adjacency table can initialization, the steps include:
1) each node sends " Hello " message to neighbor node;
2) node of receiving " Hello " message increases 1 with self adjacent degree;
3) after each node obtains the adjacent degree value, send " degree-info " message, inform the adjacent degree value that neighbours oneself are current to its neighbor node;
4) after node is received " degree-info " message, node ID and the corresponding adjacent degree that is comprised in the message of receiving added in the adjacency list of oneself.
Described node adjacency table is provided with two processing methods:
1) processing of new node adding
At first, newly added node (establish it and be x) sends " Hello " message to neighbor node;
Secondly, the node (establish it and be y) of receiving " Hello " message increases 1 with self adjacent degree, then, sends " degree-info " message (ID and the corresponding adjacent degree record that comprise node y) to its neighbor node;
At last, receive that the node of " degree-info " message searches adjacency list according to the node ID in the message (y), if not having node ID in the adjacency list is that the record of y then adds the record that node ID is y according to " degree-info " message content, be that the record of y then upgrades corresponding adjacent degree value according to " degree-info " message content if there is node ID.
2) old node withdraws from processing
At first, old node sends " Quit " message to neighbor node;
Secondly, the node of receiving " Quit " message subtracts 1 with self adjacent degree, simultaneously the respective entries of own adjacency list is deleted.
The present invention has following beneficial effect:
1) the present invention can begin by any node in wireless sensor network WSNs, and the message transmission with the least possible searches resource as much as possible.
2) the present invention is with the least possible internodal message transmission, and the searching request that the resource searching node is proposed is delivered on the maximum node of neighbours' number.
3) deep search algorithm: use the least possible message transmission, the resource searching request is delivered to apart from the resource searching node node far away as far as possible.
Description of drawings
Fig. 1 represents the schematic diagram of the first resource searching route that the present invention carries out according to the method for the invention from source node.
Among the figure, the 1. general node in the network; 2. expression searching route.
Embodiment
Further specify below in conjunction with embodiment.
Referring to shown in Figure 1, the present invention comprises general node 1 in the network and the searching route 2 of this algorithm.Each node must be safeguarded following variable before carrying out resource searching:
Adjacent degree: the minute book node current can with the neighbor node number of own direct communication, initial value is " 0 "
Adjacency list: the adjacency list pattern is<neighbor node ID adjacent degree 〉, be used for current all the neighbor node ID of minute book node and the value of corresponding adjacent degree, initial value is an empty set
This method is made up of following three kinds of operations:
One, adjacency list initialization operation
1, each node sends " Hello " message to neighbor node;
2, the node of receiving " Hello " message increases 1 with self adjacent degree.
3, after each node obtains the adjacent degree value, send " degree-info " message, inform the adjacent degree value that neighbours oneself are current to its neighbor node;
4, after node is received " degree-info " message, node ID and the corresponding adjacent degree that is comprised in the message of receiving added in the adjacency list of oneself.
Two, adjacency list maintenance process
1, new node adds processing
1) newly added node (establish it and be x) sends " Hello " message to neighbor node;
2) node (establish its for y) of receiving " Hello " message increases 1 with self adjacent degree, then, sends " degree-info " message (ID and the corresponding adjacent degree record that comprise node y) to its neighbor node;
3) receive that the node of " degree-info " message searches adjacency list according to the node ID in the message (y), if not having node ID in the adjacency list is that the record of y then adds the record that node ID is y according to " degree-info " message content, be that the record of y then upgrades corresponding adjacent degree value according to " degree-info " message content if there is node ID.
2, old node withdraws from processing
1) old node sends " Quit " message to neighbor node;
2) node of receiving " Quit " message subtracts 1 with self adjacent degree, simultaneously with oneself the respective entries deletion of adjacency list.
Three, distributed resource search procedure
1) whether the node (source node) that proposes the resource searching inquiry is at first inquired about its data storehouse and is stored by query resource, returns resource address if having then to proposing the resource searching requesting users; Whether the adjacency list of source node inspection oneself is empty then, if be not empty, then the set with ID of oneself and all node ID compositions in the adjacency list is designated as T
Id, will gather T
IdAdd resource searching message; Last source node selects to have the node of largest contiguous degree and maximum ID number (establish not have for ID number and repeat) from its adjacency list, send resource searching message to it and (comprise set T
Id);
2) suppose the resource searching message that node Y sends from nodes X, whether node Y at first inquires about its data storehouse and stores by query resource, returns resource address if having then to proposing the resource searching requesting users;
3) node Y is designated as T with the set of ID of oneself and all node ID compositions in the adjacency list
Id, node Y is with the T of the last hop node (X) that comprises in the resource searching message of receiving
IdValue is X.T
Id, node Y creates the next-hop node collection T of oneself
Next(=T
Id-X.T
Id);
4) node Y checks the next-hop node collection T of oneself
NextEmpty set whether, if, then abandon this resource searching message, stop the resource searching process; Otherwise node Y is with the T of oneself
IdAdd resource searching message, node Y is according to the adjacency list of oneself, from T
NextIn select to have the node of largest contiguous degree and maximum ID number, send resource searching message to it and (note: comprise set Y.T in this message
Id);
5) from now on, all processes of receiving that the node of resource searching message all begins according to the 2nd step are carried out corresponding actions.
Searching method of the present invention is delivered on the maximum node of neighbours' number with the least possible internodal message transmission, the searching request that the resource searching node is proposed; Use the least possible message transmission, the resource searching request is delivered to apart from the resource searching node node far away as far as possible.