\section{Introduction}
A central problem in geometry in computer vision is \emph{Structure from Motion} (SfM), which is the problem of reconstructing a 3-D scene from sparse feature points tracked in the images of a moving camera. This problem is known also in the robotics community as \emph{Simultaneous Localization and Mapping} (SLAM). One of the main differences between the two communities is that in SLAM it is customary to assume the presence of an \emph{Inertial Measurement Unit} (IMU) that provides measurements of angular velocity and linear acceleration in the camera's frame. Conversely, in SfM there is a line of work which uses an \emph{affine} camera model, which is an approximation to the projective model when the depth of the scene is relatively small with respect to the distance between camera and scene. The resulting \emph{Affine SfM} problem affords a very elegant closed-form solution based on matrix factorization and other linear algebra operations \cite{Tomasi:IJCV92}. This solution has not been used in the robotics community, possibly due to the fact that it cannot be immediately extended to use IMU measurements.

We assume that the relative pose between IMU and camera has been calibrated using one of the existing offline \cite{Lobo:IJRR07}, online \cite{Jones:IJRR11,Jones:WDV07,Lynen:IROS13,Weiss:ICRA12,Kelly:IJRR11} or closed form \cite{DongSi:IROS12,Martinelli:FTROB13,Martinelli:TRO12} approaches.

\paragraph*{Paper contributions} In this paper we bridge the gap between the two communities by proposing a new \emph{Dynamic Affine SfM} technique. Our technique is a direct extension of the traditional Affine SfM algorithm, but incorporates synchronized IMU measurements. This is achieved by assuming that the frame rate of the camera is high enough and that we can compute the higher order derivatives of the point trajectories. Remarkably, our formulation leads again to a closed form solution based on matrix factorization and linear algebra operations. To the best of our knowledge, this kind of relation between higher-order derivatives of image trajectories (flow) and IMU measurements, and the low-rank factorization relation between them, have never been exploited before.

\input{priorWork}
\input{notation}
\input{solution}

\section{Preliminary results} Figure \ref{fig:result-affine} shows a simulation of the result of a preliminary implementation of the Dynamic Affine SfM procedure. We have simulated 5 seconds of a quadrotor following a smooth trajectory while an onboard camera tracks 24 points. The measurements (point coordinates, angular velocity and linear acceleration) are sampled at $30\mathrm{Hz}$ and corrupted with Gaussian noise with variances of the added noise: $\unitfrac[3]{deg}{s}$ angular velocity, $\unitfrac[0.2]{m}{s^2}$ acceleration, $\unit[0.5]{\%}$ image points (corresponding to, for instance, $\unit[3.2]{px}$ on a $\unit[600\times600]{px}$ image). The reconstruction obtained using our implementation is aligned to the ground-truth using a Procrustes procedure without scaling and compared with an integration of the inertial measurements alone. Figure \ref{fig:result-affine-trajectory} compares the plot of the ground truth and estimated rotations and translations in absolute coordinates.
Three facts should be noted in this simulation:
\begin{enumerate*}
\item The use of images greatly improves the accuracy with respect to the use of IMU measurements alone.
\item The noise in the estimation mostly appears along the $z$-axis direction of the camera, for which the images do not provide any information.  Although ours is a preliminary implementation, the result obtained is extremely close to the ground-truth, except for small errors along the $z$ axis of the camera. These errors are due to the fact that the affine model discards the information along the $z$ axis (the affine model provide little information in this direction, and the reconstruction mostly relies on the noisy accelerometer measurements).
\item Larger noise appears at lower velocities (beginning and end of the trajectory), thus attesting the usefulness of incorporating higher-order derivative information.
\end{enumerate*}
\begin{figure*}
  \centering

  \hfill\subfloat[Top view]{\includegraphics{figures/dynamicSfM_reconstruction_top}}\hfill
  \subfloat[Front view]{\includegraphics{figures/dynamicSfM_reconstruction_front}}\hfill
\vspace{-1mm}
  \caption{Simulation results for a preliminary implementation of the Dynamic Affine SfM reconstruction under significantly noisy conditions. Red: ground-truth structure and motion. Blue: reconstructed structure and motion. Black line: motion estimate from integration of IMU measurements alone. Green pyramid: initial reconstructed camera pose. The camera rotates up to $\unit[30]{deg}$ and reaches velocities of up to $\unitfrac[0.5]{m}{s}$. All axes are in meters.
}
  \label{fig:result-affine}
\end{figure*}

\begin{figure*}
  \centering
  \includegraphics{figures/dynamicSfM_trajectory}
  \caption{Plots of the ground-truth and estimated trajectories. Left: Absolute rotations in exponential coordinates from the identity, $\log(R_f)$. Right: absolute translations.}
  \label{fig:result-affine-trajectory}
\end{figure*}
\section{Extensions and future work}
The approach can be easily extended to the case where multiple (non-overlapping) cameras rigidly mounted to the same IMU. In this case, one can constract multiple matrices $W$ (one for each camera), and performs steps \ref{it:factorization}--\ref{it:centering} of our solution independently. The rotations and translations (steps \ref{it:rotations},~\ref{it:translations}) can then be recovered by solving the linear systems \eqref{eq:opt-rotation} and \eqref{eq:opt-translation} joinly over all the cameras by adjusting the corresponding coefficient matrices with the relative camera-IMU poses (which are assumed to be known).
The Dynamic Affine SfM approach can also be potentially extended to the projective camera model by using the approach of \cite{Dai:IJCV13}. Let $\Lambda\in\real{F\times P}$ be a matrix containing all the unknown depths of each point in each view, and let $L=\Lambda\otimes\bmat{1\\1}$. Then, one can find a low-rank matrix $\hat{W}$ by minimizing
\begin{multline}
    \min_{\hat{W},\Lambda,\dot{\Lambda},\ddot{\Lambda}} \norm{\bmat{L\odot W'\\\dot{L}\odot W' + L \odot \dot{W}'\\\ddot{L}\odot W' +2\dot{L}\odot \dot{W}' + L \odot \ddot{W}'}-\hat{W}}^2_F \\+ \mu \norm{\hat{W}}_\ast+f_\Lambda(\Lambda,\dot{\Lambda},\ddot{\Lambda}),\label{eq:opt-projective}
\end{multline}
where $\norm{\cdot}_\ast$ denotes the nuclear norm (which acts as a low-rank prior for $\hat{W}$), $\mu$ is a scalar weight and $f_\Lambda$ relates $\Lambda$ with its derivatives using a derivative interpolation filter. This problem is convex and can be iteratively solved using block coordinate descent (i.e., by minimizing over $\hat{W}$ and the other variables alternatively). The method described in Section~\ref{sc:solution} can then be carried out on the matrix $\hat{W}$ to obtain the reconstruction. Intuitively, \eqref{eq:opt-projective} estimates the projective depths of each point so that we can reduce the problem to the affine case.

We will implement and evaluate these two extensions in our future work.

\bibliographystyle{biblio/ieee}

\section{Notation and preliminaries}
In this section we establish the notation for the following sections. In particular, we define quantities related to a robot (e.g., a quadrotor) equipped with a camera and an inertial measurement unit. We consider its motion as a rigid body, and the relation of this with the IMU measurements and with the geometry of the scene.

\paragraph{Reference frames, transformations and velocities} We first define an inertial spatial frame $\cR_s$, which corresponds to a fixed ``world'' reference frame, and a camera reference frame $\cR_f$, which corresponds to body-fixed reference frame of the robot. For simplicity, we assume that the reference frame of the camera and of the IMU coincide with $\cR_f$, and that they are both centered at the center of mass of the robot.
We denote the world-centered frame as $\cR_s$, and as $\cR_f$ the robot-centered frame at some time instant (or ``frame'') $f\in\{1,\ldots,F\}$. We also define the pair $(R_f,T_f)\in SE(3)$, where $R_f$ is a 3-D rotation belonging to the space of rotations $SO(3)$, and $T_f\in\real{3}$ is a 3-D translation and $SE(3)$ is the group of rigid body motions \cite{Murray:book94}.
More concretely, given a point with 3-D coordinates $X_f\in\real{3}$ in the camera frame, the same point in the spatial frame will have coordinates $X_s\in\real{3}$ given by:
\begin{equation}
\label{eq:transformationbs}
  X_s=R_{f}X_c+T_{f}.
\end{equation}
Note that this equation implies that the $T_{f}$ is equal to the position of the center of mass of the vehicle in $\cR_s$. Hence, $\dot{T}_{f}$ and $\ddot{T}_{f}$ represent its velocity and acceleration in the same reference frame.

We also define the angular velocity $\omega_f\in\real{3}$ with respect to $\cR_f$ such that
\begin{equation}
  \dot{R}_f=R_f\hat{\omega}_f,\label{eq:omegab}
\end{equation}

With this notation, Euler's equation of motion for the vehicle can be written as \cite{Murray:book94}:
\begin{equation}
  J\dot{\omega}_f+\hat{\omega}_fJ\omega_f=\Gamma_f, \label{eq:Jdomegac}
\end{equation}
where $J$ is the moment of inertia matrix and $\Gamma_f$ is the torque applied to the body, both defined with respect to the local reference frame $\cR_f$.

\paragraph{Body-fixed quantities}
We denote the translation, linear velocity, linear acceleration, rotation and angular velocity of the robot expressed in the reference $\cR_f$ as $\tau_f$, $\nu_f$, $\alpha_f$, $R_f$ and $\omega_f$, respectively. Since these are vectors, they are related to the corresponding quantities in the inertial frame $\cR_s$ by the rotation $R_f^\mathrm{T}$:
\begin{align}
  \tau_f&=R_f^\mathrm{T} T_f,  \label{eq:taub} \\
  \nu_f&=R_f^\mathrm{T}\dot{T}_f, \label{eq:nub}\\
  \alpha_f&=R_f^\mathrm{T}\ddot{T}_f. \label{eq:taub-nub-alphab}
\end{align}

An ideal body-fixed ideal IMU unit will measure the angular velocity
\begin{equation}
  \omega_{IMU}=\omega_f,
\end{equation}
and the acceleration
A body-fixed, ideal accelerometer positioned at the center of mass of the object will measure
\begin{equation}
  \alpha_{IMU}=R_{f}^\mathrm{T}(\ddot{T}_{f}+g_s)=\alpha_f+R_{f}^\mathrm{T} g_s,\label{eq:alphaimu}
\end{equation}
where $g_s$ is the (downward pointing) gravity vector in the spatial frame $\cR_s$, around $-9.8e_z \mathrm{m}/\mathrm{s}^2$, where and $e_z=[0\; 0\; 1]^\mathrm{T}$.

\paragraph{Tridimensional structure}
We assume that the onboard camera can track the position of $P$ points having coordinates $X_{sp}\in\real{3}$, $p\in\{1,\ldots,P\}$ in $\cR_s$. For convenience, we assume that $\cR_s$ is centered at the centroid of this points, that is, $\frac{1}{P}\sum_{p=1}^PX_{sp}=0$.

Given the quantities above, we can find expressions for the coordinates of a point in the camera's coordinate system and its derivatives. However, it is first convenient to find the derivatives of $\tau_c$, $\nu_c$ and $\omega_c$, which can be obtained by combining \eqref{eq:taub} and \eqref{eq:nub} with the definition \eqref{eq:omegab}, and from Euler's equation of motion \eqref{eq:Jdomegac}.
\begin{align}
  \dot{\tau}_f&=-\hat{\omega}_f\tau_f+\nu_f, \label{eq:dtaub}\\
  \dot{\nu}_f&=-\hat{\omega}_f\nu_f+\alpha_f, \label{eq:dnub}\\
  \dot{\omega}_f&=J^{-1}\bigl(\Gamma_f-\hat{\omega}_fJ\omega_f\bigr).\label{eq:domegab}
\end{align}

Then, the coordinate of a point $X_{sp}$ in the reference $\cR_f$ and its derivatives are given by \cite{Murray:book94}:
\begin{align}
  X_{cfp}=&R_f^\mathrm{T} X_{sp}-\tau_f, \qquad \label{eq:Xc}\\
  \dot{X}_{cfp}=&-\hat{\omega}_f R_f^\mathrm{T} X_{sp}+\hat{\omega}_f\tau_f-\nu_f, \label{eq:dXc}\\
  \ddot{X}_{cfp}=&\bigl(\hat{\omega}_f^2-\dot{\hat{\omega}}_f) R_f^\mathrm{T} X_{sp} - \bigl(\hat{\omega}_f^2-\dot{\hat{\omega}}_f) \tau_f\nonumber\\&+2\hat{\omega}_f\nu_f-\alpha^{IMU}_f-R_f^\mathrm{T} g_s, \label{eq:Xc-dXc-ddXc}
\end{align}
where $\hat{\cdot}$ denotes the skew-symmetric matrix representation of the cross product \cite{Ma:book04}, and where $\dot{\omega}_f$ can be obtained either using Euler's equation of motion as in \eqref{eq:domegab}, by assuming $\dot{\omega}_f=0$ (constant velocity model) or by using numerical differentiation of $\omega_f$.

Note that $X_{cfp}$ and its derivatives these quantities can be completely determined by the 3-D geometry of the scene in the inertial reference frame, the motion of the camera ($R_{sc}$, $\tau_c$, $\nu_c$) and the measurements of the IMU ($\alpha_{IMU}$, $\omega_{IMU}$); these all contain some coefficient matrix times the term $R_f^\mathrm{T} X_{sp}$ plus a vector given by the IMU measurements, the translational motion of the robot and the gravity vector. This structure will lead to the low-rank factorization formulation below.

\paragraph{Image projections}
The coordinates in the image of the projection of $X_{sp}$ at frame $f$ is denoted as $x_{fp}$. Assuming that the camera is intrinsically calibrated \cite{Ma:book04}, the image $x_{fp}$ can be related to $X_{cfp}$ with the \emph{affine camera model}, that is:
\begin{equation}
  x_{fp}=\Pi X_{cfp}. \label{eq:affine-model}
\end{equation}
where $\Pi\in\real{2 \times 3}$ is a projector that removes the third element of a vector.
This model is an approximation of the projective model for when the scene is relatively far from the camera. This model has been used for \emph{Affine SfM} \cite{Tomasi:IJCV92} and \emph{Affine Motion Segmentation} (see the review article \cite{Vidal:SPM11} and references within), and it will allow us to introduce the basic principles of our proposed methods.

Using \eqref{eq:affine-model}, one can show that the images $\{x_{fp}\}$ and their derivatives $\{\dot{x}_{fp}\}$ (\emph{flow}) and $\{\ddot{x}_{fp}\}$ (\emph{double flow}) can be written as:
\begin{align}
  x_{fp}=&\Pi R_f^\mathrm{T} X_{sp}-\tau_f, \qquad \label{eq:Xc}\\
  \dot{x}_{fp}=&-\Pi\hat{\omega}_f R_f^\mathrm{T} X_{sp}+\Pi(\hat{\omega}_f\tau_f-\nu_f), \label{eq:dXc}\\
  \ddot{x}_{fp}=&\Pi\bigl(\hat{\omega}_f^2-\dot{\hat{\omega}}_f\bigr) R_f^\mathrm{T} X_{sp} - \Pi\bigl((\hat{\omega}_f^2-\dot{\hat{\omega}}_f) \tau_f\\&+2\hat{\omega}_f\nu_f-\alpha^{IMU}_f-R_f^\mathrm{T} g_s\bigr). \label{eq:ddXc}
\end{align}

\paragraph{Formal problem statement}
 In this section we give the technical details for the proposed Dynamic SfM estimation methods for single agents. The setup and notation used in this section are shown in. We assume that the camera on the robot can track $P$ points for $F$ frames. We assume that the derivatives of the tracked points are available (e.g., through numerical differentiation).

Using the notation introduced in this section, the Dynamic Affine SfM problem is then formulated as finding the motion $\{R_f,\tau_f,\nu_f\}$, the structure $\{X_{sp}\}$ and the gravity vector $g_s$ from the camera measurements $\{x_{fp}\},\{\dot{x}_{fp}\},\{\ddot{x}_{fp}\}$ and the IMU measurements $\{\omega_f,\alpha^{IMU}_f\}$. Figure~\ref{fig:notation} contains a graphical summary of the problem and of the notation.

\section{$\mathrm{#1}$}%
\tikzsetnextfilename{#1}%
  \begin{tikzpicture}[scale=0.7]%
    \input{sketch/#1}%
  \end{tikzpicture}%
\endpgfgraphicnamed%
}

\newcommand{\inserttikzframe}[1]{\section{$\mathrm{#1}$}%
\tikzsetnextfilename{#1}%
\input{tikz/#1}%
\endpgfgraphicnamed%
}

\section*{#1}}

\renewcommand{\refname}{References Cited}

\makeatletter
\renewcommand{\maketitle}{\begin{center}\Large\textbf\@title
  \end{center}

\setbox0=\hbox{\@author\unskip}\ifdim\wd0=0pt
\else
\begin{center}
  \@author
\end{center}
\fi%
}
\makeatother

\section{Review of prior work}
In the vision community, the Dynamic SfM problem is related to traditional \emph{Structure from Motion} (SfM), which uses only vision measurements. The standard solution pipeline \cite{Hartley:book04} includes three steps. First, estimate relative poses between pairs of images by using matched features \cite{Lowe:IJCV04,Dong:CVPR15,Bay:CVIU08} and robust fitting techniques \cite{Fischler:CommACM81,Hartley:pami12}.
Second, combine the pairwise estimates either in sequential stages \cite{Snavely:TOG06,Agarwal:COMM11,Agarwal:ECCV10,Frahm:ECCV10,Snavely:CVPR08}, or by using a pose-graph approach \cite{Carlone:ICRA15} (which works only with the poses and not the 3-D structure). Algorithms under the latter category can be divided into \emph{local} methods \cite{Tron:TAC14,Hartley:IJCV13,Aftab:PAMI15,Chatterjee:ICCV13}, which use gradient-based optimization, and \emph{global} methods \cite{Martinec:CVPR07,Arie-Nachimson:3DIMPVT12,Wang:II13}, which involve a relaxation of the constraints on the rotations together with a low-rank approximation.
The fourth and last step of the pipeline is to use
Bundle Adjustment (BA) \cite{Triggs:VATP00,Hartley:book04,Engels:PCV06}, where the motion and structure are jointly estimated by minimizing the reprojection error.

In the robotics community, Dynamic SFM is closely related to other Vision-aided Inertial Navigation (VIN) problems. These include: \emph{Visual-Inertial Odometry} (VIO), where only the robots' motion is of interest, and \emph{Simultaneous Localization and Mapping} (SLAM), where the reconstruction (i.e., map) of the environment is also of interest.
Existing approaches to these problems fall between two extremes. On one end of the spectrum we have \emph{batch} approaches, which are similar to BA with additional terms taking into account the IMU measurements \cite{Bryson:ICRA09,Strelow:IJRR04}.
If obtaining a map of the environment is not important, the optimization problem can be restricted to the poses alone (as in the pose-graph approach in SfM), using the images and IMU measurements to build a so-called \emph{factor graph} \cite{Indelman:NDRV15,Dellaert:08,Agrawal:IROS06}. To speed-up the computations, some of the nodes can be merged using IMU \emph{pre-integration} \cite{Lupton:TRO12,Carlone:ICRA15}, and \emph{key-frames} \cite{Konolige:TRO08}.

\begin{figure*}
  \centering

  \includegraphics{figures/notation}
  \caption{Schematic illustration of the problem and notation.}
  \label{fig:notation}
\end{figure*}

On the other end of the spectrum we have pure \emph{filtering} approaches.
While some approaches are based on the Unscented Kalman Filter (UKF) \cite{Huster:OCEANS02,Ebcin:GNSS01,Kelly:IJRR11} or Particle filter \cite{Fox:JAIR99,Pupilli:BMVC05}, the majority are based on the Extended Kalman Filter (EKF).
The inertial measurements can be used in either a \emph{loosely coupled} manner, i.e., in the update step of the filter \cite{Konolige:RR11,Oskiper:CVPR07,Chai:PTVE02,Jones:IJRR11},
or in a \emph{tightly coupled} manner, i.e., in the prediction step of the filter together with a kinematic model \cite{Jung:CVPR01,Ma:ICRA12,Tardif:IROS10,Brockers:SPIE12,Kottas:RSS13,Strelow:IJRR04,Kim:ICRA03,Kleinert:MFI10,Pinies:ICRA07}.
Methods based on the EKF can be combined with an inverse depth parametrization \cite{Kleinert:MFI10,Pinies:ICRA07,Civera:RSS06,Eade:CVPR06} to reduce linearization errors

Between batch and filtering approaches there are three options. The first is to use incremental solutions to the batch problem \cite{Kaess:IJRR11}.
The second option is to use a \emph{Sliding Window Filter} (SWF) approach, which applies a batch algorithm on a small set of recent measurements.
The states that are removed from the window are compressed into a prior term using linearization and marginalization
\cite{Mei:IJCV11,Sibley:JFR10,Leutenegger:IJRR15,DongSi:ICRA11,Huang:IROS11}, possibly approximating the sparsity of the original problem \cite{Nerurkar:ICRA14}.
The third option is to use a \emph{Multistate-Constrained Kalman Filter} (MSCKF), which is similar to a sliding window filter, but where the old states are \emph{stochastic clones} \cite{Roumeliotis:ICRA02} that remain constant and are not updated with the measurements.
Comparisons of the two approaches \cite{Leutenegger:IJRR15,Clement:CRV15} show that the SWF is more accurate and robust, but the MSCKF is more efficient.
A hybrid method that switches between the two has appeared in \cite{Li:IROS12}, \cite{Li:RSS13}.

\section{Dynamic Affine SfM}
 \label{sc:solution}
\paragraph{Factorization formulation}
We start our treatment by collecting all the image measurements and their derivatives in a single matrix
\begin{equation}
  W=\stack(W',\dot{W}',\ddot{W}') \in\real{6F\times P},
\end{equation}
where the matrix $W'\in\real{3F\times P}$ is defined by stacking the coordinates $\{x_{fp}\}$ following the frame index $f$ across the rows and the point index $p$ across the columns:
\begin{equation}
  W'=\bmat{x_{11} & \cdots & x_{1P}\\ \vdots  & \ddots & \vdots \\  x_{N1} & \cdots & x_{NP}} \in\real{2F\times P}.
\end{equation}

Notice the common structure in where we have some coefficient matrix times $R_f^\mathrm{T}$ times $X_{sp}$ plus a vector. Thus, the matrix $W$ admits an affine rank-three decomposition (which can also be written as a rank four decomposition)
\begin{equation}
W=CMS+m=\bmat{CM & m}\bmat{S\\\vct{1}^\mathrm{T}},\label{eq:factorization}
\end{equation}
where the \emph{motion matrix}
\begin{equation}
M=\stack\bigl(\{R_f^\mathrm{T}\}\bigr)\label{eq:M}
\end{equation}
contains the rotations, the \emph{structure matrix}
\begin{equation}
S=\bmat{X_{s1}&\cdots&X_{sP}}
\end{equation}
contains the 3-D points expressed in $\cR_s$, the \emph{coefficient matrix} $C$ contains the projector $\Pi$ times the coefficients multiplying the rotations in \eqref{eq:Xc-dXc-ddXc}
\begin{equation}
C=\stack\left(\{\Pi\}_{f=1}^F,\{-\Pi\hat{\omega}_{f}\}_{f=1}^F,\{\Pi(\hat{\omega}_f^2-\dot{\hat{\omega}}_f)\}_{f=1}^F\right),
\end{equation}
 and the \emph{translation vector} $m\in\real{2F}$ contains the remaining vector terms
\begin{multline}
m=\stack\bigl(\{-\Pi\tau_{f}\}_{f=1}^F,\{\Pi(\hat{\omega}_f\tau_f-\nu_{f})\}_{f=1}^F,\\
\{\Pi((\hat{\omega}_f^2-\dot{\hat{\omega}}_f) \tau_f +2\hat{\omega}_{f}\nu_{f}-\alpha_{IMU}-R_{f}^\mathrm{T} g_s)\}_{f=1}^F\bigr).\label{eq:m}
 \end{multline}

In addition to this relation, the quantities $\tau_f$, $\nu_f$ and $\alpha_f^{IMU}$ can be linearly related using derivatives (see \eqref{eq:taub-nub-alphab}). Similarly, $R_f$ and $w_f$ can be related using the definition of angular velocity.
Note that the coefficients $C$ are completely determined by the IMU measurements and the torque inputs.

\paragraph{Optimization formulation}
From this, the problem of estimating the motion, the structure, and the gravity direction can then be casted as an optimization problem:
\begin{multline}
\min_{\{R_f,\tau_f,\nu_f\},g_s}\frob{W-(CMS+m)}^2+f_R(\{R_f\},\{\omega_f\})\\+f_\tau(M,\{\tau_f\},\{\nu_f\})+f_\nu(M,\{\nu_f\},\{\alpha_f^{IMU}\},g_s),  \label{eq:factorization-affine}
\end{multline}
where $f_R$, $f_\tau$ and $f_\nu$ are quadratic regularization terms based on approximating the linear derivative constraints between $\tau_f$, $\nu_f$, $\alpha_f^{IMU}$ and between $R_f$, $w_f$ with finite differences.

In particular, for our implementation we will use,:
\begin{align}
f_R&=\sum_{f=1}^{F-1}\frob{R_{f+1}-R_f\expm(t_s\omega_f)}^2 \label{eq:regR}\\
f_\tau&=\sum_{f=1}^{F-1} \frob{\frac{1}{t_s}\conv(\tau_k,h_k,f)-\nu_f}^2\label{eq:regtau}\\
f_\nu&=\sum_{f=1}^{F-1} \frob{\frac{1}{t_s}\conv(\nu_k,h_k,f)-\alpha_{IMU}-R_f^\mathrm{T} g_s}^2.\label{eq:regnu}
\end{align}
where with $t_s$ is the sampling period of the measurements, $\expm$ is the matrix exponential and $\conv(\tau_k,h_k,f)$ gives the sample at time $f$ of the convolution $\tau_k\ast h_k$ of a signal $\tau_k$ with a derivative interpolation filter $h_k$. For our implementation we obtain $h_k$ from a Savitzky-Golay filter of order one and window size three.

\paragraph{Solution strategy} The optimization problem \eqref{eq:factorization-affine} is non-convex. However, we can find a closed-form solution by exploiting the low-rank nature of the product $MS$ and the linearity of the other terms. This closed-form solution is exact for the noiseless case, and provides an approximated solution to \eqref{eq:factorization-affine} in the noisy case.

\begin{enumerate}
\item\label{it:factorization} Factorization. Compute a rank four factorization $W=\tilde{M}\tilde{S}$ using an SVD. With respect to the last term in \eqref{eq:factorization}, the factors $\tilde{M}$ and $\tilde{S}$ are related to, respectively $\bmat{CM & m}$ and $\bmat{S\\\vct{1}^\mathrm{T}}$ by an unknown matrix $K_{\textrm{proj}}\in\real{4\times 4}$. In standard SfM terminology, $\tilde{M}$ and $\tilde{S}$ represent a \emph{projective} reconstruction.
\item Similarity transformation. Ideally, the last row of $\tilde{S}'$ should be $\vct{1}^\mathrm{T}$. Therefore, we find a vector $k\in\real{4}$ by solving $k^\mathrm{T} \tilde{S}'=\vct{1}^\mathrm{T}$ in a least squares sense. We then define the matrix $K_{\textrm{symil}}=\stack(\bmat{I & 0},k^\mathrm{T})$, and the matrices $\tilde{M}'=\tilde{M} K_{\textrm{symil}}^{-1}$, $\tilde{S}'=K_{\textrm{symil}}\tilde{S}$. In standard SfM terminology, $\tilde{M}'$ and $\tilde{S}'$ represent reconstruction up to a \emph{symilarity} transformation.
\item\label{it:centering} Centering. To fix the center of the absolute reference frame $\cR_s$ to the center of the 3-D structure, we first compute the vector $c=\frac{1}{P}[\tilde{S}']_{1:3,:}$, where $[\tilde{S}']_{1:3,:}$ indicates the matrix composed of the first three rows of $\tilde{S}'$. We then define the matrix $K_{\textrm{center}}=\bmat{0 & -c\\0 & 1}$, and the matrices $\tilde{M}''=\tilde{M}' K_{\textrm{center}}^{-1}$ and $\tilde{S}''=K_{\textrm{center}}\tilde{S}'$. At this point the forth column of the matrix $\tilde{M}''$ contains (in the ideal case) the vector $m$ defined in \eqref{eq:factorization}, that is $\hat{m}=[\tilde{M}'']_{:,4}$.
\item\label{it:rotations} Recovery of  the rotations and structure. We now solve for the rotations $\{R_f\}$ by solving a reduced version of \eqref{eq:factorization-affine}. In particular, we solve
  \begin{equation}
    \min_{M''\in\real{3F\times 3}} \norm{[\tilde{M}'']_{:,1:3}-CM''}_F^2+\norm{C_RM''}_F^2,\label{eq:opt-rotation}
  \end{equation}
where $[\tilde{M}'']_{:,1:3}$ indicates the matrix containing the first three columns of $\tilde{M}''$, and $C_R$ is a block-banded-diagonal matrix with blocks $I$ and $-\expm(t_s\omega_f)^\mathrm{T}$ corresponding to the regularization term \eqref{eq:regR}. This is a simple least squares problem which can be easily solved using standard linear algebra algorithms. Ideally, the matrix $M''$ is related to the real matrix $M$ by an unknown similarity transformation $K_{\textrm{upg}}\in\real{3\times 3}$. This matrix can be determined (up to an arbitrary rotation) using the standard metric upgrade step from Affine SfM (see \cite{Tomasi:IJCV92}). Once $K_{\textrm{upg}}$ has been determined, we define $\hat{M}=M''K_{\textrm{upg}}$ and $\hat{S}=K_{\textrm{upg}}^{-1} [\tilde{S}'']_{1:3,:}$ to be the estimated motion and structure matrices. The final estimates $\{\hat{R}_f\}$ are obtained by projecting each $3\times 3$ block of $\hat{M}$ to $SO(3)$ using an SVD decomposition.
\item\label{it:translations} Recovery of the translations and linear velocities. We need to extract $\{\tau_f\}$ and $\{\omega_f\}$ and an estimated gravity direction $\hat{g}_s$ from the vector $\hat{m}$. Following~\eqref{eq:m}, we define the matrix
  \begin{equation}
    C_m=\bmat{ \vdots & \vdots & \vdots \\ -\Pi & 0 & 0\\ \vdots & \vdots & \vdots \\ \Pi\hat{\omega}_f & -\Pi & 0\\   \vdots & \vdots & \vdots \\\Pi((\hat{\omega}_f^2-\dot{\hat{\omega}}_f) & 2\hat{\omega}_{f} & -R_{f}\\ \vdots & \vdots & \vdots }
  \end{equation}
and the vector $c_m=\stack(\vct{0}_{6F},\{\alpha_f^{IMU}\})$. Similarly to the definition of $C_R$ in \eqref{eq:opt-rotation}, we also define the matrices $C_\tau$, $C_\nu$ corresponding to the regularization terms \eqref{eq:regtau} and \eqref{eq:regnu}.
We can then solve for the vector $x=\stack(\{\hat{\tau}_f\},\{\hat{\nu_f\}},\hat{g}_s)$ by minimizing
\begin{equation}
  \min_x \norm{C_mx-\hat{m}}_F^2+\norm{C_\tau x}_F^2+\norm{C_\nu x}_F^2,\label{eq:opt-translation}
\end{equation}
which again is a least squares problem that can be solved using standard linear algebra tools.
\end{enumerate}


\section{Introduction}
The creation of interpersonal ties has been a fundamental question in the structural analysis of social networks. While strong ties emerge between individuals with similar social circles, forming a basis of trust and hence community structure, weak ties link two members who share few common contacts. The influential work of Granovetter reveals the vital roles of weak ties: It is weak ties that enable information transfer between communities and provide individuals positional advantage and hence influence and power \cite{Granovetter}.

\smallskip

Natural questions arise regarding the establishment of weak ties between communities: How to merge two departments in an organization into one? How does a company establish trade with an existing market? How to create a transport map from existing routes? We refer to such questions as {\em network building}. The basic setup  involves two networks; the goal is to establish ties between them to achieve certain desirable properties in the combined network. A real-life example of network building is the inter-marriages between members of  the Medici, the leading family of Renaissance Florence, and numerous other noble Florentine families, towards gaining power and control over the city \cite{Jackson-Medici}. Another example is by Paul Revere, a prominent Patriot during the American Revolution, who strategically created social ties to raise a militia \cite{UzziDunlap}.

\smallskip

The examples of the Medici and Paul Revere pose a more restricted scenario of network building: Here one of the two networks involved is only a single node, and the goal is to establish this node in the other network. We motivate this setup from two directions:
\begin{enumerate}
\item This setup amounts to the problem of {\em socialization}: the situation when a newcomer joins a network as an organizational member. A natural question for the newcomer is the following: How should I forge new relationships in order to take an advantageous position in the organization? As indicated in \cite{Morrison},  socialization is greatly influenced by the social relations formed by the newcomer with ``insiders'' of the network.
\item This setup also amounts to the problem of {\em network expansion}. For example, an airline expands its existing route map with a new destination, while trying to ensure a small number of legs between any cities.
\end{enumerate}

{\em Distance} refers to the length of a shortest path between two members in a network; this
is an important measure of the amount of influence one may exert to another in the network \cite{collaboration}. The {\em radius} of a network refers to the maximal distance from a central member to all others in a network. Hence when a newcomer joins an established network,  it is in the interest of the newcomer to keep her distance to others bounded by the radius. The {\em diameter} of a network refers to the longest distance between any two members. It has long been argued from network science that small-world property -- the property that any two members of a network are linked by short paths -- improves network  robustness and facilitates information flow \cite{robustness}.
Hence it is in the interest of the  network to keep the diameter small as the network expands.
Furthermore, each relation requires time and effort to establish and maintain; thus one is interested in minimizing the number of new ties while building a network.

\paragraph*{\bf Contribution.} The novelty of this work is in proposing a formal, algorithmic study of organizational socialization. More specifically we investigate the following {\em network building problems}: Given a network $G$, add a new node $u$ to $G$ and create as few ties as possible for $u$ such that:
\begin{enumerate
\item[(1)] $u$ is in the center of the resulting network; o
\item[(2)] the diameter of the resulting network is not larger than a specific value
\end{enumerate}
Intuitively,  (1) asks how a newcomer $u$ may optimally connect herself with members of $G$, so that she belongs to the center. We prove that this problem is in fact NP-complete (Theorem~\ref{thm:problemradius}). Nevertheless, we give several efficient algorithms for this problem; in particular, we demonstrate a ``simplification'' process that significantly improves performance.
Intuitively, (2) asks how a network may preserve or reduce its diameter by connecting with a new member $u$. We show that ``preserving the diameter'' is trivial for most real-life networks and give two algorithms for ``reducing the diameter''.
We experimentally test and compare the performance of all our algorithms. Quite surprisingly, the experiments demonstrate that a very small number of new edges is usually sufficient for each problem even when the graph becomes large.

\paragraph*{\bf Related works.} This work is predated by organizational behavioral studies \cite{socialization1,socialization2,Morrison}, which look at how social ties affect a newcomer's integration and assimilation to the organization. The authors in \cite{CrossThomas,UzziDunlap} argue {\em brokers} -- those who bridge and connect to diverse groups of individuals -- enable good network building; creating ties with and even becoming a broker oneself allows a person to gain private information, wide skill set and hence power. Network building theory has also been applied to various other contexts such as economics (strategic alliance of companies) \cite{Stuart1}, governance (forming inter-government contracts) \cite{federalism},  and politics (individuals' joining of political movements) \cite{Passy}. Compared to these works, the novelty here is in proposing a formal framework of network building, which employs techniques from complexity theory and algorithmics.

This work is also related to two forms of network formation: {\em dynamic models} and {\em agent-based models}, both aim to capture the natural emergence of social structures \cite{Jackson-Medici}. The former originates from random graphs, viewing the emergence of ties as a stochastic process which may or may not lead to an optimal structure \cite{entangle}. The latter comes from economics, treating a network as a multiagent system where utility-maximizing nodes establish ties in a competitive setting \cite{strategicNF,JacksonSurvey}. Our work differs from network formation as the focus here is on calculated strategies that achieve desirable goals in the combined network.

\section{Networks Building: The Problem Setup}

We view a {\em network} as an undirected unweighted connected graph  $G = (V, E)$ where $V$ is a set of nodes and $E$ is a set of (undirected) edges on $V$. We denote an edge $\{u,v\}$ as $uv$. If $uv\in E$ then $v$ is said to be {\em adjacent} to $u$.
A {\em path} (of {\em length} $k$) is a sequence of nodes $u_0,u_1,\ldots,u_k$ where $u_iu_{i+1}\!\in\!E$ for any $0\!\leq\!i\!<\!k$. The {\em distance} between $u$ and $v$, denoted by $\mathsf{dist}(u,v)$, is the length of a shortest path from $u$ to $v$. The {\em eccentricity} of $u$ is the maximum distance from $u$ to any other node, i.e., $\mathsf{ecc}(u)=\max_{v\in V} \mathsf{dist}(u,v)$. The {\em diameter} of the network $G$ is $ \mathsf{diam}(G)=\max_{u\in V} \mathsf{ecc}(u)$. The {\em radius} $\mathsf{rad}(G)$ of $G$ is $\min_{u\in V} \mathsf{ecc}(u)$. The {\em center} of $G$ consists of those nodes that are closest to all other nodes; it is the set $C(G)\coloneqq \{u\in V\mid \mathsf{ecc}(u)=\mathsf{rad}(G)\}$.
\begin{definition
Let $G=(V,E)$ be a network and $u$ be a node not in $V$.  For $S\subseteq V$, denote by $E_S$ the set of edges $\{uv\mid v\in S\}$. Define $G\oplus_S u$ as the graph $(V\cup \{u\}, E\cup E_S)$
\end{definition}
We require that $S\!\neq\!\varnothing$ and thus $G\oplus_S u$ is a network built by incorporating $u$ into $G$. By \cite{UzziDunlap}, for a newcomer $u$ to establish herself in $G$ it is essential to identify {\em information brokers} who connect to diverse parts of the network.
Following this intuition, we make the following definition
 \begin{definition}
 A set $S\subseteq V$ is a {\em broker set} of $G$ if $\mathsf{ecc}(u)=\mathsf{rad}(G\oplus_S u)$; namely, linking with $S$ enables $u$ to get in the center of the network.
 \end{definition}
Formally, given a network $G=(V,E)$, the problem of {\em network building for $u$} means selecting a set $S\!\subseteq\!V$ so that the combined network $G\!\oplus_S\!u$ satisfies certain conditions. Moreover, the desired set $S$ should contain as few nodes as possible. We focus on the following two key problems:
\begin{enumerate
\item $\mathsf{BROKER}$: The set $S$ is a broker set.
\item $\mathsf{DIAM}_\Delta$:  The diameter $\mathsf{diam}\!(\!G\!\oplus_S\! u\!)\!\leq\!\Delta$ for a given $\Delta\leq \mathsf{diam}(G)$.
\end{enumerate}
Note that for any network $G$, if $u$ is adjacent to all nodes  in $G$, it will have eccentricity 1, i.e., in the network $G\oplus_V u$, $\mathsf{ecc}(u)\!=\!1\!=\!\mathsf{rad}(G\oplus_V u)$ and $\mathsf{diam}(G\oplus_V u)\!=\!2$. Hence a desired $S$ must exist for $\mathsf{BROKER}$ and $\mathsf{DIAM}_\Delta$ where $\Delta\geq 2$. In subsequent section we systematically investigate these two problems.

\section{How to Be in the Center? Complexity and Algorithms for $\mathsf{BROKER}$}

\subsection{Complexity}
We  investigate the computational complexity of the decision problem $\mathsf{BROKER}(G,k)$, which is defined as follows:
\begin{description}
\item[INPUT] A network $G=(V,E)$, and an integer $k\geq 1$
\item[OUTPUT] Does $G$ have a broker set of size $k$?
\end{description}

The $\mathsf{BROKER}(G,k)$ problem is trivial if  $G$ has radius 1, as then $V$ is the only broker set. When $\mathsf{rad}(G)>1$, we recall the following notion: A set of nodes $S\subseteq V$ is a  {\em dominating set} if every node not in $S$ is adjacent to at least one member of $S$. The \emph{domination number} $\gamma(G)$ is the size of a smallest dominating set for $G$. The $\mathsf{DOM}(G,k)$ problem concerns testing whether  $\gamma(G)\!\leq\!k$ for a given graph $G$ and input $k$; it is a classical NP-complete decision problem \cite{GareyJohnson}.

\begin{theorem}\label{thm:problemradius}
The $\mathsf{BROKER}(G,k)$ problem is NP-complete
\end{theorem}
\begin{proof} The $\mathsf{BROKER}(G,k)$ problem is clearly in NP. Therefore we only show NP-hardness.
We present a reduction from $\mathsf{DOM}(G,k)$ to $\mathsf{BROKER}(G,k)$. Note that when $\mathsf{rad}(G)\!=\!1$, $\gamma(G)\!=\!1$.  Hence $\mathsf{DOM}(G,k)$ remains NP-complete if we assume $\mathsf{rad}(G)>1$. Given a graph $G=(V,E)$ where $\mathsf{rad}(G)>1$, we construct a graph $H$. The set of nodes in $H$ is $\{v_i\mid v\in V, 1\leq i\leq 3\}$. The edges of $H$ are  as follows:
\begin{itemize
\item Add an edge $v_i v_{i+1}$ for every $v\in V$, $1\leq i<3
\item Add an edge $v_1w_1$ for every $v,w\in V
\item Add an edge $v_2 w_2$ for every edge $vw\in E
\end{itemize}
Namely, for each node $v\in V$ we create three nodes $v_1,v_2,v_3$ which form a path. We link the nodes in $\{v_1\mid v\in V\}$ to form a complete graph, and nodes in $\{v_2\mid v\in V\}$ to form a copy of $G$.  Since $\mathsf{rad}(G)\geq 2$, for each node $v\in V$ there is $w\in V$ with $\mathsf{dist}(v,w)\geq 2$. Hence in $H$,  $\mathsf{dist}(v_3,w_3)\geq 4$, and $\mathsf{dist}(v_2,w_3)\geq 3$. As the longest distance from any $v_1$ to any other node is $3$, we have $\mathsf{rad}(H)=3$.

Suppose $S$ is a dominating set of $G$. If we add all edges $uv$ where $v\in D=\{v_2\mid v\in S\}$, $\mathsf{ecc}(u)=3=\mathsf{rad}(H\oplus_D u)$. Hence $D$ is a broker set for $H$. Thus the size of a minimal broker set of $H$ is at most the size of a minimal dominating set of $G$.
Conversely, for any set $D$ of nodes in $H$, define the {\em projection} $p(D) = \{v\mid v_i\in D \text{ for some } 1\leq i\leq 3\}$.
 Suppose $p(D)$ is not a dominating set of $G$. Then there is some $v\in V$ such that for all $w\in p(D)$, $\mathsf{dist}(v_2,w_2)\geq 2$. Thus if we add all edges in $\{ux\mid x\in D\}$, $\mathsf{dist}(u,v_3)\geq 4$. But then $\mathsf{ecc}(w_1)=3$ for any $w\in p(D)$. So $D$ is not a broker set. This shows that the size of a minimal dominating set of $G$ is at most the size of a minimal broker set.

The above argument implies that the size of a minimal broker set for $H$ coincides with the size of a minimal dominating set for $G$. This finishes the reduction and hence the proof. \qed
\end{proof}

\subsection{Efficient Algorithms}\label{subsec:radius_algorithms
Theorem~\ref{thm:problemradius} implies that computing optimal solution of $\mathsf{BROKER}$ is computationally hard. Nevertheless, we next present a number of efficient algorithms that take as input a network $G=(V,E)$ with radius $r$ and output a small broker set $S$ for $G$. A set $S\subseteq V$ is called {\em sub-radius dominating} if for all $v\in V$ not in $S$, there exists some $w\in S$ with $\mathsf{dist}(v,w)<r$. Our algorithms are based on the following fact, which is clear from definition:

\begin{fact}\label{fact:sub-radius dominating}Any sub-radius dominating set is also a broker set
\end{fact}

\subsubsection{(a) Three greedy algorithms}

We first present three greedy algorithms; each algorithm applies a heuristic that iteratively adds new nodes to the broker set $S$.
The starting configuration is $S= \varnothing$ and $U= V$.  During its computation, the algorithm maintains a subgraph $F=(U,E\restriction U)$, which is induced by the set $U$ of all ``uncovered'' nodes, i.e., nodes that have distance $>(r-1)$ from any current nodes in $S$. It repeatedly performs the following operations until $U=\varnothing$, at which point it outputs $S$:
\begin{enumerate}
\item Select a node $v\in U$ based on the corresponding heuristic and add $v$ to $S$.
\item Compute all nodes at distance at most  $(r-1)$ from $v$. Remove these nodes and all attached edges from $F$.
\end{enumerate}
\paragraph*{\bf Algorithm 1: $\mathsf{Max}$ (Max-Degree).} The first heuristic is based on the intuition that one should connect to the person with the highest number of social ties; at each iteration, it adds to $S$ a node with maximum degree in the graph $F$.

\paragraph*{\bf Algorithm 2: $\mathsf{Btw}$ (Betweenness).} The second heuristic is based on {\em betweenness}, an important centrality measure in networks \cite{betweeness}. More precisely, the {\em betweenness} of a node $v$ is the number of shortest paths from all nodes to all others that pass through $v$. Hence high betweenness of $v$ implies, in some sense, that $v$ is more likely to have short distance with others. This heuristic works in the same manner as $\mathsf{Max}$ but picks nodes with maximum betweenness in $F$.

\paragraph*{\bf Algorithm 3: $\mathsf{ML}$ (Min-Leaf).}  The third heuristic is based on the following intuition: A node is called a {\em leaf} if it has minimum degree in the network; leaves correspond to  least connected members in the network, and may become outliers once nodes with higher degrees are removed from the network. Hence this heuristic gives first priority to leaves. Namely, at each iteration, the heuristic adds to $S$ a node that has distance at most $r-1$ from $v$. More precisely, the heuristic first picks a leaf $v$ in $F$, then applies a sub-procedure to find the next node $w$ to be added to $S$. The sub-procedure  determines a path $v=u_1,u_2,\ldots$ in $F$ iteratively as follows:
    \begin{enumerate
    \item Suppose $u_i$ is picked. If $i=r$ or $u_i$ has no adjacent node in $F$, set $u_i$ as $w$ and terminate the process
    \item Otherwise select a $u_{i+1}$ (which is different from $u_{i-1}$) among adjacent nodes of $u_i$ with maximum degree.

    \end{enumerate
    After the process above terminates, the algorithm adds $w$ to $S$. Note that the distance between $w$ and $v$ is at most  $r-1$.

We mention that Algorithms 1,3 have been applied in \cite{k-domination} to {\em regular graphs}, i.e., graphs where all nodes have the same degree. In particular, $\mathsf{ML}$ has been shown to produce small $k$-dominating sets for given $k$ in the average case for regular graphs.

\subsubsection{(b) Simplified greedy algorithms}

One significant shortcoming of Algorithms 1--3 is that, by deleting nodes from the network $G$, the network may become disconnected, and nodes that could have been connected via short paths are no longer reachable from each other. This process may produce {\em isolated} nodes in $F$, i.e., nodes having degree 0, which are subsequently all added to the output set $S$. Moreover, maintaining the graph $F$ at each iteration also makes  implementations more complex. Therefore we next propose {\em simplified} versions of  Algorithms  1--3.

\paragraph*{\bf Algorithms 4 $\mathsf{S}$-$\mathsf{Max}$, 5 $\mathsf{S}$-$\mathsf{Btw}$, 6 $\mathsf{S}$-$\mathsf{ML}$.} The simplified algorithms act in a similar way as their ``non-simplified'' counterparts; the difference is that here the heuristic works over the original network $G$ as opposed to the updated network $F$. Hence the graph $F$ is no longer computed. Instead we only need to maintain a set $U$ of ``uncovered'' nodes. The simplified algorithms have the following general structure: \ Start from $S= \varnothing$ and $U= V$, and repeatedly perform the following until $U=\varnothing$, at which point output $S$:
\begin{enumerate
\item Select a node $v$ from $U$ based on the corresponding heuristic and add $v$ to $S$
\item Compute all nodes with distance $<\mathsf{rad}(G)$ from $v$, and remove any of these node  from $U$.
\end{enumerate
We stress that here the same heuristics as described above in Algorithms 1--3 are applied, except that we replace any mention of ``$F$'' in the description with ``$U$'', while all notions of degrees, distances, and betweenness are calculated based on the original network $G$.

As an example, in Fig.~\ref{fig:Max} we run $\mathsf{Max}$ and $\mathsf{S}$-$\mathsf{Max}$ on the same network $G$, which contains 30 nodes. The figures show the result of both algorithms, and in particular, how $\mathsf{S}$-$\mathsf{Max}$ outputs a smaller sub-radius dominating set. We further verify via experiments below that the simplified algorithms lead to much smaller output $S$ in almost all cases.

\begin{figure}[!] \centerin
        \includegraphics[width=0.5\textwidth]{example.png}
        \caption{ The network $G$ contains 30 nodes and has radius $\mathsf{rad}(G)=4$. The $\mathsf{Max}$ algorithm: The algorithm first puts node 3 (shown in green) into $S$. Then removes all nodes (and attached edges that are at distance three from the node 3; these nodes are considered ``covered'' by 3. In the remaining graph, there are three isolated nodes 8,14,26, as well as a line of length 2. The algorithm then puts the node 18 into $S$ which ``covers'' 27 and 13. Thus the output set is $S=\{3,18,8,14,26\}$. The $\mathsf{S}$-$\mathsf{Max}$ algorithm: The algorithm first puts 3 into the set $S$, but does not remove the covered nodes. It simply construct a set containing all ``uncovered'' nodes, namely, $\{27,18,13,14,8,26\}$. The algorithm then selects the node 13 which has max degree from these nodes, and puts into $S$. It then turns out that all nodes are covered. Therefore the output set is $S=\{3,13\}$. Thus $\mathsf{S}$-$\mathsf{Max}$ is superior in this example.}\label{fig:Max}

\end{figure}

\subsubsection{(c) Center-based algorithms}

The 6 algorithms presented above can all be applied to find $k$-dominating set for arbitrary $k\geq 1$. Since our focus is in finding sub-radius dominating set to answer the $\mathsf{BROKER}$ problem, we describe two algorithms that are specifically designed for this task. When building network for a newcomer, it is natural to consider nodes that are already in the center of the network $G$. Hence our two algorithms are based on utilizing the center of $G$.

\paragraph*{\bf Algorithm 7 $\mathsf{Center}$.} The algorithm finds a center $v$ in $G$ with minimum degree, then output all nodes that are adjacent to $v$. Since $v$ belongs to the center, for all $w\in V$, we have $\mathsf{dist}(v,w)\leq \mathsf{rad}(G)$ and thus there is $v'$ adjacent to $v$ such that  $\mathsf{dist}(w,v')=\mathsf{dist}(w,v)-1<\mathsf{rad}(G)$. Hence the algorithm returns a sub-radius dominating set. Despite its apparent simplicity, $\mathsf{Center}$ returns surprisingly good results in many cases, as shown in the experiments below.

\paragraph*{\bf Algorithm 8 $\mathsf{Imp}$-$\mathsf{Center}$.} We present a modified version of $\mathsf{Center}$, which we call $\mathsf{Imp}$-$\mathsf{Center}$.
The algorithm first picks a center with minimum degree, and then orders all its neighbors in decreasing degree. It adds the first neighbor to $S$ and remove all nodes $\leq (r-1)$-steps from it. This may disconnect the graph into a few connected components. Take the largest component $C$. If $C$ has a smaller radius  than $r$, we add the center of this component to $S$; otherwise we add the next neighbor to $S$. We then remove from $F$ all nodes at distance $\leq (r-1)$ from the newly added node. This procedure is repeated until $F$ is empty. See Procedure~\ref{alg:Center_improved}. Fig.~\ref{fig:Center} shows an example where $\mathsf{Imp}$-$\mathsf{Center}$ out-performs $\mathsf{Center}$.

\begin{algorithm}[!htb]
\floatname{algorithm}{Procedure}
 \caption{ $\mathsf{Imp}$-$\mathsf{Center}$: Given $G=(V,E)$ (with radius $r$)}
 \label{alg:Center_improved}
  \begin{algorithmic}
    \State Pick a center node $v$ in $G$ with minimum degree $d$
    \State Sort all adjacent nodes of $v$ to a list $u_1,u_2,\ldots,u_d$ in decreasing order of degrees

    \State Set $S\leftarrow \varnothing$ and $i\leftarrow 1$
    \While{$U\neq \varnothing$}
        \State Set $C$ as the largest connected component in $F$

        \If{$\mathsf{rad}(C)<\mathsf{rad}(G)-1$}
            \State Pick  a center node $w$ of $C$. Set $S\leftarrow S\cup \{w\}$
            \State Set $U\leftarrow U\setminus \{w'\in U\mid \mathsf{dist}(w,w')<r\}
        \Else
            \State Set $S\leftarrow S\cup \{u_i\}$
            \State Set $U\leftarrow U\setminus \{w'\in U\mid \mathsf{dist}(u_i,w')<r\}$
            \State Set $i\leftarrow i+1$
        \EndIf
        \State Set $F$ as the subgraph induced by the current $U$
    \EndWhile
    \State\Return $S$
  \end{algorithmic}
\end{algorithm}
\begin{figure}[!htb
        \centering

                \includegraphics[width=0.7\textwidth]{sage6}

        \caption{ The graph $G$ has radius $\mathsf{rad}(G)=3$. The yellow node 0 is a center with min degree 4. Thus $\mathsf{Center}$ outputs 4 nodes $\{1,4,18,29\}$. The dark green node 29 adjacent to 0 has max degree; the red nodes are ``uncovered'' by 29. Thus $\mathsf{Imp}$-$\mathsf{Center}$ outputs the 3 blue circled nodes $\{12,25,29\}$. }\label{fig:Center}
\end{figure}
Finally, we note that all of Algorithms 1--8 output a sub-radius dominating set $S$ for the network $G$. Thus the following theorem is a direct implication from Fact~\ref{fact:sub-radius dominating}.
\begin{theorem
All of Algorithms 1--8 output a brocker set for the network $G$.
\end{theorem}
\subsection{Experiments for $\mathsf{BROKER}$}
We implemented the algorithms using Sage \cite{Sage}.
We apply two models of random graphs: The first (BA) is Barabasi-Albert's preferential attachment model which generates scale-free graphs whose degree distribution of nodes follows a power law; this is an essential property of numerous real-world networks \cite{BA}. The second (NWS) is Newman-Watts-Strogatz's small-world network \cite{NewmanWattsStrogatz}, which produces graphs with small average path lengths and high clustering coefficient.

For each algorithm we are interested in two indicators of its performance: 1) {\em Output size}: The average size of the output broker set (for a specific class of random graphs). 2) {\em Optimality rate}: The probability that the algorithm gives optimal broker set for a random graph. To compute this we need to first compute the size of an optimal broker set (by brute force) and count the number of times the algorithm produces optimal solution for the generated graphs.

\paragraph*{\bf Experiment 1: Output sizes.} We generate $300$ graphs whose numbers of nodes vary between $100$ and $1000$ using each random graph model. We compute averaged output sizes of generated graphs by their number of nodes $n$ and radius $r$. The results are shown in Fig.~\ref{fig:improvedRes}. From the result we see: a) The simplified algorithms produce significantly smaller broker sets compared to  their unsimplified counterparts. This shows superiority of the simplified algorithms.
b) BA graphs in general allow smaller output set than NWS graphs. This may be due to the scale-free property which results in high skewness of the degree distribution.

\begin{figure}[!htb
        \centering
	   \includegraphics[width=\textwidth]{comaring_noMin}
        \caption{ Comparing results: average performance of the $\mathsf{Max}$, $\mathsf{Btw}$, $\mathsf{ML}$, algorithms versus their simplified versions on randomly generated graphs (BA graphs on the left; NWS on the right)}\label{fig:improvedRes}

\end{figure}
\paragraph{\bf Experiment 2: Optimality rates.} For the second goal, we compute the optimality rates of algorithms when applied to random graphs, which are shown in Fig.~\ref{fig:res}. For BA graphs, the simplified algorithm $\mathsf{S}$-$\mathsf{ML}$ has significantly higher optimality rate ($\geq 85\%$) than other algorithms. On the contrary, its unsimplified counterpart $\mathsf{ML}$ has the worst optimality rate. This is somewhat contrary to Duckworth and Mans's work showing $\mathsf{ML}$ gives very small solution set for regular graphs \cite{k-domination}.
For NWS graphs, several algorithms have almost equal optimality rate.  The three best algorithms are $\mathsf{S}$-$\mathsf{Max}$, $\mathsf{S}$-$\mathsf{Btw}$ and $\mathsf{S}$-$\mathsf{ML}$ which has varying performance for graphs with different sizes (See Fig.~\ref{fig:optimality_nodes}).

    \begin{figure}[!htb]\centering

                \includegraphics[width=\textwidth]{percentageRes_noMin}
        \caption{ Optimality rates for different types of random graphs}\label{fig:res}
    \end{figure}

    \begin{figure}[!htb]\centering
                \includegraphics[width=\textwidth]{nodes_combined_noMin}
        \caption{ Optimality rates when graphs are classified by sizes}\label{fig:optimality_nodes}
    \end{figure}

\paragraph*{\bf Experiment 3: Real-world datasets.}
We test the algorithms on several real-world datasets: The $\mathsf{Facebook}$ dataset, collected from survey participants of Facebook App, consists of friendship relation on Facebook \cite{facebook}. $\mathsf{Enron}$  is an email network  of the company made public by the FERC \cite{enron1}. Nodes of the network are email addresses and if an address $i$ sent at least one email to address $j$, the graph contains an undirected edge from $i$ to $j$.
$\mathsf{Col} 1$ and $\mathsf{Col} 2$ are collaboration networks that represent scientific collaborations between authors papers submitted to General Relativity and Quantum Cosmology category ($\mathsf{Col} 1$), and to High Energy Physics Theory category ($\mathsf{Col} 2$) \cite{collaboration}.

\begin{table}[!htb]
\centering
\begin{tabular}{| l | l | l| l | l |}
\hline
&  Facebook &  Enron &  Col1 &  Col2\\
\hline
 Number of nodes &  4,039	 &  33,969 &  4,158&	 8,638	\\
\hline
 Number of edges &  88,234&  180,811 & 13,422& 24,806\\
\hline
Largest connected subgraph & 4,039 & 33,696 & 4,158 &	8,638 \\
\hline
 Diameter &  8 &  13 &  17 &  18\\
\hline
 Radius &  4 &  7 &  9 &  10\\
\hline
  \end{tabular}\caption{ Network properties} \label{table:datasets}
\end{table}

Results on the datasets are shown in Fig.~\ref{fig:datasets_res}.  $\mathsf{Btw}$ and $\mathsf{S}$-$\mathsf{Btw}$ algorithms become too inefficient as it requires computing shortest paths between all pairs in each iteration. Moreover, $\mathsf{S}$-$\mathsf{Max}$ also did not terminate within reasonable time for the $\mathsf{Enron}$ dataset. Even though the datasets have many nodes, the output sizes are in fact very small (within 10). For instance, the smallest output sets of the $\mathsf{Enron}$, $\mathsf{Col} 1$ and $\mathsf{Col} 2$ contain just two nodes. In some sense, it means that to become in the center even in a large social network, it is often enough to establish only very few connections.

\begin{figure}[!htb]
        \centering
                \includegraphics[width=.8\textwidth]{datasetRes_noMin}
        \caption{ The number of new ties  for the four real-world networks}\label{fig:datasets_res}
\end{figure}

Among all algorithm $\mathsf{Imp}$-$\mathsf{Center}$ has the best performance, producing the smallest output set for all networks. Moreover, for $\mathsf{Enron}$, $\mathsf{Col} 1$ and $\mathsf{Col} 2$,  $\mathsf{Imp}$-$\mathsf{Center}$  returns the optimal broker set with cardinality $2$. A rather surprising fact is, despite straightforward seemingly-naive logic,  $\mathsf{Center}$ also produces small outputs in three networks. This reflects the fact that in order to become central it is often a good strategy to create ties with the friends of a central person.
\section{How to Preserve or Improve the Diameter? Complexity and Algorithms for $\mathsf{DIAM}_\Delta$}\label{sec:diameter}
Let $G=(V,E)$ be a network and $u\notin V$. The $\mathsf{DIAM}_\Delta$ problem asks for a set $S\subseteq V$ such that the network $G\oplus_S u$  has diameter $\leq\Delta$; we refer to any such $S$ as {\em $\Delta$-enabling}.

\subsection{Preserving the diameter}
We first look at a special case when $\Delta=\mathsf{diam}(G)$, which has a natural motivation: How can an airline expand its existing route map with an additional destination while ensuring the maximum number of hops between any two destinations is not increased? We are interested in creating as few new connections as possible to reach this goal. Let $\delta(G)$ denote the size of the smallest $\mathsf{diam}(G)$-enabling set for $G$. We say a graph is {\em diametrically uniform} if all nodes have the same eccentricity.

\begin{theorem}\label{thm:problemdiameter}
\begin{enumerate
\item[(a)]If $G$ is not diametrically uniform,$\delta(G)\!=\!1$
\item[(b)]If $G$ is complete, then $\delta(G)=|V|$
\item[(c)]If $G$ is diametrically uniform and incomplete, then $1<\delta(G)\leq d$ where $d$ is the minimum degree of any node in $G$, and the upper bound $d$ is sharp
\end{enumerate}
\end{theorem}
\begin{proof}
For {\bf (a)}, suppose $G$ is not diametrically uniform. Take any $v$ where $\mathsf{ecc}(v)<\mathsf{diam}(G)$. Then in the expanded network $G\oplus_{\{v\}} u$, we have $\mathsf{ecc}(u)=\mathsf{ecc}(v)+1\leq \mathsf{diam}(G)$. {\bf (b)} is clear.
For {\bf (c)} Suppose $G$ is diametrically uniform and incomplete. For the lower bound, suppose $\gamma_{\mathsf{diam}(G)-1}(G)=1$. Then there is some $v\in V$ with the following property: In the network $G\oplus_{\{v\}} u$ we have $\mathsf{ecc}(u)\leq \mathsf{diam}(G)$, which means that $\mathsf{ecc}(v)<\mathsf{diam}(G)$. This contradicts the fact that $G$ is  diametrically uniform. For the upper bound, take a node $v\in V$ with the minimum degree $d$. Let $N$ be the set of nodes adjacent to $v$. From any node $w\neq v$, there is a shortest path of length $\leq \mathsf{diam}(G)$ to $v$. This path contains a node in $N$. Hence $w$ is at distance $\leq \mathsf{diam}(G)-1$ from some node in $N$. Furthermore as $G$ is not complete, $\mathsf{diam}(G)\geq 2$ and $v$ is at distance $1\leq \mathsf{diam}(G)-1$ from nodes in $N$. \qed
\end{proof}
\paragraph*{Remark} We point out that in case (c) calculating the exact value of $\delta(G)$ is a hard: In \cite{hardness_diameter}, its parametrized complexity  is shown to be complete for $\mathsf{W}[2]$, second level of the $\mathsf{W}$-hierarchy. Hence $\mathsf{DIAM}_\Delta$ is unlikely  to be in $\mathsf{P}$. On the other hand, we argue that real-life networks are rarely diametrically uniform. Hence by Thm.~\ref{thm:problemdiameter}(a), the smallest number of new connections needed to preserve the diameter is 1.

\subsection{Reducing the diameter}
We now explore the question $\mathsf{DIAM}_\Delta$ where $2\leq \Delta<\mathsf{diam}(G)$; this refers to the goal of placing a new member in the network and creating ties to allow a closer distance between all pairs of members.   We suggest two heuristics to solve this problem.

\paragraph*{\bf Algorithm 9 $\mathsf{Periphery}$.} The {\em periphery} $P(G)$ of $G$ consists of all nodes $v$ with $\mathsf{ecc}(v)=\mathsf{diam}(G)$. Suppose $\mathsf{diam}(G)>2$. Then the combined network $G\oplus_{P(G)} u$ has diameter smaller than $\mathsf{diam}(G)$. Hence we apply the following heuristic:  Two nodes $v,w$ in $G$ are said to form a {\em peripheral pair} if $\mathsf{dist}(v,w)=\mathsf{diam}(G)$. The algorithm first adds the new node $u$ to $G$ and repeats the following procedure until the current graph has diameter $\leq \Delta$:\\
1) Randomly pick a peripheral pair $v,w$ in the current graph\\
2) Adds the edges $uv,uw$ if they have not been added already\\
3) Compute the diameter of the updated graph

\noindent Note that once $v,w$ are chosen as a peripheral pair and the corresponding edges $uv,uw$ added, $v$ and $w$ will have distance 2 and they will not be chosen as a peripheral pair again. Hence the algorithm eventually terminates and produces a graph with diameter at most $\Delta$.

\paragraph*{\bf Algorithm 10 $\mathsf{CP}$ (Center-Periphery).} This algorithm applies a similar heuristic as $\mathsf{Periphery}$, but instead of picking peripheral pairs at each iteration, it first picks a node $v$ in the center and adds the edge $uv$; it then repeats the following procedure until the current graph has diameter $\leq \Delta$:\\
1) Randomly pick a node $w$ in the periphery of the current graph\\
2) Add the edge $uw$ if it has not been added already\\
3) Compute the diameter of the updated graph

\noindent Suppose at one iteration the algorithm picks $w$ in the periphery. Then after this iteration the eccentricity of $w$ is at most $r+2$ where $r$ is the radius of the graph.

\subsection{Experiments for $\mathsf{DIAM}_\Delta$}
We implement and test the performance of Algorithms 9,10 for  the problem $\mathsf{DIAM}_\Delta$
The performance of these algorithms are measured by the number of new ties created.

\paragraph*{\bf Experiment 4: Random graphs.}
We apply the two models of random graphs, BA and NWS, as described above. We generated $350$ graphs and considered the case when $\Delta = d(G) - 1$, i.e. the aim was to improve the diameter by one.
For both types of random graphs (fixing size and radius), the average number of new ties are shown in Fig.~\ref{fig:Barabasi_improve}.
The experiments show that $\mathsf{Periphery}$ performs better when the radius of the graph is close to the diameter (when radius is $>2/3$ of diameter), whilst $\mathsf{CP}$ is slightly better when the radius is significantly smaller than the diameter.

\begin{figure}[!htb]
        \centering
                \includegraphics[width=\textwidth]{improve_combined}
        \caption{ Comparing two methods for improving diameter applied to BA (left) and NWS (right) graphs}\label{fig:Barabasi_improve}
\end{figure}

\paragraph*{\bf Experiment 5: Real-World Datasets.} We run both $\mathsf{Periphery}$ and $\mathsf{CP}$ on the networks $\mathsf{Col} 1$ and $\mathsf{Col} 2$  introduced above, setting $\Delta =\mathsf{diam}(G)-i$ for $1\leq i\leq 4$. The numbers of new edges obtained by $\mathsf{Periphery}$ and $\mathsf{CP}$ are shown in Figure~\ref{fig:collaboration_improve}; naturally for increasing $i$, more ties need to be created.
We point out that, despite the large total number of nodes, one needs less than $19$ new edges to improve the diameter even by four.
This reveals an interesting phenomenon: While a collaboration network may be large, a few more collaborations are sufficient to reduce the diameter of the network.

On the $\mathsf{Facebook}$ dataset, $\mathsf{Periphery}$ is significantly better than $\mathsf{CP}$: To reduce the diameter of this network from $8$ to $7$, $\mathsf{Periphery}$ requires 2 edges while $\mathsf{CP}$ requires $47$. When one wants to reach the diameter $6$, the numbers of new edges increase to 6 for $\mathsf{Periphery}$ and 208 for $\mathsf{CP}$.

\begin{figure}[!htb]
        \centering
                \includegraphics[width=0.8\textwidth]{collaboration_improve}
        \caption{ Applying algorithms for improving diameter to Collaboration 1 and Collaboration 2 datasets}\label{fig:collaboration_improve}
\end{figure}

\section{Conclusion and Outlook}
This work studies how ties are built between a newcomer and an established network to reach certain structural properties. Despite achieving optimality is often computationally hard, there are efficient heuristics that reach the desired goals using few new edges. We also observe that the number of new links required to achieve the specified properties remain small even for large networks.

This work amounts to an effort towards an algorithmic study of network building. Along this effort, natural questions have yet to be explored include: (1) Investigating the creation of ties between two arbitrary networks, namely, how ties are created between two established networks to maintain or reduce diameter. (2) When building networks in an organizational context (such as merging two departments in a company), one normally needs not only to take into account the informal social relations, but also formal ties such as the reporting relations, which are typically directed edges \cite{LiuMoskvina}. We plan to investigate network building in an organizational management perspective by incorporating both types of ties.

\bibliographystyle{splncs03}