% Copyright 2011 by Jannis Pohlmann
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.

\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.force.code.tex,v 1.7 2012/11/20 23:34:18 tantau Exp $



\usepgflibrary{graphdrawing}

\usegdlibrary{force}

\endinput



%
% Definition of spring algorithms as well as options to configure them.
%

\pgfgdset{
  force based/.cd,
  %
  iterations/.graph parameter=number,
  iterations/.parameter initial=500,
  %
  cooling factor/.graph parameter=number,
  cooling factor/.parameter initial=0.95,
  %
  initial step dimension/.graph parameter=number,
  initial step dimension/.parameter initial=0,
  % 
  convergence tolerance/.graph parameter=number,
  convergence tolerance/.parameter initial=0.01,
  %
  spring constant/.graph parameter=number,
  spring constant/.parameter initial=0.01,
  % 
  approximate electric forces/.graph parameter=boolean,
  approximate electric forces/.parameter initial=false,
  approximate electric forces/.default=true,
  % 
  electric force order/.graph parameter=number,
  electric force order/.parameter initial=1,
  %
  % Parameters related to the multilevel approach where the input graph
  % is iteratively coarsened into graphs with fewer nodes, until either
  % the number of nodes is small enough or the number of nodes in the 
  % could not be reduced by at least a user-defined ratio.
  %
  coarsen/.graph parameter=boolean,
  coarsen/.parameter initial=true,
  coarsen/.default=true,
  %
  coarsening/.code=\pgfkeys{
    /graph drawing/force based/coarsening/.cd,
    #1
  },
  %
  coarsening/downsize ratio/.graph parameter=number,
  coarsening/downsize ratio/.parameter initial=0.25,
  %
  coarsening/minimum graph size/.graph parameter=number,
  coarsening/minimum graph size/.parameter initial=2,
  %
  coarsening/collapse independent edges/.graph parameter=boolean,
  coarsening/collapse independent edges/.parameter initial=true,
  coarsening/collapse independent edges/.default=true,
  %
  coarsening/connect independent nodes/.graph parameter=boolean,
  coarsening/connect independent nodes/.parameter initial=false,
  coarsening/connect independent nodes/.default=true,
  %
  % Node parameters for spring algorithms.
  %
  %
  % Edge parameters for spring algorithms.
  %
}

\pgfgddeclareforwardedkeys{/graph drawing}{
  %
  electric charge/.node parameter=number,
  electric charge/.parameter initial=1,
}


%
% Spring algorithm based on the paper
%
%   "Efficient, High-Quality Force-Directed Graph Drawing"
%   Yifan Hu, 2006
%
\pgfgddeclarealgorithmkey
  {spring layout}
  {force based}
  {
    algorithm=pgf.gd.force.SpringHu2006
  }

 
%
% Spring-electrical algorithm based on the paper
% 
%   "Efficient, High-Quality Force-Directed Graph Drawing"
%   Yifan Hu, 2006
%
\pgfgddeclarealgorithmkey
  {spring electrical layout}
  {force based}
  {
    algorithm=pgf.gd.force.SpringElectricalHu2006,
    force based/spring constant=0.2,
  }



%
% Spring-electrical algorithm based on the paper
%
%   "A Multilevel Algorithm for Force-Directed Graph Drawing"
%   C. Walshaw, 2000
%
\pgfgddeclarealgorithmkey
  {spring electrical layout'}
  {force based}
  {
    algorithm=pgf.gd.force.SpringElectricalWalshaw2000,
    force based/spring constant=0.01,
    force based/convergence tolerance=0.001,
  }
