Research Article

A Topology Visualization Early Warning Distribution Algorithm for Large-Scale Network Security Incidents

Algorithm 2

Input: sub graphs and their adjacent matrix;
Output: the position coordinate of each sub graph in the topology;
Begin
{ for each sub graph in
    Distribute coordinate ( ) for in the canvas randomly;
    Force( ) = 0;
  end for
    while there is sub graph to distribute
   begin
   Select a sub graph with the highest quality from the sub graph set waiting for distribution;
   for each edge ( ) connected with
   if is distributed
    Force( ) +=  Tension( );//calculate the tension
   end if
   end for
   for each vertex in
   if is distributed
    Force( ) += Repulsion( );//calculate the repulsion
   end if
   end for
   ForceMin = Force( );
  //reverse to find the balanced position
  for each position ( ) in the layout
  if the position is used
     Calculate the resultant force Force( ) of this position;
     if Force( ) ForceMin;
    ForceMin = Force( );
    ;   //record the balanced position
    ;
    end if
  end if
end for
end
}