/// <summary>This constructor is for cloning purposes.</summary> /// <param name="set">The set to clone.</param> /// <runtime>O(n)</runtime> internal SetHashLinked(SetHashLinked <T> set) { _equate = set._equate; _hash = set._hash; _table = (Node[])set._table.Clone(); _count = set._count; }
private SetHashLinked(SetHashLinked <T> setHashList) { this._equate = setHashList._equate; this._hash = setHashList._hash; this._table = setHashList._table.Clone() as Node[]; this._count = setHashList._count; }
/// <summary>Constructs a new GraphSetOmnitree.</summary> /// <param name="equate">The equate delegate for the data structure to use.</param> /// <param name="compare">The compare delegate for the data structure to use.</param> /// <param name="hash">The hash delegate for the datastructure to use.</param> public GraphSetOmnitree(Equate <T> equate, Compare <T> compare, Hash <T> hash) { _nodes = new SetHashLinked <T>(equate, hash); _edges = new OmnitreePointsLinked <Edge, T, T>( (Edge a, out T start, out T end) => { start = a.Start; end = a.End; }, compare, compare); }
/// <summary>Adds an edge to the graph.</summary> /// <param name="start">The starting point of the edge.</param> /// <param name="end">The ending point of the edge.</param> public void Add(T start, T end) { if (!_map.Contains(start)) { throw new InvalidOperationException("Adding an edge to a non-existing starting node."); } if (!_map[start].Contains(end)) { throw new InvalidOperationException("Adding an edge to a non-existing ending node."); } if (_map[start] is null) { _map[start] = new SetHashLinked <T>(_map.Equate, _map.Hash); } _map[start].Add(end); }
/// <summary>Constructs a new GraphSetOmnitree.</summary> /// <param name="equate">The equate delegate for the data structure to use.</param> /// <param name="compare">The compare delegate for the data structure to use.</param> /// <param name="hash">The hash delegate for the datastructure to use.</param> public GraphSetOmnitree( Equate <T> equate = null, Compare <T> compare = null, Hash <T> hash = null) { equate = equate ?? Equate.Default; compare = compare ?? Compare.Default; hash = hash ?? Hash.Default; _nodes = new SetHashLinked <T>(equate, hash); _edges = new OmnitreePointsLinked <Edge, T, T>( (Edge a, out T start, out T end) => { start = a.Start; end = a.End; }, compare, compare); }
/// <summary>Constructs a new GraphSetOmnitree.</summary> /// <param name="equate">The equate delegate for the data structure to use.</param> /// <param name="compare">The compare delegate for the data structure to use.</param> /// <param name="hash">The hash delegate for the datastructure to use.</param> public GraphSetOmnitree( Func <T, T, bool>?equate = null, Func <T, T, CompareResult>?compare = null, Func <T, int>?hash = null) { equate ??= Equate; compare ??= Compare; hash ??= DefaultHash; _nodes = new SetHashLinked <T>(equate, hash); _edges = new OmnitreePointsLinked <Edge, T, T>( (Edge a, out T start, out T end) => { start = a.Start; end = a.End; }, compare, compare); }
/// <summary>This constructor is for cloning purposes.</summary> /// <param name="graph">The graph to construct a clone of.</param> internal GraphSetOmnitree(GraphSetOmnitree <T> graph) { _edges = graph._edges.Clone() as OmnitreePointsLinked <Edge, T, T>; _nodes = graph._nodes.Clone() as SetHashLinked <T>; }
/// <summary>This constructor is for cloning purposes.</summary> /// <param name="graph">The graph to construct a clone of.</param> internal GraphSetOmnitree(GraphSetOmnitree <T> graph) { _edges = graph._edges.Clone(); _nodes = graph._nodes.Clone(); }
public Node(T?parent, SetHashLinked <T, TEquate, THash> children) { Parent = parent; Children = children; }
public Node(T parent, SetHashLinked <T> children) { Parent = parent; Children = children; }
private GraphSetOmnitree(GraphSetOmnitree <T> graph) { this._edges = graph._edges.Clone() as OmnitreePointsLinked <Edge, T, T>; this._nodes = graph._nodes.Clone() as SetHashLinked <T>; }