public static DirectedGraphWithPointID GetSpanningSubgraph(DirectedGraphWithPointID CurrentGraph, SelectionCondition <EdgePointID> EdgeSelectionCondition) { DirectedGraphWithPointID OutGraph = new DirectedGraphWithPointID(String.Format("Spanning \"{0}\"", CurrentGraph.GraphName), CurrentGraph.PointNamePrefix, new AbstractEdgeEqualityComparer <PointWithID>()); IEnumerable <EdgePointID> edgeCollection = CurrentGraph.EdgeCollection.Where(i1 => EdgeSelectionCondition(i1)); foreach (PointWithID p in CurrentGraph.PointCollection) { OutGraph.AddPoint(p); } foreach (EdgePointID e in edgeCollection) { OutGraph.AddEdge(e); } return(OutGraph); }
public static DirectedGraphWithPointID GetInducedSubgraph(DirectedGraphWithPointID CurrentGraph, SelectionCondition <PointWithID> PointSelectionCondition) { IEnumerable <PointWithID> pointCollection = CurrentGraph.PointCollection.Where(i1 => PointSelectionCondition(i1)); return(GetInducedSubgraph(CurrentGraph, pointCollection)); }