yangdx
commited on
Commit
·
8d47044
1
Parent(s):
af95aa1
Fix linting
Browse files
lightrag_webui/src/hooks/useLightragGraph.tsx
CHANGED
@@ -647,17 +647,17 @@ const useLightrangeGraph = () => {
|
|
647 |
// Get degree maxDegree from existing graph for size calculations
|
648 |
const minDegree = 1;
|
649 |
let maxDegree = 0;
|
650 |
-
|
651 |
// Initialize edge weight min and max values
|
652 |
let minWeight = Number.MAX_SAFE_INTEGER;
|
653 |
let maxWeight = 0;
|
654 |
-
|
655 |
// Calculate node degrees and edge weights from existing graph
|
656 |
sigmaGraph.forEachNode(node => {
|
657 |
const degree = sigmaGraph.degree(node);
|
658 |
maxDegree = Math.max(maxDegree, degree);
|
659 |
});
|
660 |
-
|
661 |
// Calculate edge weights from existing graph
|
662 |
sigmaGraph.forEachEdge(edge => {
|
663 |
const weight = sigmaGraph.getEdgeAttribute(edge, 'originalWeight') || 1;
|
@@ -756,7 +756,7 @@ const useLightrangeGraph = () => {
|
|
756 |
}
|
757 |
}
|
758 |
};
|
759 |
-
|
760 |
// Helper function to update edge sizes
|
761 |
const updateEdgeSizes = (
|
762 |
sigmaGraph: UndirectedGraph,
|
@@ -768,7 +768,7 @@ const useLightrangeGraph = () => {
|
|
768 |
const maxEdgeSize = useSettingsStore.getState().maxEdgeSize;
|
769 |
const weightRange = maxWeight - minWeight || 1; // Avoid division by zero
|
770 |
const sizeScale = maxEdgeSize - minEdgeSize;
|
771 |
-
|
772 |
sigmaGraph.forEachEdge(edge => {
|
773 |
const weight = sigmaGraph.getEdgeAttribute(edge, 'originalWeight') || 1;
|
774 |
const scaledSize = minEdgeSize + sizeScale * Math.pow((weight - minWeight) / weightRange, 0.5);
|
@@ -870,7 +870,7 @@ const useLightrangeGraph = () => {
|
|
870 |
|
871 |
// Get weight from edge properties or default to 1
|
872 |
const weight = newEdge.properties?.weight !== undefined ? Number(newEdge.properties.weight) : 1;
|
873 |
-
|
874 |
// Update min and max weight values
|
875 |
minWeight = Math.min(minWeight, weight);
|
876 |
maxWeight = Math.max(maxWeight, weight);
|
|
|
647 |
// Get degree maxDegree from existing graph for size calculations
|
648 |
const minDegree = 1;
|
649 |
let maxDegree = 0;
|
650 |
+
|
651 |
// Initialize edge weight min and max values
|
652 |
let minWeight = Number.MAX_SAFE_INTEGER;
|
653 |
let maxWeight = 0;
|
654 |
+
|
655 |
// Calculate node degrees and edge weights from existing graph
|
656 |
sigmaGraph.forEachNode(node => {
|
657 |
const degree = sigmaGraph.degree(node);
|
658 |
maxDegree = Math.max(maxDegree, degree);
|
659 |
});
|
660 |
+
|
661 |
// Calculate edge weights from existing graph
|
662 |
sigmaGraph.forEachEdge(edge => {
|
663 |
const weight = sigmaGraph.getEdgeAttribute(edge, 'originalWeight') || 1;
|
|
|
756 |
}
|
757 |
}
|
758 |
};
|
759 |
+
|
760 |
// Helper function to update edge sizes
|
761 |
const updateEdgeSizes = (
|
762 |
sigmaGraph: UndirectedGraph,
|
|
|
768 |
const maxEdgeSize = useSettingsStore.getState().maxEdgeSize;
|
769 |
const weightRange = maxWeight - minWeight || 1; // Avoid division by zero
|
770 |
const sizeScale = maxEdgeSize - minEdgeSize;
|
771 |
+
|
772 |
sigmaGraph.forEachEdge(edge => {
|
773 |
const weight = sigmaGraph.getEdgeAttribute(edge, 'originalWeight') || 1;
|
774 |
const scaledSize = minEdgeSize + sizeScale * Math.pow((weight - minWeight) / weightRange, 0.5);
|
|
|
870 |
|
871 |
// Get weight from edge properties or default to 1
|
872 |
const weight = newEdge.properties?.weight !== undefined ? Number(newEdge.properties.weight) : 1;
|
873 |
+
|
874 |
// Update min and max weight values
|
875 |
minWeight = Math.min(minWeight, weight);
|
876 |
maxWeight = Math.max(maxWeight, weight);
|