LfrlAnvil.Collections 0.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package LfrlAnvil.Collections --version 0.1.1                
NuGet\Install-Package LfrlAnvil.Collections -Version 0.1.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LfrlAnvil.Collections" Version="0.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LfrlAnvil.Collections --version 0.1.1                
#r "nuget: LfrlAnvil.Collections, 0.1.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install LfrlAnvil.Collections as a Cake Addin
#addin nuget:?package=LfrlAnvil.Collections&version=0.1.1

// Install LfrlAnvil.Collections as a Cake Tool
#tool nuget:?package=LfrlAnvil.Collections&version=0.1.1                

(root) NuGet Badge

LfrlAnvil.Collections

This project contains a few additional collections and data structures. Some of them include different dictionary and set variations (e.g. multi-dictionary and multi-set) as well as heaps and graphs.

Documentation

Technical documentation can be found here.

Examples

This section contains examples of some of the more interesting data structures.

Following is an example of a dictionary heap data structure, which is a heap data structure with the ability to identify contained elements by associated keys:

// creates a new empty dictionary heap, with 'string' as entry key type and 'int' as entry value type
var heap = new DictionaryHeap<string, int>();

// adds a few entries to the heap
// expected order of extraction: ('qux', -1), ('foo', 42), ('bar', 123)
heap.Add( "foo", 42 );
heap.Add( "bar", 123 );
heap.Add( "qux", -1 );

// replaces existing entry's value and returns the old value, while respecting the heap's invariant
// result should be equal to -1
// expected order of extraction after replacement: ('foo', 42), ('bar', 123), ('qux', 456)
var oldValue = heap.Replace( "qux", 456 );

// removes the entry at the top of the heap and returns its value
// result should be equal to 42
var top = heap.Extract();

// returns value of the entry at the top of the heap, without removing it
// result should be equal to 123
var nextTop = heap.Peek();

// gets the value of an entry associated with the provided key
// result should be equal to 456
var qux = heap.GetValue( "qux" );

Following is an example of a directed graph data structure:

// creates a new empty directed graph
// with 'string' as node key type, 'int' as node value type and 'double' as edge value type
var graph = new DirectedGraph<string, int, double>();

// adds a few nodes to the graph, each node has a key and a value
// so far, there are no edges in the graph
var fooNode = graph.AddNode( "foo", 42 );
var barNode = graph.AddNode( "bar", 123 );
var quxNode = graph.AddNode( "qux", -1 );

// adds a 'foo' => 'bar' edge, each edge also has a value
var fooBarEdge = fooNode.AddEdgeTo( "bar", 1.5 );

// adds a 'bar' <=> 'qux' edge
var barQuxEdge = graph.AddEdge( "bar", "qux", 2.25, GraphDirection.Both );

// adds a 'qux' <=> 'qux' edge
var quxSelfEdge = quxNode.AddEdgeTo( quxNode, -0.5 );

// changes the direction of the 'foo' => 'bar' edge to 'foo' <= 'bar'
fooBarEdge.ChangeDirection( GraphDirection.In );

// removes 'foo' <= 'bar' edge
graph.RemoveEdge( "foo", "bar" );

// removes 'qux' node and all associated edges, which includes
// the 'bar' <=> 'qux' edge and the 'qux' <=> 'qux' edge
quxNode.Remove();
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on LfrlAnvil.Collections:

Package Downloads
LfrlAnvil.Reactive.Queues

This project contains a few functionalities related to event queues.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.1 129 6/16/2024
0.2.0 120 6/16/2024
0.1.1 135 5/29/2024
0.1.0 131 5/26/2024