1 | using System;
|
---|
2 | using System.Drawing;
|
---|
3 |
|
---|
4 | namespace Netron.Diagramming.Core.Analysis {
|
---|
5 | /// <summary>
|
---|
6 | /// This interface describes the <see cref="IShape"/> from the point of view of graph analysis.
|
---|
7 | /// </summary>
|
---|
8 | public interface INode {
|
---|
9 | /// <summary>
|
---|
10 | /// Get the in-degree of the node, the number of edges for which this node
|
---|
11 | /// is the target.
|
---|
12 | /// </summary>
|
---|
13 | int InDegree { get; }
|
---|
14 | /// <summary>
|
---|
15 | /// Get the out-degree of the node, the number of edges for which this node
|
---|
16 | /// is the source.
|
---|
17 | /// </summary>
|
---|
18 | int OutDegree { get; }
|
---|
19 | /// <summary>
|
---|
20 | /// Get the degree of the node, the number of edges for which this node
|
---|
21 | /// is either the source or the target.
|
---|
22 | /// </summary>
|
---|
23 | int Degree { get; }
|
---|
24 | /// <summary>
|
---|
25 | /// Gets the collection of all incoming edges, those for which this node
|
---|
26 | /// is the target.
|
---|
27 | /// </summary>
|
---|
28 | CollectionBase<IEdge> InEdges { get; }
|
---|
29 | /// <summary>
|
---|
30 | /// Gets or sets whether this shape is fixed with respect to diagram layout
|
---|
31 | /// </summary>
|
---|
32 | bool IsFixed { get; set; }
|
---|
33 | /// <summary>
|
---|
34 | /// Gets or sets a value indicating whether this instance is expanded.
|
---|
35 | /// </summary>
|
---|
36 | /// <value>
|
---|
37 | /// <c>true</c> if this instance is expanded; otherwise, <c>false</c>.
|
---|
38 | /// </value>
|
---|
39 | bool IsExpanded { get; set; }
|
---|
40 | /// <summary>
|
---|
41 | /// Gets the unique identifier of this node.
|
---|
42 | /// </summary>
|
---|
43 | /// <value>The uid.</value>
|
---|
44 | Guid Uid { get; }
|
---|
45 | /// <summary>
|
---|
46 | /// Gets the collection of all outgoing edges, those for which this node
|
---|
47 | /// is the source.
|
---|
48 | /// </summary>
|
---|
49 | CollectionBase<IEdge> OutEdges { get; }
|
---|
50 | /// <summary>
|
---|
51 | ///Gets the collection of all incident edges, those for which this node
|
---|
52 | /// is either the source or the target.
|
---|
53 | /// </summary>
|
---|
54 | CollectionBase<IEdge> Edges { get; }
|
---|
55 | /// <summary>
|
---|
56 | /// Gets the collection of all adjacent nodes connected to this node by an
|
---|
57 | /// incoming edge (i.e., all nodes that "point" at this one).
|
---|
58 | /// </summary>
|
---|
59 | CollectionBase<INode> InNeighbors { get; }
|
---|
60 | /// <summary>
|
---|
61 | /// Gets the collection of adjacent nodes connected to this node by an
|
---|
62 | /// outgoing edge (i.e., all nodes "pointed" to by this one).
|
---|
63 | /// </summary>
|
---|
64 | CollectionBase<INode> OutNeighbors { get; }
|
---|
65 |
|
---|
66 | /// <summary>
|
---|
67 | /// Get an iterator over all nodes connected to this node.
|
---|
68 | /// </summary>
|
---|
69 | CollectionBase<INode> Neighbors { get; }
|
---|
70 |
|
---|
71 | /// <summary>
|
---|
72 | /// Get the parent node of this node in a tree structure.
|
---|
73 | /// </summary>
|
---|
74 | INode ParentNode { get; set; }
|
---|
75 | /// <summary>
|
---|
76 | /// Get the edge between this node and its parent node in a tree
|
---|
77 | /// structure.
|
---|
78 | /// </summary>
|
---|
79 | IEdge ParentEdge { get; set; }
|
---|
80 | /// <summary>
|
---|
81 | /// Get the tree depth of this node.
|
---|
82 | ///<remarks>The root's tree depth is
|
---|
83 | /// zero, and each level of the tree is one depth level greater.
|
---|
84 | /// </remarks>
|
---|
85 | /// </summary>
|
---|
86 | int Depth { get; set; }
|
---|
87 | /// <summary>
|
---|
88 | /// Get the number of tree children of this node.
|
---|
89 | /// </summary>
|
---|
90 | int ChildCount { get; }
|
---|
91 | /// <summary>
|
---|
92 | /// Get this node's first tree child.
|
---|
93 | /// </summary>
|
---|
94 | INode FirstChild { get; }
|
---|
95 | /// <summary>
|
---|
96 | /// Get this node's last tree child.
|
---|
97 | /// </summary>
|
---|
98 | INode LastChild { get; }
|
---|
99 |
|
---|
100 | /// <summary>
|
---|
101 | /// Gets the X coordinate.
|
---|
102 | /// </summary>
|
---|
103 | /// <value>The X.</value>
|
---|
104 | int X { get; }
|
---|
105 | /// <summary>
|
---|
106 | /// Gets the Y coordinate.
|
---|
107 | /// </summary>
|
---|
108 | /// <value>The Y.</value>
|
---|
109 | int Y { get; }
|
---|
110 |
|
---|
111 | /// <summary>
|
---|
112 | /// Get this node's previous tree sibling.
|
---|
113 | /// </summary>
|
---|
114 | INode PreviousSibling { get; }
|
---|
115 | /// <summary>
|
---|
116 | /// Get this node's next tree sibling.
|
---|
117 | /// </summary>
|
---|
118 | INode NextSibling { get; }
|
---|
119 |
|
---|
120 | /// <summary>
|
---|
121 | /// Gets the rectangle.
|
---|
122 | /// </summary>
|
---|
123 | /// <value>The rectangle.</value>
|
---|
124 | Rectangle Rectangle { get; }
|
---|
125 | /// <summary>
|
---|
126 | /// Get an iterator over this node's tree children.
|
---|
127 | /// </summary>
|
---|
128 | CollectionBase<INode> Children { get; set; }
|
---|
129 | /// <summary>
|
---|
130 | /// Get an iterator over the edges from this node to its tree children.
|
---|
131 | /// </summary>
|
---|
132 | CollectionBase<IEdge> ChildEdges { get; }
|
---|
133 |
|
---|
134 | /// <summary>
|
---|
135 | /// Moves the node, the argument being the motion vector.
|
---|
136 | /// </summary>
|
---|
137 | /// <param name="p">The p.</param>
|
---|
138 | void MoveBy(Point p);
|
---|
139 | }
|
---|
140 |
|
---|
141 |
|
---|
142 |
|
---|
143 |
|
---|
144 | }
|
---|