reagraph
Version:
WebGL Node-based Graph for React
94 lines (93 loc) • 2.56 kB
TypeScript
import { ClusterGroup } from '../utils/cluster';
import { DagMode } from './forceUtils';
import { FORCE_LAYOUTS } from './layoutProvider';
import { LayoutFactoryProps, LayoutStrategy } from './types';
export interface ForceDirectedLayoutInputs extends LayoutFactoryProps {
/**
* Center inertia for the layout.
*
* @default 1
*/
centerInertia?: number;
/**
* Number of dimensions for the layout. 2d or 3d.
*
* @default 2
*/
dimensions?: number;
/**
* Mode for the dag layout. Only applicable for dag layouts.
*
* @default null
*/
mode?: DagMode;
/**
* Distance between links.
*
* @default 50
*/
linkDistance?: number;
/**
* Strength of the node repulsion.
*
* @default -250
*/
nodeStrength?: number;
/**
* Strength of the cluster repulsion.
*
* @default 0.5
*/
clusterStrength?: number;
/**
* The clusters dragged position to reuse for the layout.
*/
clusters: Map<string, ClusterGroup>;
/**
* The type of clustering.
*
* @default 'force'
*/
clusterType?: 'force' | 'treemap';
/**
* Ratio of the distance between nodes on the same level.
*
* @default 2
*/
nodeLevelRatio?: number;
/**
* LinkStrength between nodes of different clusters
*
* @default 0.01
*/
linkStrengthInterCluster?: number | ((d: any) => number);
/**
* LinkStrength between nodes of the same cluster
*
* @default 0.5
*/
linkStrengthIntraCluster?: number | ((d: any) => number);
/**
* Charge between the meta-nodes (Force template only)
*
* @default 100
*/
forceLinkDistance?: number;
/**
* Used to compute the template force nodes size (Force template only)
*
* @default 0.1
*/
forceLinkStrength?: number;
/**
* Used to compute the template force nodes size (Force template only)
*
* @default -700
*/
forceCharge?: number;
/**
* Used to determine the simulation forceX and forceY values
*/
forceLayout: (typeof FORCE_LAYOUTS)[number];
}
export declare function forceDirected({ graph, nodeLevelRatio, mode, dimensions, nodeStrength, linkDistance, clusterStrength, linkStrengthInterCluster, linkStrengthIntraCluster, forceLinkDistance, forceLinkStrength, clusterType, forceCharge, getNodePosition, drags, clusters, clusterAttribute, forceLayout }: ForceDirectedLayoutInputs): LayoutStrategy;