Skip to main content

Function: useLoadGraph()

useLoadGraph<N, E, G>(): (graph, clear?) => void

React hook that helps you to load a graph. If a graph was previously loaded in Sigma/Graphology, per default it is cleared. You can change this behaviour by settings the parameter clear to false.

const loadGraph = useLoadGraph();
...
useEffect(() => {
loadGraph(erdosRenyi(UndirectedGraph, { order: 100, probability: 0.2 }), true);
}, []);

Type Parameters

N extends Attributes = Attributes

E extends Attributes = Attributes

G extends Attributes = Attributes

Returns

Function

Parameters

graph: Graph<N, E, G>

clear?: boolean

Returns

void

Defined in

packages/core/src/hooks/useLoadGraph.ts:21