1 |
|
---|
2 | namespace Netron.Diagramming.Core.Analysis {
|
---|
3 | /// <summary>
|
---|
4 | /// This interface describes the <see cref="Model"/> from the point of view of graph analysis.
|
---|
5 | /// </summary>
|
---|
6 | public interface IGraph {
|
---|
7 | /// <summary>
|
---|
8 | /// Get the in-degree of a node, the number of edges for which the node
|
---|
9 | /// is the target.
|
---|
10 | /// </summary>
|
---|
11 | /// <param name="node"></param>
|
---|
12 | /// <returns></returns>
|
---|
13 | int InDegree(INode node);
|
---|
14 | /// <summary>
|
---|
15 | /// Get the out-degree of a node, the number of edges for which the node
|
---|
16 | /// is the source.
|
---|
17 | /// </summary>
|
---|
18 | /// <param name="node"></param>
|
---|
19 | /// <returns></returns>
|
---|
20 | int OutDegree(INode node);
|
---|
21 | /// <summary>
|
---|
22 | /// Get the degree of a node, the number of edges for which a node
|
---|
23 | /// is either the source or the target.
|
---|
24 | /// </summary>
|
---|
25 | /// <param name="node"></param>
|
---|
26 | /// <returns></returns>
|
---|
27 | int Degree(INode node);
|
---|
28 | /// <summary>
|
---|
29 | /// Indicates if the edges of this graph are directed or undirected.
|
---|
30 | /// </summary>
|
---|
31 | bool IsDirected { get; }
|
---|
32 | /// <summary>
|
---|
33 | /// Returns the nodes for the current page. This is the same as the <see cref="Model.Shapes"/> property except that the return type is
|
---|
34 | /// here <see cref="INode"/> rather than <see cref="IShape"/> type.
|
---|
35 | /// </summary>
|
---|
36 | CollectionBase<INode> Nodes { get; }
|
---|
37 | /// <summary>
|
---|
38 | /// Get the source Node for the given Edge instance.
|
---|
39 | /// </summary>
|
---|
40 | /// <param name="edge"></param>
|
---|
41 | /// <returns></returns>
|
---|
42 | INode FromNode(IEdge edge);
|
---|
43 | /// <summary>
|
---|
44 | /// Get the target Node for the given Edge instance.
|
---|
45 | /// </summary>
|
---|
46 | /// <param name="edge"></param>
|
---|
47 | /// <returns></returns>
|
---|
48 | INode ToNode(IEdge edge);
|
---|
49 | /// <summary>
|
---|
50 | /// Given an Edge and an incident Node, return the other Node
|
---|
51 | /// connected to the edge.
|
---|
52 | /// </summary>
|
---|
53 | /// <param name="edge"></param>
|
---|
54 | /// <param name="node"></param>
|
---|
55 | /// <returns></returns>
|
---|
56 | INode AdjacentNode(IEdge edge, INode node);
|
---|
57 | /// <summary>
|
---|
58 | /// Gets the collection of all adjacent nodes connected to the given node by an
|
---|
59 | /// incoming edge (i.e., all nodes that "point" at this one).
|
---|
60 | /// </summary>
|
---|
61 | CollectionBase<INode> InNeighbors(INode node);
|
---|
62 | /// <summary>
|
---|
63 | /// Gets the collection of adjacent nodes connected to the given node by an
|
---|
64 | /// outgoing edge (i.e., all nodes "pointed" to by this one).
|
---|
65 | /// </summary>
|
---|
66 | CollectionBase<INode> OutNeighbors(INode node);
|
---|
67 |
|
---|
68 | /// <summary>
|
---|
69 | /// Get an iterator over all nodes connected to the given node.
|
---|
70 | /// </summary>
|
---|
71 | CollectionBase<INode> Neighbors(INode node);
|
---|
72 | /// <summary>
|
---|
73 | /// Gets the edges.
|
---|
74 | /// </summary>
|
---|
75 | /// <value>The edges.</value>
|
---|
76 | CollectionBase<IEdge> Edges { get; }
|
---|
77 | /// <summary>
|
---|
78 | /// Returns the edges connected to the given node.
|
---|
79 | /// </summary>
|
---|
80 | /// <param name="node">The node.</param>
|
---|
81 | /// <returns></returns>
|
---|
82 | CollectionBase<IEdge> EdgesOf(INode node);
|
---|
83 |
|
---|
84 | /// <summary>
|
---|
85 | /// Returns the incoming edges of the given node.
|
---|
86 | /// </summary>
|
---|
87 | /// <param name="node">The node.</param>
|
---|
88 | /// <returns></returns>
|
---|
89 | CollectionBase<IEdge> InEdges(INode node);
|
---|
90 |
|
---|
91 | /// <summary>
|
---|
92 | /// Returns the outgoing edges attached to the given node.
|
---|
93 | /// </summary>
|
---|
94 | /// <param name="node">The node.</param>
|
---|
95 | /// <returns></returns>
|
---|
96 | CollectionBase<IEdge> OutEdges(INode node);
|
---|
97 |
|
---|
98 | /// <summary>
|
---|
99 | /// Gets a spanning tree of the model or graph.
|
---|
100 | /// </summary>
|
---|
101 | /// <value>The spanning tree.</value>
|
---|
102 | ITree SpanningTree { get; }
|
---|
103 |
|
---|
104 | /// <summary>
|
---|
105 | /// Makes the spanning tree.
|
---|
106 | /// </summary>
|
---|
107 | /// <param name="node">The node.</param>
|
---|
108 | void MakeSpanningTree(INode node);
|
---|
109 |
|
---|
110 | /// <summary>
|
---|
111 | /// Clears the spanning tree.
|
---|
112 | /// </summary>
|
---|
113 | void ClearSpanningTree();
|
---|
114 |
|
---|
115 |
|
---|
116 |
|
---|
117 |
|
---|
118 |
|
---|
119 |
|
---|
120 |
|
---|
121 | }
|
---|
122 | }
|
---|