Skip to content

Commit

Permalink
fix(physics): allow theta to be configured (#417)
Browse files Browse the repository at this point in the history
I have no idea why this was disabled. There are no comments explaining
it and blame was also unhelpful. Hopefully someone just messed up adding
theta.
  • Loading branch information
Thomaash authored Feb 17, 2020
1 parent 63b172a commit 2a27c40
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs-kr/network/physics.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ <h3>옵션</h3>
physics:{
enabled: true,
barnesHut: {
theta: 0.5,
gravitationalConstant: -2000,
centralGravity: 0.3,
springLength: 95,
Expand All @@ -99,6 +100,7 @@ <h3>옵션</h3>
avoidOverlap: 0
},
forceAtlas2Based: {
theta: 0.5,
gravitationalConstant: -50,
centralGravity: 0.01,
springConstant: 0.08,
Expand Down Expand Up @@ -153,6 +155,7 @@ <h3>옵션</h3>
<tr><th>이름</th><th>Type</th><th>Default</th><th>설명</th></tr>
<tr><td>enabled</td> <td>Boolean</td> <td><code>true</code></td> <td>physics 시스템을 켜거나 끄는 옵션입니다. 이 옵션은 필수가 아닙니다. 아래 옵션들을 정의하고 실행된 옵션이 없는 경우 이 옵션은 true로 설정됩니다.</td></tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','barnesHut', this);"><td><span parent="barnesHut" class="right-caret"></span> barnesHut</td> <td>Object</td> <td><code>Object</code></td> <td>BarnesHut은 queadtree 기준으로 중력 모델입니다. 이것은 가장 빠르며, Default와 non-hierarchical 레이아웃에 solver를 추천합니다. </td></tr>
<tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.theta</td> <td>Number</td> <td><code>0.5</code></td> <td>TODO</td></tr>
<tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.gravitationalConstant</td> <td>Number</td> <td><code>-2000</code></td> <td>중력의 값을 설정하는 옵셥입니다. 중력을 강하게 하려면 값을 줄이면 됩니다. (-10000, -50000)</td></tr>
<tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.centralGravity</td> <td>Number</td> <td><code>0.3</code></td> <td>전체 Network를 중앙으로 다시 끌어 당기는 중앙 중력 장치에 대한 옵션입니다.</td></tr>
<tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.springLength</td> <td>Number</td> <td><code>95</code></td> <td>Edge는 스프링으로 모델링됩니다. 스프링의 길이는 스프링의 남은 길이입니다.</td></tr>
Expand All @@ -161,6 +164,7 @@ <h3>옵션</h3>

<tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.avoidOverlap</td> <td>Number</td> <td><code>0</code></td> <td>값의 범위: <code>[0 .. 1]</code>. 0보다 크면, Node의 크기가 고려됩니다. 거리는 두 중력 모델에 대한 Node의 원 반지름에서 계산합니다.</td></tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','forceAtlas2Based', this);"><td><span parent="forceAtlas2Based" class="right-caret"></span> forceAtlas2Based</td> <td>Object</td> <td><code>Object</code></td> <td>Force Atlas 2는 <a href="http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0098679" target="_blank">Jacomi <i>et al</i> (2014)</a>께서 Gephi의 사용을 위해 개발하셨습니다. forceAtlas2Based는 방정식 중 일부를 사용해 vis barnesHut 구현에 사용됩니다. 주요 차이점은 거리에 대한 중심 중력 모델이라는 점입니다. 또한 2D가 아닌 직선입니다. 마지막으로, 모든 Node의 weight는 연결된 Edge 개수의 1을 더한 값의 배수입니다.</td></tr>
<tr parent="forceAtlas2Based" class="hidden"><td class="indent">forceAtlas2Based.theta</td> <td>Number</td> <td><code>0.5</code></td> <td>TODO</td></tr>
<tr parent="forceAtlas2Based" class="hidden"><td class="indent">forceAtlas2Based.gravitationalConstant</td> <td>Number</td> <td><code>-50</code></td> <td>barnesHut과 비슷합니다. 연결성 또한 한 요소의 질량을 통해 고려됩니다. 저항을 더 강하게 하려면 값을 줄이십시오. (-1000, -2000)</td></tr>
<tr parent="forceAtlas2Based" class="hidden"><td class="indent">forceAtlas2Based.centralGravity</td> <td>Number</td> <td><code>0.01</code></td> <td>전체 Network를 중앙으로 다시 끌어 당기는 중앙 중력장치가 있습니다. 이것은 거리에 따라 달라지지 않습니다.</td></tr>
<tr parent="forceAtlas2Based" class="hidden"><td class="indent">forceAtlas2Based.springLength</td> <td>Number</td> <td><code>100</code></td> <td>Edge들은 스프링으로 모델링됩니다. 이 스프링의 길이는 나머지 길이입니다. </td></tr>
Expand Down
4 changes: 4 additions & 0 deletions docs/network/physics.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ <h3>Options</h3>
physics:{
enabled: true,
barnesHut: {
theta: 0.5,
gravitationalConstant: -2000,
centralGravity: 0.3,
springLength: 95,
Expand All @@ -99,6 +100,7 @@ <h3>Options</h3>
avoidOverlap: 0
},
forceAtlas2Based: {
theta: 0.5,
gravitationalConstant: -50,
centralGravity: 0.01,
springConstant: 0.08,
Expand Down Expand Up @@ -154,6 +156,7 @@ <h3>Options</h3>
<tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr>
<tr><td>enabled</td> <td>Boolean</td> <td><code>true</code></td> <td>Toggle the physics system on or off. This property is optional. If you define any of the options below and enabled is undefined, this will be set to true.</td></tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','barnesHut', this);"><td><span parent="barnesHut" class="right-caret"></span> barnesHut</td> <td>Object</td> <td><code>Object</code></td> <td>BarnesHut is a quadtree based gravity model. This is the fastest, default and recommended solver for non-hierarchical layouts.</td></tr>
<tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.theta</td> <td>Number</td> <td><code>0.5</code></td> <td>This parameter determines the boundary between consolidated long range forces and individual short range forces. To oversimplify higher values are faster but generate more errors, lower values are slower but with less errors.</td></tr>
<tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.gravitationalConstant</td> <td>Number</td> <td><code>-2000</code></td> <td>Gravity attracts. We like repulsion. So the value is negative. If you want the repulsion to be stronger, decrease the value (so -10000, -50000).</td></tr>
<tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.centralGravity</td> <td>Number</td> <td><code>0.3</code></td> <td>There is a central gravity attractor to pull the entire network back to the center.</td></tr>
<tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.springLength</td> <td>Number</td> <td><code>95</code></td> <td>The edges are modelled as springs. This springLength here is the rest length of the spring.</td></tr>
Expand All @@ -165,6 +168,7 @@ <h3>Options</h3>
by them and makes use of the barnesHut implementation in vis. The main differences are the central gravity model,
which is here distance independent, and the repulsion being linear instead of quadratic. Finally, all node masses have a
multiplier based on the amount of connected edges plus one.</td></tr>
<tr parent="forceAtlas2Based" class="hidden"><td class="indent">forceAtlas2Based.theta</td> <td>Number</td> <td><code>0.5</code></td> <td>This parameter determines the boundary between consolidated long range forces and individual short range forces. To oversimplify higher values are faster but generate more errors, lower values are slower but with less errors.</td></tr>
<tr parent="forceAtlas2Based" class="hidden"><td class="indent">forceAtlas2Based.gravitationalConstant</td> <td>Number</td> <td><code>-50</code></td> <td>This is similar to the barnesHut method except that the falloff is linear instead of quadratic. The connectivity is also taken into account as a factor of the mass. If you want the repulsion to be stronger, decrease the value (so -1000, -2000).</td></tr>
<tr parent="forceAtlas2Based" class="hidden"><td class="indent">forceAtlas2Based.centralGravity</td> <td>Number</td> <td><code>0.01</code></td> <td>There is a central gravity attractor to pull the entire network back to the center. This is not dependent on distance.</td></tr>
<tr parent="forceAtlas2Based" class="hidden"><td class="indent">forceAtlas2Based.springLength</td> <td>Number</td> <td><code>100</code></td> <td>The edges are modelled as springs. This springLength here is the rest length of the spring.</td></tr>
Expand Down
6 changes: 4 additions & 2 deletions lib/network/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ let allOptions = {
physics: {
enabled: { boolean: bool },
barnesHut: {
theta: { number },
gravitationalConstant: { number },
centralGravity: { number },
springLength: { number },
Expand All @@ -416,6 +417,7 @@ let allOptions = {
__type__: { object }
},
forceAtlas2Based: {
theta: { number },
gravitationalConstant: { number },
centralGravity: { number },
springLength: { number },
Expand Down Expand Up @@ -673,7 +675,7 @@ let configureOptions = {
physics: {
enabled: true,
barnesHut: {
//theta: [0.5, 0.1, 1, 0.05],
theta: [0.5, 0.1, 1, 0.05],
gravitationalConstant: [-2000, -30000, 0, 50],
centralGravity: [0.3, 0, 10, 0.05],
springLength: [95, 0, 500, 5],
Expand All @@ -682,7 +684,7 @@ let configureOptions = {
avoidOverlap: [0, 0, 1, 0.01]
},
forceAtlas2Based: {
//theta: [0.5, 0.1, 1, 0.05],
theta: [0.5, 0.1, 1, 0.05],
gravitationalConstant: [-50, -500, 0, 1],
centralGravity: [0.01, 0, 1, 0.005],
springLength: [95, 0, 500, 5],
Expand Down

0 comments on commit 2a27c40

Please sign in to comment.