diff --git a/GraphRewriting/Layout/Coulomb.hs b/GraphRewriting/Layout/Coulomb.hs
new file mode 100644
--- /dev/null
+++ b/GraphRewriting/Layout/Coulomb.hs
@@ -0,0 +1,14 @@
+module GraphRewriting.Layout.Coulomb where
+
+import Data.View
+import GraphRewriting.Graph.Types
+import GraphRewriting.Graph.Read
+import GraphRewriting.Layout.Position
+import GraphRewriting.Layout.Force
+
+
+coulombForce ∷ View Position n ⇒ Node -> WithGraph n Force
+coulombForce node = do
+ 	n ← examineNode position node
+ 	ns ← mapM (examineNode position) =<< readNodeList
+ 	return $ fsum [repulsion n' n | n' ← ns]
diff --git a/GraphRewriting/Layout/Force.hs b/GraphRewriting/Layout/Force.hs
new file mode 100644
--- /dev/null
+++ b/GraphRewriting/Layout/Force.hs
@@ -0,0 +1,22 @@
+module GraphRewriting.Layout.Force where
+
+import Data.Vector
+import GraphRewriting.Layout.Geometry
+
+
+type Strength = Scalar → Scalar
+type Displacement = Vector2 → Vector2 -- TODO: should be Position
+type Force = Strength → Displacement
+
+fsum ∷ [Force] → Force
+fsum [] strength pos = pos
+fsum fs strength pos = focalPoint [f strength pos | f ← fs]
+
+repulsion ∷ Vector2 → Vector2 → Force
+repulsion from pos = force (pos - from)
+
+attraction ∷ Vector2 → Vector2 → Force
+attraction towards pos = force (towards - pos)
+
+force ∷ Vector2 → Force
+force f strength pos = pos + vnormalise f *| strength (vmag f)
diff --git a/GraphRewriting/Layout/Geometry.hs b/GraphRewriting/Layout/Geometry.hs
new file mode 100644
--- /dev/null
+++ b/GraphRewriting/Layout/Geometry.hs
@@ -0,0 +1,12 @@
+module GraphRewriting.Layout.Geometry where
+
+import Data.Vector
+
+
+focalPoint ∷ [Vector2] → Vector2
+focalPoint [] = error "focalPoint []"
+focalPoint xs = average xs
+
+average ∷ Fractional a ⇒ [a] → a
+average [] = fromInteger 0
+average xs = sum xs / fromIntegral (length xs)
diff --git a/GraphRewriting/Layout/Gravitation.hs b/GraphRewriting/Layout/Gravitation.hs
new file mode 100644
--- /dev/null
+++ b/GraphRewriting/Layout/Gravitation.hs
@@ -0,0 +1,19 @@
+module GraphRewriting.Layout.Gravitation where
+
+import Data.View
+import Data.Vector
+import Control.Monad
+import GraphRewriting.Graph.Types
+import GraphRewriting.Graph.Read
+import GraphRewriting.Layout.Position
+import GraphRewriting.Layout.Force
+
+
+centralGravitation ∷ View Position n ⇒ Node → WithGraph n Force
+centralGravitation = liftM (attraction $ fromScalar 0) . examineNode position
+
+gravitation ∷ View Position n ⇒ Node -> Rewrite n Force
+gravitation node = do
+ 	n ← examineNode position node
+ 	ns ← mapM (examineNode position) =<< readNodeList
+ 	return $ fsum [attraction n' n | n' ← ns]
diff --git a/GraphRewriting/Layout/PortSpec.hs b/GraphRewriting/Layout/PortSpec.hs
new file mode 100644
--- /dev/null
+++ b/GraphRewriting/Layout/PortSpec.hs
@@ -0,0 +1,31 @@
+module GraphRewriting.Layout.PortSpec
+	(module GraphRewriting.Layout.PortSpec,
+	 module GraphRewriting.Layout.Position,
+	 module Data.View)
+where
+
+import Prelude.Unicode
+import GraphRewriting.Graph
+import GraphRewriting.Layout.Position
+import Data.View
+import Data.Maybe (catMaybes)
+
+
+-- | Port position relative to the node center, and the direction in which edges should stick out.
+class PortSpec n where portSpec ∷ n → [(Vector2, Vector2)]
+
+sameDir ∷ Vector2 → (Vector2, Vector2)
+sameDir r = (r,r)
+
+portDir ∷ PortSpec n ⇒ n → [Vector2]
+portDir = map snd . portSpec
+
+relPortPos ∷ PortSpec n ⇒ n → [Vector2]
+relPortPos = map fst . portSpec
+
+absPortPos ∷ (PortSpec n, View Position n) ⇒ n → [Vector2]
+absPortPos n = map (examine position n +) (relPortPos n)
+
+propOfPort ∷ View [Port] n ⇒ (n → [a]) → Edge → n → [a]
+propOfPort portProps e n = catMaybes $ zipWith filterE (inspect n) (portProps n)
+	where filterE edge portPos = if edge ≡ e then Just portPos else Nothing
diff --git a/GraphRewriting/Layout/Position.hs b/GraphRewriting/Layout/Position.hs
new file mode 100644
--- /dev/null
+++ b/GraphRewriting/Layout/Position.hs
@@ -0,0 +1,11 @@
+module GraphRewriting.Layout.Position
+	(module GraphRewriting.Layout.Position,
+	 module Data.Vector,
+	 module Data.View)
+where
+
+import Data.Vector
+import Data.View
+
+
+newtype Position = Position {position ∷ Vector2}
diff --git a/GraphRewriting/Layout/RotPortSpec.hs b/GraphRewriting/Layout/RotPortSpec.hs
new file mode 100644
--- /dev/null
+++ b/GraphRewriting/Layout/RotPortSpec.hs
@@ -0,0 +1,46 @@
+module GraphRewriting.Layout.RotPortSpec
+	(module GraphRewriting.Layout.RotPortSpec,
+	 module GraphRewriting.Layout.Position,
+	 module GraphRewriting.Layout.Rotation,
+	 module GraphRewriting.Layout.PortSpec,
+	 module GraphRewriting.Layout.Geometry,
+	 module Data.Vector,
+	 module Data.View)
+where
+
+
+import GraphRewriting.Graph
+import GraphRewriting.Graph.Read
+import GraphRewriting.Layout.Position
+import GraphRewriting.Layout.Rotation
+import GraphRewriting.Layout.PortSpec
+import GraphRewriting.Layout.Geometry
+import Data.Vector
+import Data.View
+import Control.Monad
+
+
+rotPortSpec ∷ (PortSpec n, View Rotation n) ⇒ n → [(Vector2, Vector2)]
+rotPortSpec n = map (\(v, u) → (rot v, rot u)) (portSpec n)
+	where rot = rotate (examine rotation n)
+
+relRotPortPos ∷ (PortSpec n, View Rotation n) ⇒ n → [Vector2]
+relRotPortPos = map fst . rotPortSpec
+
+absRotPortSpec ∷ (PortSpec n, View Position n, View Rotation n) ⇒ n → [(Vector2, Vector2)]
+absRotPortSpec n = map (\(p,d) → (examine position n + p, d)) $ rotPortSpec n
+
+absRotPortPos ∷ (PortSpec n, View Position n, View Rotation n) ⇒ n → [Vector2]
+absRotPortPos = map fst . absRotPortSpec
+
+angularMomentum ∷ (View Position n, PortSpec n, View Rotation n, View [Port] n) ⇒ Node → WithGraph n Momentum
+angularMomentum n = do
+	nv ← readNode n
+	let npos = examine position nv
+	let edgePortions e = do
+		let nps = propOfPort portDir e nv
+		ns ← mapM readNode =<< adverseNodes n e
+		let nsps = concatMap (propOfPort absRotPortPos e) ns
+		let angles = [angle np (nsp - npos) | np ← nps, nsp ← nsps]
+		return $ map (approach . Rotation) angles
+	liftM (momSum . concat) (mapM edgePortions =<< attachedEdges n)
diff --git a/GraphRewriting/Layout/Rotation.hs b/GraphRewriting/Layout/Rotation.hs
new file mode 100644
--- /dev/null
+++ b/GraphRewriting/Layout/Rotation.hs
@@ -0,0 +1,42 @@
+module GraphRewriting.Layout.Rotation
+	(module GraphRewriting.Layout.Rotation,
+	 module Data.View)
+where
+
+import Prelude.Unicode
+import Data.Vector
+import Data.View
+import GraphRewriting.Layout.Geometry
+
+
+newtype Rotation = Rotation {rotation ∷ Angle}
+
+type Angle = Double -- ∊ [-π,π]
+type Impulse = Angle → Angle
+type Momentum = Impulse → Rotation → Rotation
+
+v01 = Vector2 0 1
+
+meanAngle ∷ [Angle] → Angle
+meanAngle as = angle v01 $ focalPoint [rotate a $ v01 | a ← as]
+
+momSum ∷ [Momentum] → Momentum
+momSum [] impulse r = r
+momSum as impulse r = Rotation $ meanAngle [rotation (a impulse r) | a ← as]
+
+approach ∷ Rotation → Momentum
+approach target impulse current = momentum (angle currentV targetV) impulse current where
+	targetV = rotate (rotation target) v01
+	currentV = rotate (rotation current) v01
+
+momentum ∷ Angle → Momentum
+momentum a impulse = Rotation . (+) (signum a * impulse (abs a)) . rotation
+
+angle ∷ Vector2 → Vector2 → Angle
+angle u v = sign ⋅ (acos $ vdot a b) where
+	sign = signum $ v2y b ⋅ v2x a - v2y a ⋅ v2x b
+	a = vnormalise u
+	b = vnormalise v
+
+rotate ∷ Angle → Vector2 → Vector2
+rotate a (Vector2 x y) = Vector2 (x ⋅ cos a - y ⋅ sin a) (x ⋅ sin a + y ⋅ cos a)
diff --git a/GraphRewriting/Layout/SpringEmbedder.hs b/GraphRewriting/Layout/SpringEmbedder.hs
new file mode 100644
--- /dev/null
+++ b/GraphRewriting/Layout/SpringEmbedder.hs
@@ -0,0 +1,24 @@
+module GraphRewriting.Layout.SpringEmbedder where
+
+import GraphRewriting.Graph
+import GraphRewriting.Graph.Read
+import GraphRewriting.Layout.Position
+import GraphRewriting.Layout.PortSpec
+import GraphRewriting.Layout.Rotation
+import GraphRewriting.Layout.RotPortSpec
+import GraphRewriting.Layout.Force
+import Control.Monad
+
+
+springForce ∷ (View [Port] n, View Position n, View Rotation n, PortSpec n) ⇒ Double → Node → WithGraph n Force
+springForce springLength n = liftM fsum $ mapM edgeForce =<< attachedEdges n where
+	
+	edgeForce e = do
+		ns ← adverseNodes n e
+		nTs ← springTargets e n
+		nsTs ← liftM concat $ mapM (springTargets e) ns
+		return $ fsum [attraction nsT nT | nsT ← nsTs, nT ← nTs]
+	
+	springTargets e node = do
+		ps ← liftM (propOfPort absRotPortSpec e) (readNode node)
+		return $ map (\(p,dir) → p + vnormalise dir *| springLength) ps
diff --git a/GraphRewriting/Layout/Wrapper.hs b/GraphRewriting/Layout/Wrapper.hs
new file mode 100644
--- /dev/null
+++ b/GraphRewriting/Layout/Wrapper.hs
@@ -0,0 +1,49 @@
+module GraphRewriting.Layout.Wrapper
+	(Wrapper, wrapGraph, wrappee, updateWrappee,
+	 module Data.View,
+	 module GraphRewriting.Graph.Types,
+	 module GraphRewriting.Layout.Position,
+	 module GraphRewriting.Layout.PortSpec,
+	 module GraphRewriting.Layout.Rotation,
+	 module GraphRewriting.Layout.RotPortSpec,
+	 module Data.Vector)
+where
+
+import Data.View
+import GraphRewriting.Graph
+import GraphRewriting.Graph.Types
+import GraphRewriting.Layout.Position
+import GraphRewriting.Layout.PortSpec
+import GraphRewriting.Layout.Rotation
+import GraphRewriting.Layout.RotPortSpec
+import Data.Vector
+
+
+-- | Wraps a value of type @w@, augmenting it with layout information
+data Wrapper w = Wrapper {wRot ∷ Rotation, wPos ∷ Position, wrappee ∷ w}
+
+instance View w (Wrapper w) where
+	inspect = wrappee
+	update = updateWrappee
+
+instance View Rotation (Wrapper n) where
+	inspect = wRot
+	update v w = w {wRot = v}
+
+instance PortSpec n ⇒ PortSpec (Wrapper n) where portSpec = portSpec . wrappee
+
+instance View Position (Wrapper n) where
+	inspect = wPos
+	update v w = w {wPos = v}
+
+instance View [Port] n ⇒ View [Port] (Wrapper n) where
+	inspect = inspect . wrappee
+	adjust f w = w {wrappee = adjust f $ wrappee w}
+
+updateWrappee v n = n {wrappee = v}
+
+-- | Wraps the nodes of a graph, augmenting them with layout information
+wrapGraph ∷ Graph n → Graph (Wrapper n)
+wrapGraph = unsafeMapNodesUnique wrapNode where
+	wrapNode k n = Wrapper {wRot = Rotation 0, wPos = Position $ genPos k, wrappee = n}
+	genPos k = let f = fromIntegral k in rotate f (fromScalar f)
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,10 @@
+Copyright (c) 2010, Jan Rochel
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+* Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/graph-rewriting-layout.cabal b/graph-rewriting-layout.cabal
new file mode 100644
--- /dev/null
+++ b/graph-rewriting-layout.cabal
@@ -0,0 +1,39 @@
+Name:           graph-rewriting-layout
+Version:        0.4.1
+Copyright:      (c) 2010, Jan Rochel
+License:        BSD3
+License-File:   LICENSE
+Author:         Jan Rochel
+Maintainer:     jan@rochel.info
+Stability:      beta
+Build-Type:     Simple
+Synopsis:       Force-directed node placement intended for incremental graph drawing
+Description:
+	Defines basic methods for force-directed node displacement that can be combined into an incremental graph-drawing procedure.
+Category:       Graphs, Graphics
+Extensions:     UnicodeSyntax
+Cabal-Version:  >= 1.6
+Build-Depends:
+	base >= 4 && < 4.3,
+	base-unicode-symbols >= 0.2 && < 0.3,
+	graph-rewriting >= 0.4 && < 0.5,
+	AC-Vector >= 1.2 && < 1.3
+Exposed-Modules:
+	GraphRewriting.Layout.Position
+	GraphRewriting.Layout.PortSpec
+	GraphRewriting.Layout.Rotation
+	GraphRewriting.Layout.RotPortSpec
+	GraphRewriting.Layout.Coulomb
+	GraphRewriting.Layout.Gravitation
+	GraphRewriting.Layout.SpringEmbedder
+	GraphRewriting.Layout.Wrapper
+Other-Modules:
+	GraphRewriting.Layout.Force
+	GraphRewriting.Layout.Geometry
+Extensions:
+	UnicodeSyntax
+	FlexibleInstances
+	FlexibleContexts
+	MultiParamTypeClasses
+	TypeSynonymInstances
+GHC-Options:   -fno-warn-duplicate-exports -fwarn-unused-imports
