Class WorkspaceGraph

java.lang.Object
network.ike.workspace.WorkspaceGraph

public final class WorkspaceGraph extends Object
Graph operations over a workspace Manifest.

All algorithms operate on the subproject dependency graph defined by depends-on entries in workspace.yaml. The graph is small (typically < 20 nodes) so simple implementations are preferred over library dependencies.

  • Constructor Details

    • WorkspaceGraph

      public WorkspaceGraph(Manifest manifest)
      Build a graph from the given manifest.
      Parameters:
      manifest - parsed workspace manifest
  • Method Details

    • manifest

      public Manifest manifest()
      Return the underlying manifest.
      Returns:
      the parsed workspace manifest
    • topologicalSort

      public List<String> topologicalSort(Set<String> targetNames)
      Topological sort of the given subprojects (or all if none specified). Dependencies outside the target set are ignored.
      Parameters:
      targetNames - subprojects to include; empty means all
      Returns:
      subprojects in dependency order (dependencies first)
      Throws:
      ManifestException - if a cycle is detected
    • topologicalSort

      public List<String> topologicalSort()
      Topological sort of all subprojects.
      Returns:
      subproject names in dependency order (leaves first)
    • cascade

      public List<String> cascade(String subprojectName)
      Compute the propagation set: all subprojects that transitively depend on the given subproject (BFS on reverse edges).

      The result does NOT include the starting subproject itself.

      Parameters:
      subprojectName - the changed subproject
      Returns:
      subprojects affected by a change, in BFS discovery order
      Throws:
      ManifestException - if the subproject does not exist
    • detectCycle

      public List<String> detectCycle()
      Detect dependency cycles. Returns the first cycle found as a list of subproject names forming the cycle, or an empty list if no cycles exist.
      Returns:
      cycle path, or empty list if acyclic
    • verify

      public List<String> verify()
      Verify manifest consistency. Returns a list of error messages; an empty list means the manifest is valid.
      Returns:
      error messages, or empty list if valid