Repository navigation
Add DigraphHalfSquare[s] - #964
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #964 +/- ##
=======================================
Coverage 97.47% 97.47%
=======================================
Files 53 53
Lines 21424 21466 +42
Branches 638 638
=======================================
+ Hits 20883 20925 +42
Misses 477 477
Partials 64 64 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| fi; | ||
|
|
||
| # check if U is a bicomponent of D, i.e. no edges between vertices in U | ||
| # can't do 'U in DigraphBicomponents(D)' because the partition isn't unique |
There was a problem hiding this comment.
I'm intrigued by this comment, why is the partition not unique? In what sense? Anyway, if you really only want to check "no edges between vertices in U" then you can use IsIndependentSet(D, U); to replace all these lines.
There was a problem hiding this comment.
From the docs: For a bipartite digraph with at least 3 vertices, there is a unique pair of bicomponents of bipartite if and only if the digraph is connected.
There was a problem hiding this comment.
Ah you're right, of course, not sure what I was thinking
There was a problem hiding this comment.
The other comment might make the code a little simpler though.
mtorpey
left a comment
There was a problem hiding this comment.
Very legible and elegant code, thank you.
Two minor doc things to fix, then I'm happy.
mtorpey
left a comment
There was a problem hiding this comment.
One bad quote mark. Done after that!
A bipartite digraph can be partitioned (not necessarily uniquely) into two sets of vertices (two "sides") such that there are no edges between vertices within a side. Given a digraph and one of these sets of vertices, a half-square is a new digraph on those vertices, with edges between$v_1$ and $v_2$ if there exists a directed path $v_1 \to x \to v_2$ in the original digraph, where $x$ is a vertex on the other side.
DigraphHalfSquaresreturns both the half square of the given side and the other side.This can replace
DIGRAPHS_HalfSquarein PR #922.