Hasty Briefsbeta

Bilingual

Using LLM to Generate Data for D3.js Force Directed Graph (FDG)

a year ago
  • #Force-Directed Graph
  • #D3.js
  • #LLM
  • D3.js force-directed graphs visualize relationships between nodes (entities) and links (relationships).
  • Nodes represent entities (e.g., people, objects) and links show connections between them.
  • Google's Gemini model can generate nodes and links data based on prompts.
  • Install the GoogleGenerativeAI package via npm to use Gemini.
  • Use D3.js CDN for easy integration in front-end projects.
  • The `load_force_directed_graph` function renders the graph with customizable dimensions.
  • Nodes and links are generated from prompts using Gemini via a backend API.
  • Example prompt: 'identify relationships' for given ideas like 'lung cancer', 'tobacco'.
  • The backend processes the Gemini response to extract nodes and links.
  • The application is available on GitHub and can be experienced live.