diff options
Diffstat (limited to 'src/directed_graphs.ads')
-rw-r--r-- | src/directed_graphs.ads | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/src/directed_graphs.ads b/src/directed_graphs.ads index 854bf8e..77d9850 100644 --- a/src/directed_graphs.ads +++ b/src/directed_graphs.ads @@ -9,7 +9,7 @@ private with Ada.Containers.Helpers, Ada.Finalization, Ada.Streams, - Ada.Containers.Hashed_Maps, + Ada.Containers.Ordered_Maps, Ada.Containers.Vectors; @@ -22,6 +22,10 @@ generic type Edge_Label_Type is private; with function "=" + (Left, Right : in Node_Type) + return Boolean is <>; + + with function "=" (Left, Right : in Node_Label_Type) return Boolean is <>; @@ -50,6 +54,10 @@ package Directed_Graphs is type Edge_Array is array (Positive range <>) of Edge_Type; + function "<" + (Left, Right : in Edge_Type) + return Boolean; + @@ -619,40 +627,28 @@ private (Index_Type => Positive, Element_Type => Node_Type); - package Vector_Sort is new Node_Vectors.Generic_Sorting; + function "=" + (Left, Right : in Node_Vectors.Vector) + return Boolean renames Node_Vectors."="; + + package Node_Sort is new Node_Vectors.Generic_Sorting; package Edge_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Edge_Type); - function To_Hash - (Node : in Node_Type) - return Ada.Containers.Hash_Type; - - function To_Hash - (Edge : in Edge_Type) - return Ada.Containers.Hash_Type; - - package Node_Maps is new Ada.Containers.Hashed_Maps + package Node_Maps is new Ada.Containers.Ordered_Maps (Key_Type => Node_Type, Element_Type => Node_Vectors.Vector, - Hash => To_Hash, - Equivalent_Keys => "=", "=" => Node_Vectors."="); - package Node_Label_Maps is new Ada.Containers.Hashed_Maps + package Node_Label_Maps is new Ada.Containers.Ordered_Maps (Key_Type => Node_Type, - Element_Type => Node_Label_Type, - Hash => To_Hash, - Equivalent_Keys => "=", - "=" => "="); + Element_Type => Node_Label_Type); - package Edge_Label_Maps is new Ada.Containers.Hashed_Maps + package Edge_Label_Maps is new Ada.Containers.Ordered_Maps (Key_Type => Edge_Type, - Element_Type => Edge_Label_Type, - Hash => To_Hash, - Equivalent_Keys => "=", - "=" => "="); + Element_Type => Edge_Label_Type); |