-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathweights.gd
More file actions
51 lines (44 loc) · 2.1 KB
/
weights.gd
File metadata and controls
51 lines (44 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#############################################################################
##
## weights.gd
## Copyright (C) 2023 Raiyan Chowdhury
##
## Licensing information can be found in the README file of this package.
##
#############################################################################
##
# 1. Edge Weights
DeclareAttribute("EdgeWeights", IsDigraph);
DeclareGlobalFunction("EdgeWeightedDigraph");
DeclareProperty("IsNegativeEdgeWeightedDigraph", IsDigraph and HasEdgeWeights);
DeclareAttribute("EdgeWeightedDigraphTotalWeight",
IsDigraph and HasEdgeWeights);
DeclareAttribute("UnitEdgeWeightedDigraph", IsDigraph);
# 2. Edge Weight Copies
DeclareOperation("EdgeWeightsMutableCopy", [IsDigraph and HasEdgeWeights]);
# 3. Minimum Spanning Trees
DeclareAttribute("EdgeWeightedDigraphMinimumSpanningTree",
IsDigraph and HasEdgeWeights);
# 4. Shortest Path
DeclareAttribute("EdgeWeightedDigraphShortestPaths",
IsDigraph and HasEdgeWeights);
DeclareOperation("EdgeWeightedDigraphShortestPaths",
[IsDigraph and HasEdgeWeights, IsPosInt]);
DeclareOperation("EdgeWeightedDigraphShortestPath",
[IsDigraph and HasEdgeWeights, IsPosInt, IsPosInt]);
DeclareGlobalFunction("DIGRAPHS_Edge_Weighted_Johnson");
DeclareGlobalFunction("DIGRAPHS_Edge_Weighted_FloydWarshall");
DeclareGlobalFunction("DIGRAPHS_Edge_Weighted_Bellman_Ford");
DeclareGlobalFunction("DIGRAPHS_Edge_Weighted_Dijkstra");
# 5. Maximum Flow
DeclareOperation("DigraphMaximumFlow",
[IsDigraph and HasEdgeWeights, IsPosInt, IsPosInt]);
# 6. Random edge weighted digraphs
DeclareOperation("RandomUniqueEdgeWeightedDigraph", [IsPosInt]);
DeclareOperation("RandomUniqueEdgeWeightedDigraph", [IsPosInt, IsFloat]);
DeclareOperation("RandomUniqueEdgeWeightedDigraph", [IsPosInt, IsRat]);
DeclareOperation("RandomUniqueEdgeWeightedDigraph", [IsFunction, IsPosInt]);
DeclareOperation("RandomUniqueEdgeWeightedDigraph",
[IsFunction, IsPosInt, IsFloat]);
DeclareOperation("RandomUniqueEdgeWeightedDigraph",
[IsFunction, IsPosInt, IsRat]);