/// <summary> /// Create and return a subgraph containing the given edges and their endpoints. /// </summary> public SubGraph AddSubgraphFromEdgeSet(string name, HashSet <Edge> edges) { var result = SubGraph.GetOrCreate(this, name); result.AddExisting(edges); // Since subgraphs can contain edges independently of their endpoints, // we need to add the endpoints explicitly. result.AddExisting(edges.SelectMany(e => new[] { e.Tail(), e.Head() })); return(result); }
public SubGraph GetOrAddSubgraph(string name) { return(SubGraph.GetOrCreate(this, name)); }