I am trying to render a network map using a GEXF file in my application.
I am using ReactJS, with SigmaJS and graphology to handle the graphs. While simple graphs render fine, I am not able to parse graphs with multiple edges between the same nodes.
This is the function I’m using to load a graph (the GEXF string is hidden here):
import { useEffect } from "react";
import Graph from "graphology";
import { SigmaContainer, useLoadGraph } from "@react-sigma/core";
import { parse } from 'graphology-gexf';
const LoadGraph = () => {
const loadGraph = useLoadGraph();
useEffect(() => {
const graph = new Graph({ multi: true });
parse(`<?xml version="1.0" encoding="UTF-8"?>`, graph);
loadGraph(graph);
}, [loadGraph]);
return null;
};
I am getting an invalid constructor error: graphology-gexf/parser: invalid Graph constructor.
How do I correctly parse this file/string?