Class GraphUtility

Inheritance
GraphUtility
Namespace: MOSAIC.ViewModels.Graph
Assembly: MOSAIC.dll
Syntax
public static class GraphUtility

Methods

CenterNodesHorizontally(ObservableCollection<VertexViewModel>, Size)

Recenters and rescales the graph for a new canvas size. Adjusts both X centering and Y spacing proportionally.

Declaration
public static void CenterNodesHorizontally(ObservableCollection<VertexViewModel> vertices, Size canvasSize)
Parameters
Type Name Description
ObservableCollection<VertexViewModel> vertices
Size canvasSize

FitToCanvas(ObservableCollection<VertexViewModel>, Size)

Ensures all nodes are visible within the canvas by scaling their positions (X, Y). Node widths and heights are NOT scaled because the AXAML views render at their natural content size regardless of the VM properties. Instead, we treat each node as a fixed-size box and compute where its top-left corner must land so the whole graph (including node bodies) fits with a margin. If the graph can't fit without making arrows unreadable, it overflows (the canvas supports panning).

Declaration
public static void FitToCanvas(ObservableCollection<VertexViewModel> vertices, Size canvasSize)
Parameters
Type Name Description
ObservableCollection<VertexViewModel> vertices
Size canvasSize

PositionNodes(ObservableCollection<VertexViewModel>, Size)

Positions graph nodes in a hierarchical layout using topological sorting algorithm.

Declaration
public static void PositionNodes(ObservableCollection<VertexViewModel> vertices, Size canvasSize)
Parameters
Type Name Description
ObservableCollection<VertexViewModel> vertices
Size canvasSize

Search documentation

Start typing to search the documentation.