import { useMemo } from 'react'; import { IconButton, Tooltip } from '@mui/material'; import RefreshIcon from '@mui/icons-material/Refresh'; import WarningIcon from '@mui/icons-material/Warning'; import InfoIcon from '@mui/icons-material/Info'; import BarChartIcon from '@mui/icons-material/BarChart'; import { calculateGraphMetrics } from '../../utils/graphAnalysis'; import type { Actor, Relation } from '../../types'; interface GraphMetricsProps { nodes: Actor[]; edges: Relation[]; onActorClick?: (actorId: string) => void; } /** * GraphMetrics - Display graph analysis and statistics * * Shows when no node or edge is selected in the right panel. * Provides insights into graph structure, connectivity, and key actors. */ const GraphMetrics = ({ nodes, edges, onActorClick }: GraphMetricsProps) => { // Calculate all metrics (memoized for performance) const metrics = useMemo(() => { return calculateGraphMetrics(nodes, edges); }, [nodes, edges]); const handleRefresh = () => { // Metrics are automatically recalculated via useMemo // This is just for visual feedback console.log('Metrics refreshed'); }; const formatNumber = (num: number, decimals: number = 2): string => { return num.toFixed(decimals); }; const formatPercentage = (num: number): string => { return `${(num * 100).toFixed(1)}%`; }; return (
No Data
Add actors to see graph metrics