using System.Linq; namespace AutoGroupGenerator { /// /// Extension helpers for classifying subgraph topology. /// /// /// public static class SubgraphTopologyUtil { #region Static Methods /// /// Determines whether a subgraph is shared by multiple sources. /// /// The subgraph instance to evaluate for shared source ownership. /// True when the subgraph has more than one source. public static bool IsShared(this Subgraph subgraph) { return subgraph.Sources.Count > 1; } /// /// Determines whether a subgraph forms a hierarchy rooted at its sources. /// /// The subgraph instance to evaluate for hierarchical structure. /// The dependency graph that contains the subgraph nodes. /// True when the subgraph is hierarchical. public static bool IsHierarchy(Subgraph subgraph, DependencyGraph dependencyGraph) { return subgraph.Nodes.Count > 1 && subgraph.Sources.IsSubsetOf(subgraph.Nodes); } #endregion } }