Click or drag to resize

editDistanceEditStepsT Method

Get the edit steps in the shortest edit path from this to other.

Namespace:  WhetStone.Looping
Assembly:  WhetStone (in WhetStone.dll) Version: 1.0.4.0 (1.0.0.0)
Syntax
C#
public static IEnumerable<editDistanceIEditStep<T>> EditSteps<T>(
	this IEnumerable<T> this,
	IEnumerable<T> other,
	IEqualityComparer<T> comp = null,
	bool allowIns = true,
	bool allowDel = true,
	bool allowSub = true,
	double insertWeight = 1,
	double removeWeight = 1,
	double subWeight = 1
)

Parameters

this
Type: System.Collections.GenericIEnumerableT
The starting IEnumerableT.
other
Type: System.Collections.GenericIEnumerableT
The destination IEnumerableT.
comp (Optional)
Type: System.Collections.GenericIEqualityComparerT
The IEqualityComparerT to compare elements. Setting to .
allowIns (Optional)
Type: SystemBoolean
Whether to allow insertions.
allowDel (Optional)
Type: SystemBoolean
Whether to allow deletions.
allowSub (Optional)
Type: SystemBoolean
Whether to allow substations.
insertWeight (Optional)
Type: SystemDouble
weight of an insert step.
removeWeight (Optional)
Type: SystemDouble
weight of a remove step.
subWeight (Optional)
Type: SystemDouble
weight of a substitution step.

Type Parameters

T
The type of this and other's elements.

Return Value

Type: IEnumerableeditDistanceIEditStepT
An enumerable with all the edit steps necessary to turn this into other.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ArgumentExceptionIf no edit paths are found.
ArgumentExceptionIf any of the weights are non-positive.
Remarks

Using dynamic programming, space and time complexity O(n^2).

Because other is enumerated so many times, it is recommended to be more efficient than this, if possible.

See Also