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


mousedown_node = false

#draw data
nodes = svg
		.selectAll ".node"

	.append "g"

# init nodes
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
