logo

G6

  • Docs
  • API
  • Playground
  • Community
  • Productsantv logo arrow
  • 5.0.47
  • Introduction
  • Data
  • Getting Started
    • Quick Start
    • Installation
    • Integration
      • react
      • vue
      • angular
    • Step-by-step guide
  • Graph
    • Extensions En
    • Graph
    • Options
    • extension
  • Element
    • Element Overview
    • Element State
    • Node
      • Node Overview
      • Build-in Node
        • Common Node Configurations
        • Diamond
        • Donut
        • Ellipse
        • Hexagon
        • Html
        • Image
        • Rect
        • Star
        • Triangle
        • Circle
      • Custom Node
      • Define Nodes with React
    • Edge
      • Edge Overview
      • Build-in Edge
        • Common Edge Configurations
        • Cubic Bezier Curve
        • CubicHorizontal Bezier Curve
        • CubicVertical Bezier Curve
        • Line
        • Polyline
        • Quadratic Bezier Curve
      • Custom Edge
    • Combo
      • Combo Overview
      • Build-in Combo
        • Circle
        • Combo Configuration Options
        • Rect
      • Custom Combo
    • Shape
      • Shape and KeyShape
      • Atomic Shapes and Their Properties
      • Design and Implementation of Composite Shape
  • Layout
    • Layout Overview
    • Build-in Layout
      • 3D Force-Directed Layout
      • AntvDagre Layout
      • Circular Layout
      • ComboCombined Layout
      • Common Layout Configuration Options
      • CompactBox
      • Concentric Layout
      • D3 Force-Directed Layout
      • Dagre Layout
      • Dendrogram Layout
      • Fishbone Layout
      • Force Force-directed Layout
      • ForceAtlas2 Force-directed Layout
      • Fruchterman Force-directed Layout
      • Grid Layout
      • Indented Tree
      • MDS High-dimensional Data Dimensionality Reduction Layout
      • Mindmap Tree
      • Radial Layout
      • Random Layout
      • Snake Layout
    • Custom Layout
  • Behavior
    • Behavior Overview
    • Build-in Behavior
      • AutoAdaptLabel
      • BrushSelect
      • ClickSelect
      • CollapseExpand
      • CreateEdge
      • DragCanvas
      • DragElement
      • DragElementForce
      • FixElementSize
      • FocusElement
      • HoverActivate
      • LassoSelect
      • OptimizeViewportTransform
      • ScrollCanvas
      • ZoomCanvas
    • Custom Behavior
  • Plugin
    • Plugin Overview
    • Build-in Plugin
      • Background
      • BubbleSets
      • Contextmenu
      • EdgeBundling
      • EdgeFilterLens
      • Fisheye
      • Fullscreen
      • GridLine
      • History
      • Hull
      • Legend
      • Minimap
      • Snapline
      • Timebar
      • Toolbar
      • Tooltip
      • Watermark
    • Custom Plugin
  • Transform
    • Data Transformation Overview
    • Build-in Transform
      • MapNodeSize
      • PlaceRadialLabels
      • ProcessParallelEdges
    • Custom Transform
  • Theme
    • Theme Overview
    • Custom Theme
    • Palette
    • Custom Palette
  • Animation
    • Animation Overview
    • Custom Animation
  • Further Reading
    • Event
    • renderer
    • coordinate
    • download-image
    • Using Iconfont
    • Use 3D
    • Bundle Project
  • What's new
    • Feature
    • Upgrade To 5.0
  • FAQ
  • contribute

Graph

Previous
Extensions En
Next
Options

Resources

Ant Design
Galacea Effects
Umi-React Application Framework
Dumi-Component doc generator
ahooks-React Hooks Library

Community

Ant Financial Experience Tech
seeconfSEE Conf-Experience Tech Conference

Help

GitHub
StackOverflow

more productsMore Productions

Ant DesignAnt Design-Enterprise UI design language
yuqueYuque-Knowledge creation and Sharing tool
EggEgg-Enterprise-class Node development framework
kitchenKitchen-Sketch Tool set
GalaceanGalacean-互动图形解决方案
xtechLiven Experience technology
© Copyright 2025 Ant Group Co., Ltd..备案号:京ICP备15032932号-38

Loading...

Overview

Definition of Graph

In Chinese, the character "图" (Graph) can often be used to represent many different concepts, such as image,shape,and chart or diagram,etc.

In Graph Theory, a graph is a mathematical structure used to model pairwise relationships between objects, which we typically represent with nodes (or Vertex) and edges (or Link) to denote the objects and the relationships between them.

The "graph" in G6:

  • Conceptually, it is the "graph" from Graph Theory, a data structure composed of nodes and edges.
  • Visually, a "graph" is a figure composed of a set of graphical elements representing nodes and edges.
  • In terms of code implementation, a "graph" is a class capable of transforming data into a graphical display.

Types of Graph

Graph Theory categorizes graphs into many different types based on their structure and properties, such as:

  • Directed Graph and Undirected Graph
  • Weighted Graph and Unweighted Graph
  • Simple Graph and Multigraph
  • Cyclic Graph and Acyclic Graph
  • Connected Graph and Disconnected Graph
  • Complete Graph and Non-Complete Graph
  • Sparse Graph and Dense Graph
  • ...

In G6, we provide a universal graph representation capable of depicting the various types of graphs mentioned above, for example:

  • Directed Graph and Undirected Graph: Defined by the start and end points of the edges.
  • Weighted Graph and Unweighted Graph: Defined by the weight data on the edges.
  • Simple Graph and Multigraph: Defined by the uniqueness of the edges.
  • ...

Use Scenarios

Graphs are a very versatile data structure that can be used to represent a variety of scenarios, such as:

  • Social Networks
  • Knowledge Graphs
  • Traffic Networks
  • Power Grids

In G6, we provide a rich expression capability for graphs that can meet the needs of different scenarios. We also offer a wealth of interactive and animated effects to make the graphs more vivid and intuitive.

Use G6 Graph

To create a Graph with G6, you first need to import the @antv/g6 library, and then instantiate the Graph class.

For installation instructions, refer to: Getting Started - Installation

The Graph class accepts an instantiation argument object, known as options (Options, in visualization theory it is referred to as: Specification), which is used to configure the graph's data, element styles, layout, interactions, etc.

import { Graph } from '@antv/g6';
const graph = new Graph({
container: 'container',
width: 800,
height: 600,
// ... other other options
});

note

The instantiation process only configures the basic information of the graph. To render the graph onto the page, you still need to call the render method.

  • To learn how to quickly create a graph, please refer to Quick Start.
  • For more detailed information about the configuration options, please refer to Options.
  • To gain an in-depth understanding of the concepts within the configuration options, please read the rest of the content in this section.