MCPcopy Index your code
hub / github.com/clips/pattern / __init__

Method __init__

pattern/graph/__init__.py:615–623  ·  view source on GitHub ↗

A force-based layout in which edges are regarded as springs. The forces are applied to the nodes, pulling them closer or pushing them apart.

(self, graph)

Source from the content-addressed store, hash-verified

613class GraphSpringLayout(GraphLayout):
614
615 def __init__(self, graph):
616 """ A force-based layout in which edges are regarded as springs.
617 The forces are applied to the nodes, pulling them closer or pushing them apart.
618 """
619 # Based on: http://snipplr.com/view/1950/graph-javascript-framework-version-001/
620 GraphLayout.__init__(self, graph)
621 self.k = 4.0 # Force constant.
622 self.force = 0.01 # Force multiplier.
623 self.repulsion = 15 # Maximum repulsive force radius.
624
625 def _distance(self, node1, node2):
626 # Yields a tuple with distances (dx, dy, d, d**2).

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected