Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Infiniflow Ragflow KnowledgeGraphUtil

From Leeroopedia
Revision as of 11:21, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Infiniflow_Ragflow_KnowledgeGraphUtil.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Frontend, Knowledge_Base
Last Updated 2026-02-12 06:00 GMT

Overview

Graph algorithms for node classification into combos based on edge relationships and community membership.

Description

This utility module provides two approaches for graph node grouping. The Converter class uses a KeyGenerator (sequential a-z keys) and buildDict to classify connected nodes into the same combo by iterating edges and propagating group assignments. The standalone buildNodesAndCombos function takes a different approach: it groups nodes by their first communities array entry, creating combos with UUID identifiers. If no communities exist, a defaultCombo with the defaultComboLabel is created. isDataExist validates graph data presence. KeyGenerator produces sequential alphabetical keys for combo identification.

Usage

Used by ForceGraph to pre-process raw graph data into the nodes+combos structure required by @antv/g6's combo-combined layout.

Code Reference

Source Location

Signature

export const defaultComboLabel = 'defaultCombo';

export class Converter {
  buildDict(edges: { source: string; target: string }[]): Record<string, string>;
  buildNodesAndCombos(nodes: any[], edges: any[]): { nodes: any[]; combos: any[] };
}

export const isDataExist = (data: any) => boolean;
export const buildNodesAndCombos = (nodes: any[]) => { nodes: any[]; combos: any[] };

Import

import { buildNodesAndCombos, defaultComboLabel, isDataExist } from './util';

I/O Contract

Inputs

Name Type Required Description
nodes any[] Yes Graph nodes with optional communities array
edges array Yes (for Converter) Edge list with source/target

Outputs

Name Type Description
nodes any[] Nodes augmented with combo assignment
combos any[] Combo definitions with id and label

Usage Examples

import { buildNodesAndCombos } from './util';

const { nodes, combos } = buildNodesAndCombos(graphData.nodes);
// Pass to @antv/g6 Graph.setData({ nodes, edges, combos })

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment