72 lines
1.8 KiB
C#
72 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace StellaOps.Scanner.Reachability.Ordering;
|
|
|
|
/// <summary>
|
|
/// Canonical (deterministically ordered) graph representation.
|
|
/// </summary>
|
|
public sealed class CanonicalGraph
|
|
{
|
|
/// <summary>
|
|
/// Ordering strategy used.
|
|
/// </summary>
|
|
public required GraphOrderingStrategy Strategy { get; init; }
|
|
|
|
/// <summary>
|
|
/// Deterministically ordered nodes.
|
|
/// </summary>
|
|
public required IReadOnlyList<CanonicalNode> Nodes { get; init; }
|
|
|
|
/// <summary>
|
|
/// Deterministically ordered edges.
|
|
/// </summary>
|
|
public required IReadOnlyList<CanonicalEdge> Edges { get; init; }
|
|
|
|
/// <summary>
|
|
/// Content hash of canonical representation.
|
|
/// </summary>
|
|
public required string ContentHash { get; init; }
|
|
|
|
/// <summary>
|
|
/// Anchor nodes (entry points), if present.
|
|
/// </summary>
|
|
public IReadOnlyList<string>? AnchorNodes { get; init; }
|
|
|
|
/// <summary>
|
|
/// Optional timestamp for diagnostics; excluded from <see cref="ContentHash"/>.
|
|
/// </summary>
|
|
public DateTimeOffset? ComputedAt { get; init; }
|
|
}
|
|
|
|
public sealed class CanonicalNode
|
|
{
|
|
/// <summary>
|
|
/// Position in ordered list (0-indexed).
|
|
/// </summary>
|
|
public required int Index { get; init; }
|
|
|
|
/// <summary>
|
|
/// Node identifier.
|
|
/// </summary>
|
|
public required string Id { get; init; }
|
|
|
|
/// <summary>
|
|
/// Node type (e.g. method, function).
|
|
/// </summary>
|
|
public required string NodeType { get; init; }
|
|
|
|
/// <summary>
|
|
/// Node label for UI display (optional).
|
|
/// </summary>
|
|
public string? Label { get; init; }
|
|
}
|
|
|
|
public sealed class CanonicalEdge
|
|
{
|
|
public required int SourceIndex { get; init; }
|
|
public required int TargetIndex { get; init; }
|
|
public required string EdgeType { get; init; }
|
|
}
|
|
|