Skip to content

Commit

Permalink
asd
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasdavis committed Jan 12, 2025
1 parent b3b79a2 commit fc4a25f
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions apps/registry/app/[username]/jobs-graph/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,6 @@ const formatTooltip = (jobInfo) => {
return parts.filter(Boolean).join('\n');
};

// Utility functions for vector similarity
const cosineSimilarity = (a, b) => {
if (!Array.isArray(a) || !Array.isArray(b)) {
console.log('Invalid vectors:', { a, b });
return 0;
}
if (a.length !== b.length) {
console.log('Vector length mismatch:', {
aLength: a.length,
bLength: b.length,
});
return 0;
}
const dotProduct = a.reduce((sum, _, i) => sum + a[i] * b[i], 0);
const magnitudeA = Math.sqrt(a.reduce((sum, val) => sum + val * val, 0));
const magnitudeB = Math.sqrt(b.reduce((sum, val) => sum + val * val, 0));
return dotProduct / (magnitudeA * magnitudeB);
};

const calculateCollisionRadius = (node) => {
// Replace this with your logic to determine node size
const nodeSize = node.size || 1; // Default size if not specified
Expand Down Expand Up @@ -321,21 +302,11 @@ export default function Jobs({ params }) {
forceCollide().radius((node) => calculateCollisionRadius(node)),
);

// Update link distance
// fg.d3Force(
// 'link',
// forceLink().distance((link) => {
// const sourceSize = link.source.size || 1;
// const targetSize = link.target.size || 1;
// const baseDistance = 150; // Base distance between nodes
// return baseDistance + sourceSize + targetSize;
// }),
// );
setIsInitialized(true);
}
}
}
}, []);
}, [isInitialized]);

const handleCanvasClick = useCallback(
(event) => {
Expand Down

0 comments on commit fc4a25f

Please sign in to comment.