manim-web 0.3.6 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation/Animation.d.ts +16 -1
- package/dist/animation/Animation.d.ts.map +1 -1
- package/dist/animation/MasterTimeline.d.ts +70 -0
- package/dist/animation/MasterTimeline.d.ts.map +1 -0
- package/dist/animation/Timeline.d.ts +1 -1
- package/dist/animation/Timeline.d.ts.map +1 -1
- package/dist/animation/transform/ApplyTransforms.d.ts +91 -0
- package/dist/animation/transform/ApplyTransforms.d.ts.map +1 -0
- package/dist/animation/transform/FadeTransforms.d.ts +76 -0
- package/dist/animation/transform/FadeTransforms.d.ts.map +1 -0
- package/dist/animation/transform/MovementTransforms.d.ts +131 -0
- package/dist/animation/transform/MovementTransforms.d.ts.map +1 -0
- package/dist/animation/transform/SpecialTransforms.d.ts +158 -0
- package/dist/animation/transform/SpecialTransforms.d.ts.map +1 -0
- package/dist/animation/transform/TransformExtensions.d.ts +11 -430
- package/dist/animation/transform/TransformExtensions.d.ts.map +1 -1
- package/dist/animation/transform/index.d.ts +4 -1
- package/dist/animation/transform/index.d.ts.map +1 -1
- package/dist/core/Group.d.ts +4 -1
- package/dist/core/Group.d.ts.map +1 -1
- package/dist/core/InteractiveScene.d.ts.map +1 -1
- package/dist/core/LinearTransformationScene.d.ts +152 -0
- package/dist/core/LinearTransformationScene.d.ts.map +1 -0
- package/dist/core/Mobject.d.ts +26 -389
- package/dist/core/Mobject.d.ts.map +1 -1
- package/dist/core/MobjectPositioning.d.ts +32 -0
- package/dist/core/MobjectPositioning.d.ts.map +1 -0
- package/dist/core/MobjectState.d.ts +40 -0
- package/dist/core/MobjectState.d.ts.map +1 -0
- package/dist/core/MobjectTypes.d.ts +51 -0
- package/dist/core/MobjectTypes.d.ts.map +1 -0
- package/dist/core/MovingCameraScene.d.ts +77 -0
- package/dist/core/MovingCameraScene.d.ts.map +1 -0
- package/dist/core/Renderer.d.ts +5 -0
- package/dist/core/Renderer.d.ts.map +1 -1
- package/dist/core/Scene.d.ts +25 -0
- package/dist/core/Scene.d.ts.map +1 -1
- package/dist/core/SceneExtensions.d.ts +7 -654
- package/dist/core/SceneExtensions.d.ts.map +1 -1
- package/dist/core/StateManager.d.ts.map +1 -1
- package/dist/core/ThreeDScene.d.ts +199 -0
- package/dist/core/ThreeDScene.d.ts.map +1 -0
- package/dist/core/VMobject.d.ts +48 -200
- package/dist/core/VMobject.d.ts.map +1 -1
- package/dist/core/VMobjectCurves.d.ts +25 -0
- package/dist/core/VMobjectCurves.d.ts.map +1 -0
- package/dist/core/VMobjectGeometry.d.ts +84 -0
- package/dist/core/VMobjectGeometry.d.ts.map +1 -0
- package/dist/core/VMobjectRendering.d.ts +138 -0
- package/dist/core/VMobjectRendering.d.ts.map +1 -0
- package/dist/core/VectorScene.d.ts +106 -0
- package/dist/core/VectorScene.d.ts.map +1 -0
- package/dist/core/ZoomedScene.d.ts +151 -0
- package/dist/core/ZoomedScene.d.ts.map +1 -0
- package/dist/core/index.d.ts +6 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/export/GifExporter.d.ts +4 -3
- package/dist/export/GifExporter.d.ts.map +1 -1
- package/dist/export/VideoExporter.d.ts.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13424 -12758
- package/dist/integrations/react.js +322 -318
- package/dist/integrations/vue.js +316 -312
- package/dist/interaction/Clickable.d.ts.map +1 -1
- package/dist/interaction/Draggable.d.ts.map +1 -1
- package/dist/interaction/Hoverable.d.ts.map +1 -1
- package/dist/interaction/SelectionManager.d.ts.map +1 -1
- package/dist/mobjects/geometry/AnnularSector.d.ts +107 -0
- package/dist/mobjects/geometry/AnnularSector.d.ts.map +1 -0
- package/dist/mobjects/geometry/Annulus.d.ts +89 -0
- package/dist/mobjects/geometry/Annulus.d.ts.map +1 -0
- package/dist/mobjects/geometry/ArcPolygon.d.ts +74 -0
- package/dist/mobjects/geometry/ArcPolygon.d.ts.map +1 -0
- package/dist/mobjects/geometry/ArcShapes.d.ts +11 -657
- package/dist/mobjects/geometry/ArcShapes.d.ts.map +1 -1
- package/dist/mobjects/geometry/BooleanOperations.d.ts.map +1 -1
- package/dist/mobjects/geometry/CurvedArrow.d.ts +95 -0
- package/dist/mobjects/geometry/CurvedArrow.d.ts.map +1 -0
- package/dist/mobjects/geometry/CurvedDoubleArrow.d.ts +60 -0
- package/dist/mobjects/geometry/CurvedDoubleArrow.d.ts.map +1 -0
- package/dist/mobjects/geometry/Ellipse.d.ts +98 -0
- package/dist/mobjects/geometry/Ellipse.d.ts.map +1 -0
- package/dist/mobjects/geometry/Rectangle.d.ts +3 -3
- package/dist/mobjects/geometry/Rectangle.d.ts.map +1 -1
- package/dist/mobjects/geometry/Sector.d.ts +99 -0
- package/dist/mobjects/geometry/Sector.d.ts.map +1 -0
- package/dist/mobjects/geometry/ShapeMatchers.d.ts +5 -1
- package/dist/mobjects/geometry/ShapeMatchers.d.ts.map +1 -1
- package/dist/mobjects/geometry/TangentialArc.d.ts +58 -0
- package/dist/mobjects/geometry/TangentialArc.d.ts.map +1 -0
- package/dist/mobjects/geometry/index.d.ts +10 -3
- package/dist/mobjects/geometry/index.d.ts.map +1 -1
- package/dist/mobjects/graph/DiGraph.d.ts +26 -0
- package/dist/mobjects/graph/DiGraph.d.ts.map +1 -0
- package/dist/mobjects/graph/GenericGraph.d.ts +184 -0
- package/dist/mobjects/graph/GenericGraph.d.ts.map +1 -0
- package/dist/mobjects/graph/Graph.d.ts +10 -0
- package/dist/mobjects/graph/Graph.d.ts.map +1 -0
- package/dist/mobjects/graph/graphFactories.d.ts +49 -0
- package/dist/mobjects/graph/graphFactories.d.ts.map +1 -0
- package/dist/mobjects/graph/graphTypes.d.ts +110 -0
- package/dist/mobjects/graph/graphTypes.d.ts.map +1 -0
- package/dist/mobjects/graph/index.d.ts +6 -417
- package/dist/mobjects/graph/index.d.ts.map +1 -1
- package/dist/mobjects/graph/layoutAlgorithms.d.ts +11 -0
- package/dist/mobjects/graph/layoutAlgorithms.d.ts.map +1 -0
- package/dist/mobjects/graphing/FunctionGraph.d.ts.map +1 -1
- package/dist/mobjects/graphing/ParametricFunction.d.ts +1 -1
- package/dist/mobjects/graphing/ParametricFunction.d.ts.map +1 -1
- package/dist/mobjects/image/index.d.ts +2 -1
- package/dist/mobjects/image/index.d.ts.map +1 -1
- package/dist/mobjects/point/Mobject1D.d.ts +129 -0
- package/dist/mobjects/point/Mobject1D.d.ts.map +1 -0
- package/dist/mobjects/point/Mobject2D.d.ts +170 -0
- package/dist/mobjects/point/Mobject2D.d.ts.map +1 -0
- package/dist/mobjects/point/PGroup.d.ts +111 -0
- package/dist/mobjects/point/PGroup.d.ts.map +1 -0
- package/dist/mobjects/point/PMobject.d.ts +152 -0
- package/dist/mobjects/point/PMobject.d.ts.map +1 -0
- package/dist/mobjects/point/PointCloudDot.d.ts +98 -0
- package/dist/mobjects/point/PointCloudDot.d.ts.map +1 -0
- package/dist/mobjects/point/PointMobject.d.ts +62 -0
- package/dist/mobjects/point/PointMobject.d.ts.map +1 -0
- package/dist/mobjects/point/index.d.ts +7 -701
- package/dist/mobjects/point/index.d.ts.map +1 -1
- package/dist/mobjects/svg/Brace.d.ts.map +1 -1
- package/dist/mobjects/text/Code.d.ts +2 -39
- package/dist/mobjects/text/Code.d.ts.map +1 -1
- package/dist/mobjects/text/CodeHighlighting.d.ts +50 -0
- package/dist/mobjects/text/CodeHighlighting.d.ts.map +1 -0
- package/dist/mobjects/text/CodeLanguageData.d.ts +25 -0
- package/dist/mobjects/text/CodeLanguageData.d.ts.map +1 -0
- package/dist/mobjects/text/MathTex.d.ts +1 -0
- package/dist/mobjects/text/MathTex.d.ts.map +1 -1
- package/dist/mobjects/text/MathTexSVG.d.ts +2 -0
- package/dist/mobjects/text/MathTexSVG.d.ts.map +1 -1
- package/dist/mobjects/text/Variable.d.ts.map +1 -1
- package/dist/mobjects/text/katex-styles.d.ts.map +1 -1
- package/dist/player/Player.d.ts +85 -0
- package/dist/player/Player.d.ts.map +1 -0
- package/dist/player/PlayerController.d.ts +22 -0
- package/dist/player/PlayerController.d.ts.map +1 -0
- package/dist/player/PlayerUI.d.ts +70 -0
- package/dist/player/PlayerUI.d.ts.map +1 -0
- package/dist/player/index.d.ts +4 -0
- package/dist/player/index.d.ts.map +1 -0
- package/dist/utils/hungarian.d.ts.map +1 -1
- package/dist/utils/skeletonize.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { Mobject, Vector3Tuple } from '../../core/Mobject';
|
|
2
|
+
import { Dot } from '../geometry/Dot';
|
|
3
|
+
import { VertexId, EdgeTuple, LayoutType, VertexStyleOptions, EdgeStyleOptions, VertexConfig, EdgeConfig, LayoutConfig, GenericGraphOptions } from './graphTypes';
|
|
4
|
+
/**
|
|
5
|
+
* GenericGraph - Base class for graph visualization
|
|
6
|
+
*
|
|
7
|
+
* Provides the foundation for both directed and undirected graphs.
|
|
8
|
+
* Manages vertices and edges as Mobject children for animation support.
|
|
9
|
+
*/
|
|
10
|
+
import * as THREE from 'three';
|
|
11
|
+
export declare class GenericGraph extends Mobject {
|
|
12
|
+
/** List of vertex identifiers */
|
|
13
|
+
protected _vertices: VertexId[];
|
|
14
|
+
/** List of edges as [source, target] tuples */
|
|
15
|
+
protected _edges: EdgeTuple[];
|
|
16
|
+
/** Map of vertex id to position */
|
|
17
|
+
protected _positions: Map<VertexId, Vector3Tuple>;
|
|
18
|
+
/** Map of vertex id to Dot mobject */
|
|
19
|
+
protected _vertexMobjects: Map<VertexId, Dot>;
|
|
20
|
+
/** Map of edge key to Line/Arrow mobject */
|
|
21
|
+
protected _edgeMobjects: Map<string, Mobject>;
|
|
22
|
+
/** Layout configuration */
|
|
23
|
+
protected _layoutConfig: LayoutConfig;
|
|
24
|
+
/** Default vertex style */
|
|
25
|
+
protected _vertexStyle: VertexStyleOptions;
|
|
26
|
+
/** Default edge style */
|
|
27
|
+
protected _edgeStyle: EdgeStyleOptions;
|
|
28
|
+
/** Per-vertex configuration */
|
|
29
|
+
protected _vertexConfig: Map<VertexId, VertexConfig>;
|
|
30
|
+
/** Per-edge configuration */
|
|
31
|
+
protected _edgeConfig: Map<string, EdgeConfig>;
|
|
32
|
+
/** Whether this is a directed graph */
|
|
33
|
+
protected _directed: boolean;
|
|
34
|
+
/** Three.js group for this graph */
|
|
35
|
+
protected _group: THREE.Group | null;
|
|
36
|
+
constructor(options?: GenericGraphOptions);
|
|
37
|
+
/**
|
|
38
|
+
* Get edge key from vertex pair
|
|
39
|
+
*/
|
|
40
|
+
protected _getEdgeKey(source: VertexId, target: VertexId): string;
|
|
41
|
+
/**
|
|
42
|
+
* Compute vertex positions using the layout algorithm
|
|
43
|
+
*/
|
|
44
|
+
protected _computeLayout(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Create vertex and edge mobjects
|
|
47
|
+
*/
|
|
48
|
+
protected _createMobjects(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Create a single vertex mobject
|
|
51
|
+
*/
|
|
52
|
+
protected _createVertexMobject(v: VertexId): void;
|
|
53
|
+
/**
|
|
54
|
+
* Create a single edge mobject
|
|
55
|
+
*/
|
|
56
|
+
protected _createEdgeMobject(source: VertexId, target: VertexId): void;
|
|
57
|
+
/**
|
|
58
|
+
* Shorten an edge to not overlap with vertex circles
|
|
59
|
+
*/
|
|
60
|
+
protected _shortenEdge(start: Vector3Tuple, end: Vector3Tuple, radius: number): [Vector3Tuple, Vector3Tuple];
|
|
61
|
+
/**
|
|
62
|
+
* Add a vertex to the graph
|
|
63
|
+
* @param v - Vertex identifier
|
|
64
|
+
* @param config - Optional vertex configuration
|
|
65
|
+
* @returns this for chaining
|
|
66
|
+
*/
|
|
67
|
+
addVertex(v: VertexId, config?: VertexConfig): this;
|
|
68
|
+
/**
|
|
69
|
+
* Add multiple vertices to the graph
|
|
70
|
+
* @param vertices - Array of vertex identifiers
|
|
71
|
+
* @returns this for chaining
|
|
72
|
+
*/
|
|
73
|
+
addVertices(...vertices: VertexId[]): this;
|
|
74
|
+
/**
|
|
75
|
+
* Remove a vertex from the graph
|
|
76
|
+
* @param v - Vertex identifier
|
|
77
|
+
* @returns this for chaining
|
|
78
|
+
*/
|
|
79
|
+
removeVertex(v: VertexId): this;
|
|
80
|
+
/**
|
|
81
|
+
* Get all vertex identifiers
|
|
82
|
+
*/
|
|
83
|
+
getVertices(): VertexId[];
|
|
84
|
+
/**
|
|
85
|
+
* Get the number of vertices
|
|
86
|
+
*/
|
|
87
|
+
get numVertices(): number;
|
|
88
|
+
/**
|
|
89
|
+
* Check if the graph contains a vertex
|
|
90
|
+
*/
|
|
91
|
+
hasVertex(v: VertexId): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Get the Dot mobject for a vertex
|
|
94
|
+
*/
|
|
95
|
+
getVertexMobject(v: VertexId): Dot | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Get the position of a vertex
|
|
98
|
+
*/
|
|
99
|
+
getVertexPosition(v: VertexId): Vector3Tuple | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Set the position of a vertex
|
|
102
|
+
*/
|
|
103
|
+
setVertexPosition(v: VertexId, position: Vector3Tuple): this;
|
|
104
|
+
/**
|
|
105
|
+
* Get neighbors of a vertex (adjacent vertices)
|
|
106
|
+
*/
|
|
107
|
+
getNeighbors(v: VertexId): VertexId[];
|
|
108
|
+
/**
|
|
109
|
+
* Get the degree of a vertex (number of edges)
|
|
110
|
+
*/
|
|
111
|
+
getDegree(v: VertexId): number;
|
|
112
|
+
/**
|
|
113
|
+
* Add an edge to the graph
|
|
114
|
+
* @param source - Source vertex
|
|
115
|
+
* @param target - Target vertex
|
|
116
|
+
* @param config - Optional edge configuration
|
|
117
|
+
* @returns this for chaining
|
|
118
|
+
*/
|
|
119
|
+
addEdge(source: VertexId, target: VertexId, config?: EdgeConfig): this;
|
|
120
|
+
/**
|
|
121
|
+
* Add multiple edges to the graph
|
|
122
|
+
* @param edges - Array of [source, target] tuples
|
|
123
|
+
* @returns this for chaining
|
|
124
|
+
*/
|
|
125
|
+
addEdges(...edges: EdgeTuple[]): this;
|
|
126
|
+
/**
|
|
127
|
+
* Remove an edge from the graph
|
|
128
|
+
* @param source - Source vertex
|
|
129
|
+
* @param target - Target vertex
|
|
130
|
+
* @returns this for chaining
|
|
131
|
+
*/
|
|
132
|
+
removeEdge(source: VertexId, target: VertexId): this;
|
|
133
|
+
/**
|
|
134
|
+
* Get all edges
|
|
135
|
+
*/
|
|
136
|
+
getEdges(): EdgeTuple[];
|
|
137
|
+
/**
|
|
138
|
+
* Get the number of edges
|
|
139
|
+
*/
|
|
140
|
+
get numEdges(): number;
|
|
141
|
+
/**
|
|
142
|
+
* Check if the graph contains an edge
|
|
143
|
+
*/
|
|
144
|
+
hasEdge(source: VertexId, target: VertexId): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Get the Line/Arrow mobject for an edge
|
|
147
|
+
*/
|
|
148
|
+
getEdgeMobject(source: VertexId, target: VertexId): Mobject | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* Change the layout algorithm
|
|
151
|
+
* @param layout - Layout type or configuration
|
|
152
|
+
* @returns this for chaining
|
|
153
|
+
*/
|
|
154
|
+
setLayout(layout: LayoutType | LayoutConfig): this;
|
|
155
|
+
/**
|
|
156
|
+
* Get all vertex positions
|
|
157
|
+
*/
|
|
158
|
+
getPositions(): Map<VertexId, Vector3Tuple>;
|
|
159
|
+
/**
|
|
160
|
+
* Set the color of a specific vertex
|
|
161
|
+
*/
|
|
162
|
+
setVertexColor(v: VertexId, color: string): this;
|
|
163
|
+
/**
|
|
164
|
+
* Set the color of a specific edge
|
|
165
|
+
*/
|
|
166
|
+
setEdgeColor(source: VertexId, target: VertexId, color: string): this;
|
|
167
|
+
/**
|
|
168
|
+
* Highlight a path (sequence of vertices)
|
|
169
|
+
*/
|
|
170
|
+
highlightPath(path: VertexId[], vertexColor?: string, edgeColor?: string): this;
|
|
171
|
+
/**
|
|
172
|
+
* Reset all colors to default
|
|
173
|
+
*/
|
|
174
|
+
resetColors(): this;
|
|
175
|
+
/**
|
|
176
|
+
* Create the Three.js backing object
|
|
177
|
+
*/
|
|
178
|
+
protected _createThreeObject(): THREE.Object3D;
|
|
179
|
+
/**
|
|
180
|
+
* Create a copy of this graph
|
|
181
|
+
*/
|
|
182
|
+
protected _createCopy(): GenericGraph;
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=GenericGraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericGraph.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graph/GenericGraph.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAItC,OAAO,EACL,QAAQ,EACR,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAGtB,qBAAa,YAAa,SAAQ,OAAO;IACvC,iCAAiC;IACjC,SAAS,CAAC,SAAS,EAAE,QAAQ,EAAE,CAAM;IAErC,+CAA+C;IAC/C,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,CAAM;IAEnC,mCAAmC;IACnC,SAAS,CAAC,UAAU,EAAE,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAa;IAE9D,sCAAsC;IACtC,SAAS,CAAC,eAAe,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAa;IAE1D,4CAA4C;IAC5C,SAAS,CAAC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAa;IAE1D,2BAA2B;IAC3B,SAAS,CAAC,aAAa,EAAE,YAAY,CAA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C,QAAQ,EAAE,YAAY,CAAC;IAM3C;;OAEG;IACH,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAShD;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IASrE;;OAEG;IACH,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,WAAW,GAAE,MAAY,EAAE,SAAS,GAAE,MAAY,GAAG,IAAI;IAUzF;;OAEG;IACH,WAAW,IAAI,IAAI;IAmBnB;;OAEG;IACH,SAAS,CAAC,kBAAkB,IAAI,KAAK,CAAC,QAAQ;IAK9C;;OAEG;IACH,SAAS,CAAC,WAAW,IAAI,YAAY;CAStC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GenericGraphOptions } from './graphTypes';
|
|
2
|
+
import { GenericGraph } from './GenericGraph';
|
|
3
|
+
export declare class Graph extends GenericGraph {
|
|
4
|
+
constructor(options?: GenericGraphOptions);
|
|
5
|
+
/**
|
|
6
|
+
* Create a copy of this graph
|
|
7
|
+
*/
|
|
8
|
+
protected _createCopy(): Graph;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=Graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graph/Graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAa,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,qBAAa,KAAM,SAAQ,YAAY;gBACzB,OAAO,GAAE,mBAAwB;IAK7C;;OAEG;cACgB,WAAW,IAAI,KAAK;CASxC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { EdgeTuple, GenericGraphOptions } from './graphTypes';
|
|
2
|
+
import { Graph } from './Graph';
|
|
3
|
+
import { DiGraph } from './DiGraph';
|
|
4
|
+
/**
|
|
5
|
+
* Create a complete graph (all vertices connected)
|
|
6
|
+
* @param n - Number of vertices
|
|
7
|
+
* @returns A complete Graph with n vertices
|
|
8
|
+
*/
|
|
9
|
+
export declare function completeGraph(n: number, options?: Partial<GenericGraphOptions>): Graph;
|
|
10
|
+
/**
|
|
11
|
+
* Create a cycle graph (vertices in a ring)
|
|
12
|
+
* @param n - Number of vertices
|
|
13
|
+
* @returns A cycle Graph with n vertices
|
|
14
|
+
*/
|
|
15
|
+
export declare function cycleGraph(n: number, options?: Partial<GenericGraphOptions>): Graph;
|
|
16
|
+
/**
|
|
17
|
+
* Create a path graph (linear chain)
|
|
18
|
+
* @param n - Number of vertices
|
|
19
|
+
* @returns A path Graph with n vertices
|
|
20
|
+
*/
|
|
21
|
+
export declare function pathGraph(n: number, options?: Partial<GenericGraphOptions>): Graph;
|
|
22
|
+
/**
|
|
23
|
+
* Create a star graph (one central vertex connected to all others)
|
|
24
|
+
* @param n - Number of outer vertices (total vertices = n + 1)
|
|
25
|
+
* @returns A star Graph
|
|
26
|
+
*/
|
|
27
|
+
export declare function starGraph(n: number, options?: Partial<GenericGraphOptions>): Graph;
|
|
28
|
+
/**
|
|
29
|
+
* Create a binary tree
|
|
30
|
+
* @param depth - Depth of the tree
|
|
31
|
+
* @returns A binary tree DiGraph
|
|
32
|
+
*/
|
|
33
|
+
export declare function binaryTree(depth: number, options?: Partial<GenericGraphOptions>): DiGraph;
|
|
34
|
+
/**
|
|
35
|
+
* Create a grid graph
|
|
36
|
+
* @param rows - Number of rows
|
|
37
|
+
* @param cols - Number of columns
|
|
38
|
+
* @returns A grid Graph
|
|
39
|
+
*/
|
|
40
|
+
export declare function gridGraph(rows: number, cols: number, options?: Partial<GenericGraphOptions>): Graph;
|
|
41
|
+
/**
|
|
42
|
+
* Create a bipartite graph
|
|
43
|
+
* @param n1 - Number of vertices in first partition
|
|
44
|
+
* @param n2 - Number of vertices in second partition
|
|
45
|
+
* @param edges - Edges between partitions (optional, complete if not provided)
|
|
46
|
+
* @returns A bipartite Graph
|
|
47
|
+
*/
|
|
48
|
+
export declare function bipartiteGraph(n1: number, n2: number, edges?: EdgeTuple[], options?: Partial<GenericGraphOptions>): Graph;
|
|
49
|
+
//# sourceMappingURL=graphFactories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphFactories.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graph/graphFactories.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAY,SAAS,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,OAAO,CAAC,mBAAmB,CAAM,GAAG,KAAK,CAgB1F;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,OAAO,CAAC,mBAAmB,CAAM,GAAG,KAAK,CAUvF;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,OAAO,CAAC,mBAAmB,CAAM,GAAG,KAAK,CAmBtF;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,OAAO,CAAC,mBAAmB,CAAM,GAAG,KAAK,CAWtF;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,OAAO,CAAC,mBAAmB,CAAM,GAAG,OAAO,CA4B7F;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,OAAO,CAAC,mBAAmB,CAAM,GACzC,KAAK,CA4BP;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,EAAE,EACnB,OAAO,GAAE,OAAO,CAAC,mBAAmB,CAAM,GACzC,KAAK,CAqBP"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Vector3Tuple } from '../../core/Mobject';
|
|
2
|
+
/**
|
|
3
|
+
* Unique identifier for a vertex
|
|
4
|
+
*/
|
|
5
|
+
export type VertexId = string | number;
|
|
6
|
+
/**
|
|
7
|
+
* Edge definition as a tuple of [source, target]
|
|
8
|
+
*/
|
|
9
|
+
export type EdgeTuple = [VertexId, VertexId];
|
|
10
|
+
/**
|
|
11
|
+
* Layout algorithm types
|
|
12
|
+
*/
|
|
13
|
+
export type LayoutType = 'spring' | 'circular' | 'shell' | 'tree' | 'random' | 'grid' | 'kamada_kawai' | 'spectral' | 'bipartite' | 'custom';
|
|
14
|
+
/**
|
|
15
|
+
* Options for vertex styling
|
|
16
|
+
*/
|
|
17
|
+
export interface VertexStyleOptions {
|
|
18
|
+
/** Radius of the vertex dot. Default: 0.15 */
|
|
19
|
+
radius?: number;
|
|
20
|
+
/** Fill color of the vertex. Default: WHITE */
|
|
21
|
+
color?: string;
|
|
22
|
+
/** Fill opacity. Default: 1 */
|
|
23
|
+
fillOpacity?: number;
|
|
24
|
+
/** Stroke color for the vertex border. Default: same as color */
|
|
25
|
+
strokeColor?: string;
|
|
26
|
+
/** Stroke width. Default: 2 */
|
|
27
|
+
strokeWidth?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Options for edge styling
|
|
31
|
+
*/
|
|
32
|
+
export interface EdgeStyleOptions {
|
|
33
|
+
/** Color of the edge. Default: BLUE */
|
|
34
|
+
color?: string;
|
|
35
|
+
/** Stroke width of the edge. Default: 4 */
|
|
36
|
+
strokeWidth?: number;
|
|
37
|
+
/** For directed graphs, tip length. Default: 0.2 */
|
|
38
|
+
tipLength?: number;
|
|
39
|
+
/** For directed graphs, tip width. Default: 0.12 */
|
|
40
|
+
tipWidth?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Configuration for a single vertex
|
|
44
|
+
*/
|
|
45
|
+
export interface VertexConfig {
|
|
46
|
+
/** Position of the vertex (if using custom layout) */
|
|
47
|
+
position?: Vector3Tuple;
|
|
48
|
+
/** Custom styling for this vertex */
|
|
49
|
+
style?: VertexStyleOptions;
|
|
50
|
+
/** Label text to display next to the vertex */
|
|
51
|
+
label?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Configuration for a single edge
|
|
55
|
+
*/
|
|
56
|
+
export interface EdgeConfig {
|
|
57
|
+
/** Custom styling for this edge */
|
|
58
|
+
style?: EdgeStyleOptions;
|
|
59
|
+
/** Label text to display on the edge */
|
|
60
|
+
label?: string;
|
|
61
|
+
/** Weight of the edge (used by some layout algorithms) */
|
|
62
|
+
weight?: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Layout configuration options
|
|
66
|
+
*/
|
|
67
|
+
export interface LayoutConfig {
|
|
68
|
+
/** Type of layout algorithm */
|
|
69
|
+
type: LayoutType;
|
|
70
|
+
/** Scale factor for the layout. Default: 2 */
|
|
71
|
+
scale?: number;
|
|
72
|
+
/** Center point of the layout. Default: [0, 0, 0] */
|
|
73
|
+
center?: Vector3Tuple;
|
|
74
|
+
/** Number of iterations for force-directed layouts. Default: 50 */
|
|
75
|
+
iterations?: number;
|
|
76
|
+
/** For tree layout: root vertex */
|
|
77
|
+
root?: VertexId;
|
|
78
|
+
/** For bipartite layout: partition sets */
|
|
79
|
+
partition?: [VertexId[], VertexId[]];
|
|
80
|
+
/** Custom positions map for custom layout */
|
|
81
|
+
positions?: Map<VertexId, Vector3Tuple>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Options for creating a graph
|
|
85
|
+
*/
|
|
86
|
+
export interface GenericGraphOptions {
|
|
87
|
+
/** List of vertex identifiers */
|
|
88
|
+
vertices?: VertexId[];
|
|
89
|
+
/** List of edges as [source, target] tuples */
|
|
90
|
+
edges?: EdgeTuple[];
|
|
91
|
+
/** Layout configuration */
|
|
92
|
+
layout?: LayoutType | LayoutConfig;
|
|
93
|
+
/** Default vertex styling */
|
|
94
|
+
vertexStyle?: VertexStyleOptions;
|
|
95
|
+
/** Default edge styling */
|
|
96
|
+
edgeStyle?: EdgeStyleOptions;
|
|
97
|
+
/** Per-vertex configuration */
|
|
98
|
+
vertexConfig?: Map<VertexId, VertexConfig> | Record<string, VertexConfig>;
|
|
99
|
+
/** Per-edge configuration (key is "source-target") */
|
|
100
|
+
edgeConfig?: Map<string, EdgeConfig> | Record<string, EdgeConfig>;
|
|
101
|
+
/** Whether to show vertex labels. Default: false */
|
|
102
|
+
showLabels?: boolean;
|
|
103
|
+
/** Label font size. Default: 24 */
|
|
104
|
+
labelFontSize?: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Options for creating a directed graph
|
|
108
|
+
*/
|
|
109
|
+
export type DiGraphOptions = GenericGraphOptions;
|
|
110
|
+
//# sourceMappingURL=graphTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphTypes.d.ts","sourceRoot":"","sources":["../../../src/mobjects/graph/graphTypes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,UAAU,GACV,OAAO,GACP,MAAM,GACN,QAAQ,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