graphology-layout-forceatlas2
Advanced tools
Comparing version 0.9.2 to 0.10.0
@@ -154,10 +154,12 @@ /** | ||
// Handling node mass through degree | ||
NodeMatrix[sj + 6] += 1; | ||
NodeMatrix[tj + 6] += 1; | ||
var weight = getEdgeWeight(edge, attr, source, target, sa, ta, u); | ||
// Incrementing mass to be a node's weighted degree | ||
NodeMatrix[sj + 6] += weight; | ||
NodeMatrix[tj + 6] += weight; | ||
// Populating byte array | ||
EdgeMatrix[j] = sj; | ||
EdgeMatrix[j + 1] = tj; | ||
EdgeMatrix[j + 2] = getEdgeWeight(edge, attr, source, target, sa, ta, u); | ||
EdgeMatrix[j + 2] = weight; | ||
j += PPE; | ||
@@ -164,0 +166,0 @@ }); |
@@ -66,4 +66,7 @@ import Graph, {Attributes, EdgeMapper} from 'graphology-types'; | ||
export function inferSettings(order: number): ForceAtlas2Settings; | ||
export function inferSettings(graph: Graph): ForceAtlas2Settings; | ||
declare const forceAtlas2: IForceAtlas2Layout; | ||
export default forceAtlas2; |
@@ -47,3 +47,5 @@ /** | ||
var getEdgeWeight = createEdgeWeightGetter(params.getEdgeWeight).fromEntry; | ||
var getEdgeWeight = createEdgeWeightGetter( | ||
'getEdgeWeight' in params ? params.getEdgeWeight : 'weight' | ||
).fromEntry; | ||
@@ -50,0 +52,0 @@ var outputReducer = |
{ | ||
"name": "graphology-layout-forceatlas2", | ||
"version": "0.9.2", | ||
"version": "0.10.0", | ||
"description": "ForceAtlas 2 layout algorithm for graphology.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -63,8 +63,6 @@ # Graphology ForceAtlas2 | ||
- **graph** _Graph_: target graph.attributes\*\* _?object_: an object containing custom attribute name mapping: | ||
- **weight** _?string_ [`weight`]: name of the edge weight attribute. | ||
- **weighted** _?boolean_ [`false`]: whether to consider edge weight. | ||
- **graph** _Graph_: target graph. | ||
- **options** _object_: options: | ||
- **iterations** _number_: number of iterations to perform. | ||
- **getEdgeWeight** _?string\|function_: name of the edge weight attribute or getter function. Defaults to unweighted layout. | ||
- **getEdgeWeight** _?string\|function_ [`weight`]: name of the edge weight attribute or getter function. Defaults to `weight`. | ||
- **settings** _?object_: the layout's settings (see [#settings](#settings)). | ||
@@ -83,4 +81,3 @@ | ||
const layout = new FA2Layout(graph, { | ||
settings: {gravity: 1}, | ||
getEdgeWeight: 'weight' | ||
settings: {gravity: 1} | ||
}); | ||
@@ -87,0 +84,0 @@ |
@@ -33,3 +33,5 @@ /** | ||
var getEdgeWeight = createEdgeWeightGetter(params.getEdgeWeight).fromEntry; | ||
var getEdgeWeight = createEdgeWeightGetter( | ||
'getEdgeWeight' in params ? params.getEdgeWeight : 'weight' | ||
).fromEntry; | ||
@@ -36,0 +38,0 @@ // Validating settings |
78790
1965
114