Arborescence.Models.Specialized
0.16.0-preview
See the version list below for details.
dotnet add package Arborescence.Models.Specialized --version 0.16.0-preview
NuGet\Install-Package Arborescence.Models.Specialized -Version 0.16.0-preview
<PackageReference Include="Arborescence.Models.Specialized" Version="0.16.0-preview" />
paket add Arborescence.Models.Specialized --version 0.16.0-preview
#r "nuget: Arborescence.Models.Specialized, 0.16.0-preview"
// Install Arborescence.Models.Specialized as a Cake Addin #addin nuget:?package=Arborescence.Models.Specialized&version=0.16.0-preview&prerelease // Install Arborescence.Models.Specialized as a Cake Tool #tool nuget:?package=Arborescence.Models.Specialized&version=0.16.0-preview&prerelease
Models.Specialized — Arborescence Graph Library
This package provides an efficient implementation of Out-Edges Incidence and Out-Neighbors Adjacency for a special case of integer vertices from contiguous range.
┌ tail : E → V?
Graph ┤
└ head : E → V? ┐
├ Forward Incidence
out-edges : V → [E] ┘
out-neighbors: V → [V]
Int32AdjacencyGraph
represents a directed multigraph (permitting loops) with edges not having their own identity [1].
Int32IncidenceGraph
represents a directed multigraph (permitting loops) with edges having their own identity [2].
Vertices are represented as integers and must fill the range [0..VertexCount).
Edges are stored as incidence lists in contiguous spans.
Basic usage
Let's consider this simple graph:
┌──>──┐
(0) (1)─>─(2)─>─(3)┐
└──<──┘ └<┘
This is how to recreate it in the code:
Endpoints<int>[] edges =
{
new(1, 2),
new(1, 2),
new(2, 1),
new(2, 3),
new(3, 3)
};
Int32AdjacencyGraph graph =
Int32AdjacencyGraphFactory.FromEdges(edges);
Console.WriteLine(graph.VertexCount);
The expected output is 4
— including vertex 0, even if it was not specified when creating the graph.
The number of vertices is determined as one plus the maximum id of the vertices, so they fill the range [0..VertexCount).
Now let's explore the edges incident to vertex 2:
const int vertex = 2;
var edgeEnumerator = graph.EnumerateOutEdges(vertex);
while (edgeEnumerator.MoveNext())
{
var edge = edgeEnumerator.Current;
Debug.Assert(graph.TryGetTail(edge, out int tail) &&
tail == vertex);
if (graph.TryGetHead(edge, out int head))
Console.WriteLine(head);
}
The expected output — all the neighbors of vertex 2:
1
3
[1] https://en.wikipedia.org/wiki/Multigraph#Directed_multigraph_(edges_without_own_identity)
[2] https://en.wikipedia.org/wiki/Multigraph#Directed_multigraph_(edges_with_own_identity)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Arborescence.Abstractions (>= 0.16.0)
- Arborescence.Models (>= 0.16.0)
- Arborescence.Primitives.Specialized (>= 0.16.0-preview)
-
net6.0
- Arborescence.Abstractions (>= 0.16.0)
- Arborescence.Models (>= 0.16.0)
- Arborescence.Primitives.Specialized (>= 0.16.0-preview)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.