public static DirectedGraphWithPointID GenerateEmptyDirectedGraphWithPointID(string GraphName, string PointNamePrefix, int PointCount) { DirectedGraphWithPointID OutGraph = new DirectedGraphWithPointID(GraphName, PointNamePrefix, new AbstractEdgeEqualityComparer <PointWithID>()); for (int i = 1; i <= PointCount; i++) { OutGraph.AddPoint(); } return(OutGraph); }
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, IEnumerable <Point> PointCollection) { DirectedGraphWithPointID OutGraph = new DirectedGraphWithPointID(String.Format("Induced \"{0}\"", CurrentGraph.GraphName), CurrentGraph.PointNamePrefix, new AbstractEdgeEqualityComparer <PointWithID>()); IEnumerable <EdgePointID> edgeCollection = CurrentGraph.EdgeCollection.Where(i1 => PointCollection.Contains(i1.StartPoint) && PointCollection.Contains(i1.EndPoint)); foreach (PointWithID p in PointCollection) { OutGraph.AddPoint(p); } foreach (EdgePointID e in edgeCollection) { OutGraph.AddEdge(e); } return(OutGraph); }