Fix linting

This commit is contained in:
yangdx
2025-04-07 01:18:18 +08:00
parent ad96bed7ac
commit 0261ebcf51

View File

@@ -647,17 +647,17 @@ const useLightrangeGraph = () => {
// Get degree maxDegree from existing graph for size calculations // Get degree maxDegree from existing graph for size calculations
const minDegree = 1; const minDegree = 1;
let maxDegree = 0; let maxDegree = 0;
// Initialize edge weight min and max values // Initialize edge weight min and max values
let minWeight = Number.MAX_SAFE_INTEGER; let minWeight = Number.MAX_SAFE_INTEGER;
let maxWeight = 0; let maxWeight = 0;
// Calculate node degrees and edge weights from existing graph // Calculate node degrees and edge weights from existing graph
sigmaGraph.forEachNode(node => { sigmaGraph.forEachNode(node => {
const degree = sigmaGraph.degree(node); const degree = sigmaGraph.degree(node);
maxDegree = Math.max(maxDegree, degree); maxDegree = Math.max(maxDegree, degree);
}); });
// Calculate edge weights from existing graph // Calculate edge weights from existing graph
sigmaGraph.forEachEdge(edge => { sigmaGraph.forEachEdge(edge => {
const weight = sigmaGraph.getEdgeAttribute(edge, 'originalWeight') || 1; const weight = sigmaGraph.getEdgeAttribute(edge, 'originalWeight') || 1;
@@ -756,7 +756,7 @@ const useLightrangeGraph = () => {
} }
} }
}; };
// Helper function to update edge sizes // Helper function to update edge sizes
const updateEdgeSizes = ( const updateEdgeSizes = (
sigmaGraph: UndirectedGraph, sigmaGraph: UndirectedGraph,
@@ -768,7 +768,7 @@ const useLightrangeGraph = () => {
const maxEdgeSize = useSettingsStore.getState().maxEdgeSize; const maxEdgeSize = useSettingsStore.getState().maxEdgeSize;
const weightRange = maxWeight - minWeight || 1; // Avoid division by zero const weightRange = maxWeight - minWeight || 1; // Avoid division by zero
const sizeScale = maxEdgeSize - minEdgeSize; const sizeScale = maxEdgeSize - minEdgeSize;
sigmaGraph.forEachEdge(edge => { sigmaGraph.forEachEdge(edge => {
const weight = sigmaGraph.getEdgeAttribute(edge, 'originalWeight') || 1; const weight = sigmaGraph.getEdgeAttribute(edge, 'originalWeight') || 1;
const scaledSize = minEdgeSize + sizeScale * Math.pow((weight - minWeight) / weightRange, 0.5); const scaledSize = minEdgeSize + sizeScale * Math.pow((weight - minWeight) / weightRange, 0.5);
@@ -870,7 +870,7 @@ const useLightrangeGraph = () => {
// Get weight from edge properties or default to 1 // Get weight from edge properties or default to 1
const weight = newEdge.properties?.weight !== undefined ? Number(newEdge.properties.weight) : 1; const weight = newEdge.properties?.weight !== undefined ? Number(newEdge.properties.weight) : 1;
// Update min and max weight values // Update min and max weight values
minWeight = Math.min(minWeight, weight); minWeight = Math.min(minWeight, weight);
maxWeight = Math.max(maxWeight, weight); maxWeight = Math.max(maxWeight, weight);