-
Notifications
You must be signed in to change notification settings - Fork 59
Digraph distance attributes #761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
126cbb2
4a3fbbb
12c5b9b
561f59d
c66f3b7
a06da22
16d09e8
10eaefb
a4b9f28
0f631e0
3519123
5d81e18
4684f3b
e11fd25
252e1d8
de526a4
1cd445f
3190ce4
612054b
06a6e64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -3431,3 +3431,42 @@ D -> DIGRAPHS_IsJoinSemilatticeAndJoinTable(D)[2]); | |||||||||
InstallMethod(DigraphMeetTable, "for a digraph", | ||||||||||
[IsDigraph], | ||||||||||
D -> DIGRAPHS_IsMeetSemilatticeAndMeetTable(D)[2]); | ||||||||||
|
||||||||||
InstallMethod(DigraphDistanceMetrics, "for a digraph", | ||||||||||
[IsDigraph], | ||||||||||
function(G) | ||||||||||
local ecc, c, u, v; | ||||||||||
if not IsDigraph(G) then | ||||||||||
Error("Input must be a digraph"); | ||||||||||
elif not IsStronglyConnectedDigraph(G) then | ||||||||||
Comment on lines
+3439
to
+3441
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
The first if clause is redundant. |
||||||||||
Error("Input digraph is not strongly connected; property undefined"); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And please make a similar change for the error message a few lines above. |
||||||||||
fi; | ||||||||||
ecc := []; | ||||||||||
for u in [1 .. DigraphNrVertices(G)] do | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
c := 0; | ||||||||||
for v in [1 .. DigraphNrVertices(G)] do | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
if u <> v then | ||||||||||
c := Maximum(c, DigraphShortestDistance(G, u, v)); | ||||||||||
fi; | ||||||||||
od; | ||||||||||
Add(ecc, c); | ||||||||||
od; | ||||||||||
return rec( | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not 100% sure but I think the following is not particularly efficient because the computation of |
||||||||||
Radius := Minimum(ecc), | ||||||||||
DigraphCentre := Filtered([1 .. DigraphNrVertices(G)], | ||||||||||
i -> ecc[i] = Minimum(ecc)), | ||||||||||
Periphery := Filtered([1 .. DigraphNrVertices(G)], | ||||||||||
i -> ecc[i] = Maximum(ecc))); | ||||||||||
end); | ||||||||||
|
||||||||||
InstallMethod(DigraphRadius, "for a digraph", | ||||||||||
[IsDigraph], | ||||||||||
D -> DigraphDistanceMetrics(D).Radius); | ||||||||||
|
||||||||||
InstallMethod(DigraphCentre, "for a digraph", | ||||||||||
[IsDigraph], | ||||||||||
D -> DigraphDistanceMetrics(D).DigraphCentre); | ||||||||||
|
||||||||||
InstallMethod(DigraphPeriphery, "for a digraph", | ||||||||||
[IsDigraph], | ||||||||||
D -> DigraphDistanceMetrics(D).Periphery); |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
G
should be changed toD
everywhere here, for consistency.