<div id="sigma-container"></div>
import Sigma from "sigma";
import { extremityArrow, layerPlain, pathCurved, pathLine, pathLoop } from "sigma/rendering";
import { DEFAULT_STYLES } from "sigma/types";
import { getSmallGraph } from "../_data/small-graph";
const container = document.getElementById("sigma-container") as HTMLElement;
const graph = getSmallGraph({ multi: true, type: "mixed" });
// Add parallel edges to showcase the feature:
// Multiple directed edges, same direction (a -> b already exists)
graph.addDirectedEdge("a", "b", { size: 3, color: "#F6903D", head: "arrow" });
graph.addDirectedEdge("a", "b", { size: 3, color: "#FACC14", head: "arrow" });
// Directed edges in both directions (c -> e already exists, add e -> c)
graph.addDirectedEdge("e", "c", { size: 3, color: "#61DDAA", head: "arrow" });
// Undirected parallel edges
graph.addUndirectedEdge("d", "e", { size: 3, color: "#78D3F8" });
graph.addUndirectedEdge("d", "e", { size: 3, color: "#247BA0" });
new Sigma(graph, container, {
paths: [pathLine(), pathCurved(), pathLoop()],
extremities: [extremityArrow()],
color: { attribute: "color" },
size: { attribute: "size" },
color: { attribute: "color" },
size: { attribute: "size" },
head: { attribute: "head" },
itemSizesReference: "positions",