Class Network<V, E, Y>.Vertex

GoDiagram®
v10.0.12
by Northwoods Software®

A vertex represents a Node in a Network<V, E, Y>, along with its Bounds and Focus and collections of Network<V, E, Y>.Edges that come into and go out of the vertex.

Namespace: Northwoods.Go.Layouts
Assembly: Northwoods.GoDiagram.Avalonia.dll
Syntax
public class Network<V, E, Y>.Vertex
Remarks

The Node property may be null for vertexes that represent "dummy" nodes, when the layout wants to work with a network that is not isomorphic with the collection of Nodes and Links being laid out.

This holds layout-specific data for the node. For each kind of layout that uses a Network there is a subclass of Network<V, E, Y>.Vertex and a subclass of Network<V, E, Y>.Edge:

  • : and
  • : and
  • : and
  • : and

Modifying a Network<V, E, Y> or a Network<V, E, Y>.Vertex or an Network<V, E, Y>.Edge does not invalidate the Layout or raise any changed events.

Constructors

Vertex(Network<V, E, Y>)

This constructs a vertex that does not know about any Node and sets its network.

Declaration
public Vertex(Network<V, E, Y> network)
Parameters
Type Name Description
Network<V, E, Y> network

Fields

SmartComparer

This static comparer is used to compare the Text values of the Nodes of the argument Network<V, E, Y>.Vertexes. If the text ends in a number, the values are compared as numbers rather than lexicographically.

Declaration
public static readonly Comparison<V> SmartComparer
Field Value
Type Description
Comparison<V>
Remarks

Naturally this comparison is significantly slower than StandardComparer.

StandardComparer

This static comparer is used to compare the Text values of the Nodes of the argument Network<V, E, Y>.Vertexes. This just does a simple case-sensitive string comparison.

Declaration
public static readonly Comparison<V> StandardComparer
Field Value
Type Description
Comparison<V>
Remarks

Alternatively you may wish to use SmartComparer or write your own comparison function.

Properties

Bounds

Gets or sets the bounds of this vertex, in document coordinates.

Declaration
public Rect Bounds { get; set; }
Property Value
Type Description
Rect
Remarks

Setting this property does not directly modify the position of any Node, but it will modify the value of CenterX and CenterY, as well as the subsidiary convenience properties X, Y, Width, and Height.

CenterX

Gets or sets the center X of this vertex, in document coordinates.

Declaration
public double CenterX { get; set; }
Property Value
Type Description
double
Remarks

This property depends on both Bounds and Focus. Setting this property does not modify the position of any Node, but it will modify the value of Bounds.

CenterY

Gets or sets the center Y of this vertex, in document coordinates.

Declaration
public double CenterY { get; set; }
Property Value
Type Description
double
Remarks

This property depends on both Bounds and Focus. Setting this property does not modify the position of any Node, but it will modify the value of Bounds.

Data

Gets or sets the data object in the model that should be associated with this vertex, if any.

Declaration
public object Data { get; set; }
Property Value
Type Description
object
Remarks

The value will be non-null if this vertex is virtualized, not represented by a real Node in the Diagram. Each data object should have a "Bounds" property that is a Rect or any Object with "X", "Y", "Width", and "Height" properties that are real numbers, and non-negative numbers for the width and the height. Setting this data property will also set the Bounds and Focus properties.

DestinationEdges

This read-only property returns an iterator for all of the edges that go out of this vertex.

Declaration
public IReadOnlyCollection<E> DestinationEdges { get; }
Property Value
Type Description
IReadOnlyCollection<E>

DestinationVertexes

This read-only property returns an iterator for all of the vertexes that are connected with edges going out of this vertex.

Declaration
public IReadOnlyCollection<V> DestinationVertexes { get; }
Property Value
Type Description
IReadOnlyCollection<V>
Remarks

Note that this is inefficient compared to iterating over the edges (DestinationEdges) due to the need to avoid duplicate vertexes if there happen to be multiple edges connecting with the same vertex.

Edges

This read-only property returns an iterator for all of the edges that are connected with this vertex in either direction.

Declaration
public IReadOnlyCollection<E> Edges { get; }
Property Value
Type Description
IReadOnlyCollection<E>
Remarks

Note that this is inefficient compared to iterating over the edges: SourceEdges and DestinationEdges.

Focus

Gets or sets the offset of the FocusX and FocusY from the Bounds position.

Declaration
public Point Focus { get; set; }
Property Value
Type Description
Point
Remarks

Setting this property does not directly modify the position of any Node, but it does affect the value of CenterX and CenterY.

The "focus" is normally the center of the Node's LocationElement.

FocusX

Gets or sets the relative X position of the "center" point, the focus.

Declaration
public double FocusX { get; set; }
Property Value
Type Description
double

FocusY

Gets or sets the relative Y position of the "center" point, the focus.

Declaration
public double FocusY { get; set; }
Property Value
Type Description
double

Height

Gets or sets the height of this vertex.

Declaration
public double Height { get; set; }
Property Value
Type Description
double
Remarks

This is always the vertical distance reserved for the node.

this[string]

This index operator allows for access to programmer-defined properties stored in a Dictionary<string, object>.

Declaration
public object this[string prop] { get; set; }
Parameters
Type Name Description
string prop

the property name, which must begin with a _

Property Value
Type Description
object

Network

Gets the Network<V, E, Y> that owns this vertex.

Declaration
public Network<V, E, Y> Network { get; set; }
Property Value
Type Description
Network<V, E, Y>
Remarks

The default value is null. It is set automatically for you in CreateVertex().

Node

Gets or sets the Node associated with this vertex, if any.

Declaration
public Node Node { get; set; }
Property Value
Type Description
Node
Remarks

The value may be null if this vertex is a "dummy" vertex, not represented by a real Node in the Diagram.

This property setter also sets the Bounds and Focus properties according to the value of the Node's ActualBounds and its LocationElement's center point.

SourceEdges

This read-only property returns an iterator for all of the edges that come into this vertex.

Declaration
public IReadOnlyCollection<E> SourceEdges { get; }
Property Value
Type Description
IReadOnlyCollection<E>

SourceVertexes

This read-only property returns an iterator for all of the vertexes that are connected with edges coming into this vertex.

Declaration
public IReadOnlyCollection<V> SourceVertexes { get; }
Property Value
Type Description
IReadOnlyCollection<V>
Remarks

Note that this is inefficient compared to iterating over the edges (SourceEdges) due to the need to avoid duplicate vertexes if there happen to be multiple edges connecting with the same vertex.

Vertexes

This read-only property returns an iterator for all of the vertexes that are connected in either direction with this vertex.

Declaration
public IReadOnlyCollection<V> Vertexes { get; }
Property Value
Type Description
IReadOnlyCollection<V>
Remarks

Note that this is inefficient compared to iterating over the edges (SourceEdges and DestinationEdges) due to the need to avoid duplicate vertexes if there happen to be multiple edges connecting with the same vertex.

Width

Gets or sets the width of this vertex.

Declaration
public double Width { get; set; }
Property Value
Type Description
double
Remarks

This is always the horizontal distance reserved for the node.

X

Gets or sets the left point of this vertex.

Declaration
public double X { get; set; }
Property Value
Type Description
double

Y

Gets or sets the top point of this vertex.

Declaration
public double Y { get; set; }
Property Value
Type Description
double

Methods

AddDestinationEdge(E)

Adds a Network<V, E, Y>.Edge to the list of successors (the edge will be going out from this vertex).

Declaration
public void AddDestinationEdge(E edge)
Parameters
Type Name Description
E edge
Remarks

Calling this method does not modify the FromVertex of the Edge.

AddSourceEdge(E)

Adds an Network<V, E, Y>.Edge to the list of predecessors (the edge will be coming into this vertex).

Declaration
public void AddSourceEdge(E edge)
Parameters
Type Name Description
E edge
Remarks

Calling this method does not modify the ToVertex of the Edge.

Commit()

Moves the Node corresponding to this vertex so that its position is at the current Bounds point.

Declaration
public virtual void Commit()
Remarks

To make the most common cases look right, the Node's LocationElement is centered. Thus iconic nodes will have the center of the icon be positioned according to the center of this vertex, ignoring any labels. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

DeleteDestinationEdge(E)

Deletes a Network<V, E, Y>.Edge from the list of successors (the edge was going out from this vertex).

Declaration
public void DeleteDestinationEdge(E edge)
Parameters
Type Name Description
E edge
Remarks

Calling this method does not modify the FromVertex of the Edge.

DeleteSourceEdge(E)

Deletes an Network<V, E, Y>.Edge from the list of predecessors (the edge was coming into this vertex).

Declaration
public void DeleteSourceEdge(E edge)
Parameters
Type Name Description
E edge
Remarks

Calling this method does not modify the ToVertex of the Edge.