Use this if you are using igraph from R
| layout_with_fr {igraph} | R Documentation | 
Place vertices on the plane using the force-directed layout algorithm by Fruchterman and Reingold.
layout_with_fr(
  graph,
  coords = NULL,
  dim = 2,
  niter = 500,
  start.temp = sqrt(vcount(graph)),
  grid = c("auto", "grid", "nogrid"),
  weights = NULL,
  minx = NULL,
  maxx = NULL,
  miny = NULL,
  maxy = NULL,
  minz = NULL,
  maxz = NULL,
  coolexp,
  maxdelta,
  area,
  repulserad,
  maxiter
)
with_fr(...)
graph | 
 The graph to lay out. Edge directions are ignored.  | 
coords | 
 Optional starting positions for the vertices. If this argument
is not   | 
dim | 
 Integer scalar, 2 or 3, the dimension of the layout. Two dimensional layouts are places on a plane, three dimensional ones in the 3d space.  | 
niter | 
 Integer scalar, the number of iterations to perform.  | 
start.temp | 
 Real scalar, the start temperature. This is the maximum amount of movement alloved along one axis, within one step, for a vertex. Currently it is decreased linearly to zero during the iteration.  | 
grid | 
 Character scalar, whether to use the faster, but less accurate grid based implementation of the algorithm. By default (“auto”), the grid-based implementation is used if the graph has more than one thousand vertices.  | 
weights | 
 A vector giving edge weights. The   | 
minx | 
 If not   | 
maxx | 
 Similar to   | 
miny | 
 Similar to   | 
maxy | 
 Similar to   | 
minz | 
 Similar to   | 
maxz | 
 Similar to   | 
coolexp, maxdelta, area, repulserad | 
 These arguments are not supported from igraph version 0.8.0 and are ignored (with a warning).  | 
maxiter | 
 A deprecated synonym of   | 
... | 
 Passed to   | 
See the referenced paper below for the details of the algorithm.
This function was rewritten from scratch in igraph version 0.8.0.
A two- or three-column matrix, each row giving the coordinates of a vertex, according to the ids of the vertex ids.
Gabor Csardi csardi.gabor@gmail.com
Fruchterman, T.M.J. and Reingold, E.M. (1991). Graph Drawing by Force-directed Placement. Software - Practice and Experience, 21(11):1129-1164.
layout_with_drl, layout_with_kk for
other layout algorithms.
Other graph layouts: 
add_layout_(),
component_wise(),
layout_as_bipartite(),
layout_as_star(),
layout_as_tree(),
layout_in_circle(),
layout_nicely(),
layout_on_grid(),
layout_on_sphere(),
layout_randomly(),
layout_with_dh(),
layout_with_gem(),
layout_with_graphopt(),
layout_with_kk(),
layout_with_lgl(),
layout_with_mds(),
layout_with_sugiyama(),
layout_(),
merge_coords(),
norm_coords(),
normalize()
# Fixing ego
g <- sample_pa(20, m=2)
minC <- rep(-Inf, vcount(g))
maxC <- rep(Inf, vcount(g))
minC[1] <- maxC[1] <- 0
co <- layout_with_fr(g, minx=minC, maxx=maxC,
                                  miny=minC, maxy=maxC)
co[1,]
plot(g, layout=co, vertex.size=30, edge.arrow.size=0.2,
     vertex.label=c("ego", rep("", vcount(g)-1)), rescale=FALSE,
     xlim=range(co[,1]), ylim=range(co[,2]), vertex.label.dist=0,
     vertex.label.color="red")
axis(1)
axis(2)