summaryrefslogtreecommitdiff
path: root/src/directed_graphs.ads
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2020-04-28 20:54:48 +1000
committerJed Barber <jjbarber@y7mail.com>2020-04-28 20:54:48 +1000
commit2551080276e30000767a318c1896db1eaa506fcc (patch)
tree229702de47d59ebace5426ea40df3254a2bca9c2 /src/directed_graphs.ads
parent0114d6d0701f5678fae802622351e71129657080 (diff)
Switched over to Ordered_Maps
Diffstat (limited to 'src/directed_graphs.ads')
-rw-r--r--src/directed_graphs.ads42
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);