 	.append "g"
 
 # init nodes
-node_data = ({id:a, reflexive:false} for a in [1..100])
+node_data = ({id:a, reflexive:false} for a in [1..10])
+link_data = [{"source":1, "target":3, "value":4}, {"source":1, "target":5, "value":4}]
 
 #animation
 tick = () ->
 	nodes.attr "cx", (d) -> d.x
 	nodes.attr "cy", (d) -> d.y
 
+	links.attr "x1", (d) -> d.source.x
+	links.attr "y1", (d) -> d.source.y
+	links.attr "x2", (d) -> d.target.x
+	links.attr "y2", (d) -> d.target.y
+
 #force layout
 force = d3.layout.force()
 		.nodes node_data
+		.links link_data
 		.size [width, height]
 		.linkDistance 150
 		.charge -500

		.attr "r", 5
		.style "fill", (d) -> colors(d.id)

		# override to turn off force layout
		.call force.drag().on "drag.force", () -> 
			d3.select(this).attr "transform", "translate(" + d3.event.x + "," + d3.event.y + ")"
		
		.call force.drag().origin () ->
			t = d3.transform(d3.select(this).attr("transform")).translate
			{x:t[0], y:t[1]}
		
		.on "mousedown", (d) ->
			mousedown_node = true
			scale = zoom.scale()
			translate = zoom.translate()
			select this
		.on "mouseup", (d) ->
			mousedown_node = false
			zoom.scale scale
			zoom.translate translate

# mark a node as selected
select = (node) -> 


stop = () ->
	console.log("stopped") 
	#force.stop()
setTimeout stop, 1000 

console.log nodes
