Graph.cs 851 B

1234567891011121314151617181920212223242526272829303132
  1. namespace RackPeek.Domain.Graph;
  2. public record GraphNode(
  3. string Id,
  4. string Label,
  5. string Kind,
  6. string? Subtitle = null,
  7. IReadOnlyDictionary<string, string>? Data = null);
  8. public record GraphEdge(
  9. string Source,
  10. string Target,
  11. string? Label,
  12. string Kind,
  13. IReadOnlyDictionary<string, string>? Data = null);
  14. /// <summary>
  15. /// A labelled cluster of nodes. Used to drive Mermaid <c>subgraph</c>
  16. /// blocks. Groups may nest via <see cref="ParentGroupId"/>.
  17. /// </summary>
  18. public record GraphGroup(
  19. string Id,
  20. string Label,
  21. IReadOnlyList<string> NodeIds,
  22. string? ParentGroupId = null);
  23. public record Graph(
  24. IReadOnlyList<GraphNode> Nodes,
  25. IReadOnlyList<GraphEdge> Edges,
  26. IReadOnlyList<GraphGroup>? Groups = null) {
  27. public static Graph Empty { get; } = new([], [], null);
  28. }