Graph Search
You can search for nodes and/or edges in the graph by using the package @react-sigma/graph-search
.
You need to install it
npm install @react-sigma/graph-search
This package also export a CSS file that must be imported :
import '@react-sigma/graph-search/lib/style.css';
Now you can use it the component GraphSearch like in this example :
Loading...
The graph index
Under the hood, this package is using minisearch. It build a minisearch index and keep it in sync with the graphology instance of sigma.
If you need it, you can use this index in your own component. To do this, you need to :
- Use the GraphSearchContextProvider in the children of SigmaContainer
- Use the hook useGraphSearch which return a search function.
Node & Edge display
This package also exposes components to display Node
and Edge
like they are displayed in the graph :
Those components must be used inside a SigmaContainer.