Research Article

A Novel Subchannel and Power Allocation Algorithm in V2V Communication

Algorithm 1

Subchannel allocation based on matching theory
Input: , Output: ,
Initialization:
While
  V2V link () constructs the preference sequence.
  Repeat
   V2V link selects the most preferred channel. The number of V2V links matching with this preferred channel is less than or equal to .
  Until V2V link matches with one subchannel or refused by all subchannels.
  Remove from
End while
  After initialization, the sequence corresponding to the number of V2V link matching with each subchannel , , and (), the initialized subchannel reusing matrix are obtained.
Swap operation:
  Repeat.
  , , and are available vacancies, IF is a swap blocking pair, then .
  Until there is no swap blocking pair.