ts-graphviz 1.0.0 → 1.0.1
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/README.ja.md +14 -7
- package/README.md +14 -7
- package/lib/ast/index.cjs +543 -527
- package/lib/ast/index.d.ts +215 -49
- package/lib/ast/index.js +543 -527
- package/lib/common/index.cjs +8 -0
- package/lib/common/index.d.ts +195 -6
- package/lib/common/index.js +8 -0
- package/lib/core/index.cjs +58 -113
- package/lib/core/index.d.ts +64 -347
- package/lib/core/index.js +58 -113
- package/package.json +3 -3
package/lib/core/index.d.ts
CHANGED
|
@@ -28,8 +28,11 @@ import {
|
|
|
28
28
|
GraphAttributesObject,
|
|
29
29
|
DotObjectModel,
|
|
30
30
|
} from '#lib/common';
|
|
31
|
-
import {
|
|
31
|
+
import { ConvertFromModelOptions, PrintOptions } from '#lib/ast';
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* @group Attribute
|
|
35
|
+
*/
|
|
33
36
|
interface AttributeKeyDict {
|
|
34
37
|
/**
|
|
35
38
|
* Factor damping force motions.
|
|
@@ -2510,27 +2513,26 @@ interface AttributeKeyDict {
|
|
|
2510
2513
|
*/
|
|
2511
2514
|
z: 'z';
|
|
2512
2515
|
}
|
|
2513
|
-
declare const attribute: AttributeKeyDict;
|
|
2514
|
-
|
|
2515
2516
|
/**
|
|
2516
|
-
*
|
|
2517
|
+
* @group Attribute
|
|
2517
2518
|
*/
|
|
2518
|
-
declare
|
|
2519
|
+
declare const attribute: AttributeKeyDict;
|
|
2520
|
+
|
|
2519
2521
|
/**
|
|
2520
|
-
*
|
|
2522
|
+
* Base class for DOT objects.
|
|
2523
|
+
* @group Models
|
|
2521
2524
|
*/
|
|
2522
|
-
declare abstract class DotObject
|
|
2525
|
+
declare abstract class DotObject {}
|
|
2523
2526
|
/**
|
|
2527
|
+
* Base class for DOT objects with attributes.
|
|
2528
|
+
* @group Models
|
|
2524
2529
|
*/
|
|
2525
2530
|
declare abstract class AttributesBase<T extends AttributeKey> extends DotObject implements Attributes<T> {
|
|
2526
2531
|
#private;
|
|
2527
2532
|
constructor(attributes?: AttributesObject<T>);
|
|
2528
2533
|
get values(): ReadonlyArray<[T, Attribute<T>]>;
|
|
2529
|
-
/** The size of the attribute. */
|
|
2530
2534
|
get size(): number;
|
|
2531
|
-
/** The size of the attribute. */
|
|
2532
2535
|
get(key: T): Attribute<T> | undefined;
|
|
2533
|
-
/** Set a value to the attribute. */
|
|
2534
2536
|
set(key: T, value: Attribute<T>): void;
|
|
2535
2537
|
delete(key: T): void;
|
|
2536
2538
|
apply(attributes: AttributesObject<T> | AttributesEntities<T>): void;
|
|
@@ -2538,13 +2540,14 @@ declare abstract class AttributesBase<T extends AttributeKey> extends DotObject
|
|
|
2538
2540
|
}
|
|
2539
2541
|
/**
|
|
2540
2542
|
* A set of attribute values for any object.
|
|
2543
|
+
* @group Models
|
|
2541
2544
|
*/
|
|
2542
2545
|
declare class AttributesGroupModel<T extends AttributeKey = AttributeKey> extends AttributesBase<T> {
|
|
2543
|
-
/** Comments to include when outputting with toDot. */
|
|
2544
2546
|
comment?: string;
|
|
2545
2547
|
}
|
|
2546
2548
|
/**
|
|
2547
2549
|
* A set of attribute values for any object.
|
|
2550
|
+
* @group Models
|
|
2548
2551
|
*/
|
|
2549
2552
|
declare class AttributeList<K extends AttributeListKind, T extends AttributeKey = AttributeKey>
|
|
2550
2553
|
extends AttributesBase<T>
|
|
@@ -2552,362 +2555,55 @@ declare class AttributeList<K extends AttributeListKind, T extends AttributeKey
|
|
|
2552
2555
|
{
|
|
2553
2556
|
$$kind: K;
|
|
2554
2557
|
get $$type(): 'AttributeList';
|
|
2555
|
-
/** Comments to include when outputting with toDot. */
|
|
2556
2558
|
comment?: string;
|
|
2557
2559
|
constructor($$kind: K, attributes?: AttributesObject<T>);
|
|
2558
2560
|
}
|
|
2559
2561
|
/**
|
|
2560
|
-
* Base class for
|
|
2561
|
-
* @
|
|
2562
|
+
* Base class for Graph objects.
|
|
2563
|
+
* @group Models
|
|
2562
2564
|
*/
|
|
2563
2565
|
declare abstract class GraphBase<T extends AttributeKey> extends AttributesBase<T> implements GraphBaseModel<T> {
|
|
2564
2566
|
#private;
|
|
2565
|
-
/** Cluster ID */
|
|
2566
2567
|
readonly id?: string;
|
|
2567
|
-
/** Comments to include when outputting with toDot. */
|
|
2568
2568
|
comment?: string;
|
|
2569
|
-
/** Common attributes of objects in the cluster. */
|
|
2570
2569
|
abstract readonly attributes: Readonly<GraphCommonAttributes>;
|
|
2571
|
-
/**
|
|
2572
|
-
* Nodes in the cluster.
|
|
2573
|
-
* @hidden
|
|
2574
|
-
*/
|
|
2575
2570
|
get nodes(): ReadonlyArray<NodeModel>;
|
|
2576
|
-
/**
|
|
2577
|
-
* Edges in the cluster.
|
|
2578
|
-
* @hidden
|
|
2579
|
-
*/
|
|
2580
2571
|
get edges(): ReadonlyArray<EdgeModel>;
|
|
2581
|
-
/**
|
|
2582
|
-
* Subgraphs in the cluster.
|
|
2583
|
-
* @hidden
|
|
2584
|
-
*/
|
|
2585
2572
|
get subgraphs(): ReadonlyArray<SubgraphModel>;
|
|
2586
|
-
/**
|
|
2587
|
-
* Add a Node to the cluster.
|
|
2588
|
-
*/
|
|
2589
2573
|
addNode(node: NodeModel): void;
|
|
2590
|
-
/**
|
|
2591
|
-
* Add Edge to the cluster.
|
|
2592
|
-
*/
|
|
2593
2574
|
addEdge(edge: EdgeModel): void;
|
|
2594
|
-
/**
|
|
2595
|
-
* Add a Subgraph to the cluster.
|
|
2596
|
-
*/
|
|
2597
2575
|
addSubgraph(subgraph: SubgraphModel): void;
|
|
2598
|
-
/**
|
|
2599
|
-
* Check if the Node exists in the cluster.
|
|
2600
|
-
*/
|
|
2601
2576
|
existNode(nodeId: string): boolean;
|
|
2602
|
-
/**
|
|
2603
|
-
* Check if the Edge exists in the cluster.
|
|
2604
|
-
*/
|
|
2605
2577
|
existEdge(edge: EdgeModel): boolean;
|
|
2606
|
-
/**
|
|
2607
|
-
* Check if the Subgraph exists in the cluster.
|
|
2608
|
-
*/
|
|
2609
2578
|
existSubgraph(subgraph: SubgraphModel): boolean;
|
|
2610
|
-
/**
|
|
2611
|
-
* Create a Subgraph and add it to the cluster.
|
|
2612
|
-
*/
|
|
2613
2579
|
createSubgraph(id?: string, attributes?: SubgraphAttributesObject): SubgraphModel;
|
|
2614
2580
|
createSubgraph(attributes?: SubgraphAttributesObject): SubgraphModel;
|
|
2615
|
-
/**
|
|
2616
|
-
* Remove Node from the cluster.
|
|
2617
|
-
*/
|
|
2618
2581
|
removeNode(node: NodeModel | string): void;
|
|
2619
|
-
/**
|
|
2620
|
-
* Remove Edge from the cluster.
|
|
2621
|
-
*/
|
|
2622
2582
|
removeEdge(edge: EdgeModel): void;
|
|
2623
|
-
/**
|
|
2624
|
-
* Remove Subgraph from the cluster.
|
|
2625
|
-
*/
|
|
2626
2583
|
removeSubgraph(subgraph: SubgraphModel): void;
|
|
2627
|
-
/**
|
|
2628
|
-
* Create a Node in the cluster.
|
|
2629
|
-
*/
|
|
2630
2584
|
createNode(id: string, attributes?: NodeAttributesObject): NodeModel;
|
|
2631
|
-
/**
|
|
2632
|
-
* Get Subgraph in cluster by specifying id.
|
|
2633
|
-
*
|
|
2634
|
-
* If there is no Subgraph with the specified id in the cluster, return undefined.
|
|
2635
|
-
*/
|
|
2636
2585
|
getSubgraph(id: string): SubgraphModel | undefined;
|
|
2637
|
-
/**EdgeAttributesObject
|
|
2638
|
-
* Get Node in cluster by specifying id.
|
|
2639
|
-
*
|
|
2640
|
-
* @description
|
|
2641
|
-
* If there is no Node with the specified id in the cluster, return undefined.
|
|
2642
|
-
*/
|
|
2643
2586
|
getNode(id: string): NodeModel | undefined;
|
|
2644
|
-
/** Create Edge and add it to the cluster. */
|
|
2645
2587
|
createEdge(targets: EdgeTargetLikeTuple, attributes?: EdgeAttributesObject): EdgeModel;
|
|
2646
|
-
/**
|
|
2647
|
-
* Create a subgraph by specifying its id (or get it if it already exists).
|
|
2648
|
-
*
|
|
2649
|
-
* By specifying a callback function, the target subgraph can be received and manipulated as an argument.
|
|
2650
|
-
*
|
|
2651
|
-
* ```ts
|
|
2652
|
-
* const G = digraph('G', (g) => {
|
|
2653
|
-
* // Create a cluster with id as A.
|
|
2654
|
-
* g.subgraph('A', (A) => {
|
|
2655
|
-
* // Create a node with id as A1 in cluster A.
|
|
2656
|
-
* A.node('A1');
|
|
2657
|
-
* });
|
|
2658
|
-
* });
|
|
2659
|
-
*
|
|
2660
|
-
* console.log(toDot(G));
|
|
2661
|
-
* // digraph "G" {
|
|
2662
|
-
* // subgraph "A" {
|
|
2663
|
-
* // "A1";
|
|
2664
|
-
* // }
|
|
2665
|
-
* // }
|
|
2666
|
-
* ```
|
|
2667
|
-
*
|
|
2668
|
-
* @param id Subgraph ID.
|
|
2669
|
-
* @param callback Callbacks for manipulating created or retrieved subgraph.
|
|
2670
|
-
*/
|
|
2671
2588
|
subgraph(id: string, callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
|
|
2672
|
-
/**
|
|
2673
|
-
* Create a subgraph (or get one if it already exists) and adapt the attributes.
|
|
2674
|
-
*
|
|
2675
|
-
* By specifying a callback function, the target subgraph can be received and manipulated as an argument.
|
|
2676
|
-
*
|
|
2677
|
-
* ```ts
|
|
2678
|
-
* const G = digraph('G', (g) => {
|
|
2679
|
-
* // Create a cluster with id as A and specifying its attributes.
|
|
2680
|
-
* g.subgraph('A', { [attribute.color]: 'red', [attribute.label]: 'my label' }, (A) => {
|
|
2681
|
-
* // Create a node with id as A1 in cluster A.
|
|
2682
|
-
* A.node('A1');
|
|
2683
|
-
* });
|
|
2684
|
-
* });
|
|
2685
|
-
*
|
|
2686
|
-
* console.log(toDot(G));
|
|
2687
|
-
* // digraph "G" {
|
|
2688
|
-
* // subgraph "A" {
|
|
2689
|
-
* // color = "red";
|
|
2690
|
-
* // label = "my label";
|
|
2691
|
-
* // "A1";
|
|
2692
|
-
* // }
|
|
2693
|
-
* // }
|
|
2694
|
-
* ```
|
|
2695
|
-
*
|
|
2696
|
-
* @param id Subgraph ID.
|
|
2697
|
-
* @param attributes Object of attributes to be adapted to the subgraph.
|
|
2698
|
-
* @param callback Callbacks for manipulating created or retrieved subgraph.
|
|
2699
|
-
*/
|
|
2700
2589
|
subgraph(
|
|
2701
2590
|
id: string,
|
|
2702
2591
|
attributes: SubgraphAttributesObject,
|
|
2703
2592
|
callback?: (subgraph: SubgraphModel) => void,
|
|
2704
2593
|
): SubgraphModel;
|
|
2705
|
-
/**
|
|
2706
|
-
* Create anonymous subgraphs and and adapt the attributes.
|
|
2707
|
-
*
|
|
2708
|
-
* By specifying a callback function, the target subgraph can be received and manipulated as an argument.
|
|
2709
|
-
*
|
|
2710
|
-
* ```ts
|
|
2711
|
-
* const G = digraph('G', (g) => {
|
|
2712
|
-
* // Create a anonymous cluster and specifying its attributes.
|
|
2713
|
-
* g.subgraph({ [attribute.color]: 'red', [attribute.label]: 'my label' }, (A) => {
|
|
2714
|
-
* // Create a node with id as A1 in anonymous cluster.
|
|
2715
|
-
* A.node('A1');
|
|
2716
|
-
* });
|
|
2717
|
-
* });
|
|
2718
|
-
*
|
|
2719
|
-
* console.log(toDot(G));
|
|
2720
|
-
* // digraph "G" {
|
|
2721
|
-
* // subgraph {
|
|
2722
|
-
* // color = "red";
|
|
2723
|
-
* // label = "my label";
|
|
2724
|
-
* // "A1";
|
|
2725
|
-
* // }
|
|
2726
|
-
* // }
|
|
2727
|
-
* ```
|
|
2728
|
-
*
|
|
2729
|
-
* @param attributes Object of attributes to be adapted to the subgraph.
|
|
2730
|
-
* @param callback Callbacks for manipulating created or retrieved subgraph.
|
|
2731
|
-
*/
|
|
2732
2594
|
subgraph(attributes: SubgraphAttributesObject, callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
|
|
2733
|
-
/**
|
|
2734
|
-
* Create anonymous subgraphs and manipulate them with callback functions.
|
|
2735
|
-
*
|
|
2736
|
-
* By specifying a callback function, the target subgraph can be received and manipulated as an argument.
|
|
2737
|
-
*
|
|
2738
|
-
* @param callback Callbacks for manipulating created or retrieved subgraph.
|
|
2739
|
-
*/
|
|
2740
2595
|
subgraph(callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
|
|
2741
|
-
/**
|
|
2742
|
-
* Create a node by specifying its id (or get it if it already exists).
|
|
2743
|
-
*
|
|
2744
|
-
* By specifying a callback function, the target node can be received and manipulated as an argument.
|
|
2745
|
-
*
|
|
2746
|
-
* ```ts
|
|
2747
|
-
* const G = digraph('G', (g) => {
|
|
2748
|
-
* // Create a node with id as A.
|
|
2749
|
-
* g.node('A');
|
|
2750
|
-
* });
|
|
2751
|
-
*
|
|
2752
|
-
* console.log(toDot(G));
|
|
2753
|
-
* // digraph "G" {
|
|
2754
|
-
* // "A";
|
|
2755
|
-
* // }
|
|
2756
|
-
* ```
|
|
2757
|
-
*
|
|
2758
|
-
* @param id Node ID.
|
|
2759
|
-
* @param callback Callbacks for manipulating created or retrieved node.
|
|
2760
|
-
*/
|
|
2761
2596
|
node(id: string, callback?: (node: NodeModel) => void): NodeModel;
|
|
2762
|
-
/**
|
|
2763
|
-
* Create a node (or get one if it already exists) and adapt the attributes.
|
|
2764
|
-
*
|
|
2765
|
-
* By specifying a callback function, the target node can be received and manipulated as an argument.
|
|
2766
|
-
*
|
|
2767
|
-
* ```ts
|
|
2768
|
-
* const G = digraph('G', (g) => {
|
|
2769
|
-
* // Create a node by specifying its id and specifying its attributes.
|
|
2770
|
-
* g.node('A', {
|
|
2771
|
-
* [attribute.color]: 'red',
|
|
2772
|
-
* [attribute.label]: 'my label',
|
|
2773
|
-
* });
|
|
2774
|
-
* });
|
|
2775
|
-
*
|
|
2776
|
-
* console.log(toDot(G));
|
|
2777
|
-
* // digraph "G" {
|
|
2778
|
-
* // "A" [
|
|
2779
|
-
* // color = "red",
|
|
2780
|
-
* // label = "my label",
|
|
2781
|
-
* // ];
|
|
2782
|
-
* // }
|
|
2783
|
-
* ```
|
|
2784
|
-
*
|
|
2785
|
-
* @param id Node ID.
|
|
2786
|
-
* @param attributes Object of attributes to be adapted to the node.
|
|
2787
|
-
* @param callback Callbacks for manipulating created or retrieved node.
|
|
2788
|
-
*/
|
|
2789
2597
|
node(id: string, attributes: NodeAttributesObject, callback?: (node: NodeModel) => void): NodeModel;
|
|
2790
|
-
/**
|
|
2791
|
-
* Set a common attribute for the nodes in the cluster.
|
|
2792
|
-
*
|
|
2793
|
-
* ```ts
|
|
2794
|
-
* const G = digraph('G', (g) => {
|
|
2795
|
-
* // Set a common attribute for the nodes in the cluster.
|
|
2796
|
-
* g.node({
|
|
2797
|
-
* [attribute.color]: 'red',
|
|
2798
|
-
* [attribute.label]: 'my label',
|
|
2799
|
-
* });
|
|
2800
|
-
* });
|
|
2801
|
-
*
|
|
2802
|
-
* console.log(toDot(G));
|
|
2803
|
-
* // digraph "G" {
|
|
2804
|
-
* // node [
|
|
2805
|
-
* // color = "red",
|
|
2806
|
-
* // label = "my label",
|
|
2807
|
-
* // ];
|
|
2808
|
-
* // }
|
|
2809
|
-
* ```
|
|
2810
|
-
*
|
|
2811
|
-
* @param attributes Object of attributes to be adapted to the nodes.
|
|
2812
|
-
*/
|
|
2813
2598
|
node(attributes: NodeAttributesObject): void;
|
|
2814
|
-
/**
|
|
2815
|
-
* Create a edge.
|
|
2816
|
-
*
|
|
2817
|
-
* By specifying a callback function, the target edge can be received and manipulated as an argument.
|
|
2818
|
-
*
|
|
2819
|
-
* ```ts
|
|
2820
|
-
* const G = digraph('G', (g) => {
|
|
2821
|
-
* // Create a edge.
|
|
2822
|
-
* g.edge(['a', 'b']);
|
|
2823
|
-
* });
|
|
2824
|
-
*
|
|
2825
|
-
* console.log(toDot(G));
|
|
2826
|
-
* // digraph "G" {
|
|
2827
|
-
* // "a" -> "b";
|
|
2828
|
-
* // }
|
|
2829
|
-
* ```
|
|
2830
|
-
* @param targets Nodes.
|
|
2831
|
-
* @param callback Callbacks for manipulating created or retrieved edge.
|
|
2832
|
-
*/
|
|
2833
2599
|
edge(targets: EdgeTargetLikeTuple, callback?: (edge: EdgeModel) => void): EdgeModel;
|
|
2834
|
-
/**
|
|
2835
|
-
* Create a edge and adapt the attributes.
|
|
2836
|
-
*
|
|
2837
|
-
* By specifying a callback function, the target edge can be received and manipulated as an argument.
|
|
2838
|
-
*
|
|
2839
|
-
* ```ts
|
|
2840
|
-
* const G = digraph('G', (g) => {
|
|
2841
|
-
* // Create a edge and specifying its attributes.
|
|
2842
|
-
* g.edge(['a', 'b'], {
|
|
2843
|
-
* [attribute.color]: 'red',
|
|
2844
|
-
* [attribute.label]: 'my label',
|
|
2845
|
-
* });
|
|
2846
|
-
* });
|
|
2847
|
-
*
|
|
2848
|
-
* console.log(toDot(G));
|
|
2849
|
-
* // digraph "G" {
|
|
2850
|
-
* // "a" -> "b" [
|
|
2851
|
-
* // color = "red",
|
|
2852
|
-
* // label = "my label",
|
|
2853
|
-
* // ];
|
|
2854
|
-
* // }
|
|
2855
|
-
* ```
|
|
2856
|
-
*
|
|
2857
|
-
* @param targets Edge targets.
|
|
2858
|
-
* @param attributes Object of attributes to be adapted to the edge.
|
|
2859
|
-
* @param callback Callbacks for manipulating created or retrieved edge.
|
|
2860
|
-
*/
|
|
2861
2600
|
edge(targets: EdgeTargetLikeTuple, attributes: EdgeAttributesObject, callback?: (edge: EdgeModel) => void): EdgeModel;
|
|
2862
|
-
/**
|
|
2863
|
-
* Set a common attribute for the edges in the cluster.
|
|
2864
|
-
*
|
|
2865
|
-
*
|
|
2866
|
-
* ```ts
|
|
2867
|
-
* const G = digraph('G', (g) => {
|
|
2868
|
-
* // Set a common attribute for the edges in the cluster.
|
|
2869
|
-
* g.edge({
|
|
2870
|
-
* [attribute.color]: 'red',
|
|
2871
|
-
* [attribute.label]: 'my label',
|
|
2872
|
-
* });
|
|
2873
|
-
* });
|
|
2874
|
-
*
|
|
2875
|
-
* console.log(toDot(G));
|
|
2876
|
-
* // digraph "G" {
|
|
2877
|
-
* // edge [
|
|
2878
|
-
* // color = "red",
|
|
2879
|
-
* // label = "my label",
|
|
2880
|
-
* // ];
|
|
2881
|
-
* // }
|
|
2882
|
-
* ```
|
|
2883
|
-
* @param attributes Object of attributes to be adapted to the edges.
|
|
2884
|
-
*/
|
|
2885
2601
|
edge(attributes: EdgeAttributesObject): void;
|
|
2886
|
-
/**
|
|
2887
|
-
* Set a common attribute for the clusters in the cluster.
|
|
2888
|
-
*
|
|
2889
|
-
* ```ts
|
|
2890
|
-
* const G = digraph('G', (g) => {
|
|
2891
|
-
* g.graph({
|
|
2892
|
-
* [attribute.color]: 'red',
|
|
2893
|
-
* [attribute.label]: 'my label',
|
|
2894
|
-
* });
|
|
2895
|
-
* });
|
|
2896
|
-
*
|
|
2897
|
-
* console.log(toDot(G));
|
|
2898
|
-
* // digraph "G" {
|
|
2899
|
-
* // graph [
|
|
2900
|
-
* // color = "red",
|
|
2901
|
-
* // label = "my label",
|
|
2902
|
-
* // ];
|
|
2903
|
-
* // }
|
|
2904
|
-
* ```
|
|
2905
|
-
* @param attributes Object of attributes to be adapted to the clusters.
|
|
2906
|
-
*/
|
|
2907
2602
|
graph(attributes: SubgraphAttributesObject): void;
|
|
2908
2603
|
}
|
|
2909
2604
|
/**
|
|
2910
|
-
*
|
|
2605
|
+
* DOT object class representing a subgraph.
|
|
2606
|
+
* @group Models
|
|
2911
2607
|
*/
|
|
2912
2608
|
declare class Subgraph extends GraphBase<SubgraphAttributeKey | ClusterSubgraphAttributeKey> implements SubgraphModel {
|
|
2913
2609
|
get $$type(): 'Subgraph';
|
|
@@ -2919,49 +2615,39 @@ declare class Subgraph extends GraphBase<SubgraphAttributeKey | ClusterSubgraphA
|
|
|
2919
2615
|
}>;
|
|
2920
2616
|
constructor(id?: string, attributes?: SubgraphAttributesObject);
|
|
2921
2617
|
constructor(attributes?: SubgraphAttributesObject);
|
|
2922
|
-
/** Determines whether the Subgraph is a SubgraphCluster. */
|
|
2923
2618
|
isSubgraphCluster(): boolean;
|
|
2924
2619
|
}
|
|
2925
2620
|
/**
|
|
2926
|
-
*
|
|
2621
|
+
* DOT object class representing a node.
|
|
2622
|
+
* @group Models
|
|
2927
2623
|
*/
|
|
2928
2624
|
declare class Node extends DotObject implements NodeModel {
|
|
2929
2625
|
readonly id: string;
|
|
2930
2626
|
get $$type(): 'Node';
|
|
2931
|
-
/** Comments to include when outputting with toDot. */
|
|
2932
2627
|
comment?: string;
|
|
2933
2628
|
readonly attributes: AttributesGroup<NodeAttributeKey>;
|
|
2934
2629
|
constructor(id: string, attributes?: NodeAttributesObject);
|
|
2935
|
-
/** Returns ForwardRefNode with port and compass specified. */
|
|
2936
2630
|
port(port: string | Partial<Port>): ForwardRefNode;
|
|
2937
2631
|
}
|
|
2938
2632
|
/**
|
|
2633
|
+
* DOT object class representing a edge.
|
|
2634
|
+
* @group Models
|
|
2939
2635
|
*/
|
|
2940
2636
|
declare class Edge extends DotObject implements EdgeModel {
|
|
2941
2637
|
readonly targets: EdgeTargetTuple;
|
|
2942
2638
|
get $$type(): 'Edge';
|
|
2943
|
-
/** Comments to include when outputting with toDot. */
|
|
2944
2639
|
comment?: string;
|
|
2945
2640
|
readonly attributes: AttributesGroup<EdgeAttributeKey>;
|
|
2946
2641
|
constructor(targets: EdgeTargetTuple, attributes?: EdgeAttributesObject);
|
|
2947
2642
|
}
|
|
2948
2643
|
/**
|
|
2949
|
-
* Base class
|
|
2950
|
-
*
|
|
2644
|
+
* Base class representing a root graph(digraph, graph).
|
|
2645
|
+
* @group Models
|
|
2951
2646
|
*/
|
|
2952
2647
|
declare abstract class RootGraph extends GraphBase<GraphAttributeKey> implements RootGraphModel {
|
|
2953
2648
|
get $$type(): 'Graph';
|
|
2954
2649
|
readonly id?: string;
|
|
2955
2650
|
abstract readonly directed: boolean;
|
|
2956
|
-
/**
|
|
2957
|
-
* Strict mode.
|
|
2958
|
-
*
|
|
2959
|
-
* @description
|
|
2960
|
-
* A graph may also be described as strict.
|
|
2961
|
-
* This forbids the creation of multi-edges, i.e., there can be at most one edge with a given tail node and head node in the directed case.
|
|
2962
|
-
* For undirected graphs, there can be at most one edge connected to the same two nodes.
|
|
2963
|
-
* Subsequent edge statements using the same two nodes will identify the edge with the previously defined one and apply any attributes given in the edge statement.
|
|
2964
|
-
*/
|
|
2965
2651
|
strict: boolean;
|
|
2966
2652
|
attributes: Readonly<{
|
|
2967
2653
|
graph: AttributeList<'Graph', ClusterSubgraphAttributeKey | 'rank'>;
|
|
@@ -2973,35 +2659,66 @@ declare abstract class RootGraph extends GraphBase<GraphAttributeKey> implements
|
|
|
2973
2659
|
constructor(strict?: boolean, attributes?: GraphAttributesObject);
|
|
2974
2660
|
constructor(attributes?: GraphAttributesObject);
|
|
2975
2661
|
}
|
|
2662
|
+
/**
|
|
2663
|
+
* DOT object class representing a graph.
|
|
2664
|
+
* @group Models
|
|
2665
|
+
*/
|
|
2976
2666
|
declare class Graph extends RootGraph {
|
|
2977
2667
|
get directed(): boolean;
|
|
2978
2668
|
}
|
|
2669
|
+
/**
|
|
2670
|
+
* DOT object class representing a digraph.
|
|
2671
|
+
* @group Models
|
|
2672
|
+
*/
|
|
2979
2673
|
declare class Digraph extends RootGraph {
|
|
2980
2674
|
get directed(): boolean;
|
|
2981
2675
|
}
|
|
2982
2676
|
|
|
2677
|
+
/**
|
|
2678
|
+
* @group Model Builder
|
|
2679
|
+
*/
|
|
2983
2680
|
interface CreateRootGraph {
|
|
2984
2681
|
(id?: string, attributes?: GraphAttributesObject, callback?: (g: RootGraphModel) => void): RootGraphModel;
|
|
2985
2682
|
(attributes?: GraphAttributesObject, callback?: (g: RootGraphModel) => void): RootGraphModel;
|
|
2986
2683
|
(id?: string, callback?: (g: RootGraphModel) => void): RootGraphModel;
|
|
2987
2684
|
(callback?: (g: RootGraphModel) => void): RootGraphModel;
|
|
2988
2685
|
}
|
|
2989
|
-
/**
|
|
2686
|
+
/**
|
|
2687
|
+
* API for creating directional graph objects.
|
|
2688
|
+
* @group Model Builder
|
|
2689
|
+
*/
|
|
2990
2690
|
declare const digraph: CreateRootGraph;
|
|
2991
|
-
/**
|
|
2691
|
+
/**
|
|
2692
|
+
* API for creating omnidirectional graph objects.
|
|
2693
|
+
* @group Model Builder
|
|
2694
|
+
*/
|
|
2992
2695
|
declare const graph: CreateRootGraph;
|
|
2993
|
-
/**
|
|
2994
|
-
|
|
2995
|
-
|
|
2696
|
+
/**
|
|
2697
|
+
* Provides a strict mode API.
|
|
2698
|
+
* @group Model Builder
|
|
2699
|
+
*/
|
|
2700
|
+
declare const strict: {
|
|
2996
2701
|
digraph: CreateRootGraph;
|
|
2997
|
-
/** API for creating omnidirectional graph objects in strict mode. */
|
|
2998
2702
|
graph: CreateRootGraph;
|
|
2999
|
-
}
|
|
2703
|
+
};
|
|
3000
2704
|
|
|
2705
|
+
/**
|
|
2706
|
+
* @group Convert Model to DOT
|
|
2707
|
+
* @alpha
|
|
2708
|
+
*/
|
|
3001
2709
|
interface ToDotOptions {
|
|
3002
|
-
convert?:
|
|
2710
|
+
convert?: ConvertFromModelOptions;
|
|
3003
2711
|
print?: PrintOptions;
|
|
3004
2712
|
}
|
|
2713
|
+
/**
|
|
2714
|
+
* Convert Model to DOT string.
|
|
2715
|
+
*
|
|
2716
|
+
* @group Convert Model to DOT
|
|
2717
|
+
*
|
|
2718
|
+
* @param model Dot Object Model, like {@link Digraph}, {@link Graph}, {@link Node}, and {@link Edge}
|
|
2719
|
+
* @param options
|
|
2720
|
+
* @returns DOT string
|
|
2721
|
+
*/
|
|
3005
2722
|
declare function toDot(model: DotObjectModel, options?: ToDotOptions): string;
|
|
3006
2723
|
|
|
3007
2724
|
export {
|
|
@@ -3009,12 +2726,12 @@ export {
|
|
|
3009
2726
|
AttributeList,
|
|
3010
2727
|
AttributesBase,
|
|
3011
2728
|
AttributesGroupModel,
|
|
2729
|
+
CreateRootGraph,
|
|
3012
2730
|
Digraph,
|
|
3013
2731
|
DotObject,
|
|
3014
2732
|
Edge,
|
|
3015
2733
|
Graph,
|
|
3016
2734
|
GraphBase,
|
|
3017
|
-
GraphvizObject,
|
|
3018
2735
|
Node,
|
|
3019
2736
|
RootGraph,
|
|
3020
2737
|
Subgraph,
|