Skip to content
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

Bipartite graphs: a few more properties and graph families #226

Open
wants to merge 7 commits into
base: master
from

Conversation

@vasalf
Copy link
Contributor

commented Jul 23, 2019

No description provided.

@snowleopard

This comment has been minimized.

Copy link
Owner

commented Jul 23, 2019

@vasalf Thanks! Please rebase now that detectParts is merged.

@vasalf vasalf force-pushed the vasalf:bipartiteFamilies branch from 3d72e00 to 70218c9 Jul 24, 2019
vasalf added 2 commits Jul 24, 2019
@snowleopard

This comment has been minimized.

Copy link
Owner

commented Aug 4, 2019

@vasalf Thank you! I've left some comments. Apologies for the delay.

vasalf added 3 commits Aug 7, 2019
@snowleopard

This comment has been minimized.

Copy link
Owner

commented Aug 15, 2019

@vasalf Apologies for taking so long to review and merge. I've left a couple of more suggestions.

-- @
fromListEven :: [(a, b)] -> List a b
fromListEven [] = Nil
fromListEven ((x, y):xt) = Cons x (Cons y (fromListEven xt))

This comment has been minimized.

Copy link
@nobrakal

nobrakal Aug 20, 2019

Contributor

I think we can write fromListEven with foldr:

Suggested change
fromListEven ((x, y):xt) = Cons x (Cons y (fromListEven xt))
fromListEven = foldr (\(x,y) -> Cons x . Cons y) Nil
@@ -709,6 +817,112 @@ biclique xs ys = let sxs = Set.fromList xs
in BAM (Map.fromSet (const sys) sxs)
(Map.fromSet (const sxs) sys)

-- | The /star/ formed by a center vertex connected to a list of leaves.
-- Complexity: /O(L log(L))/ time, where /L/ is the length of the given list.

This comment has been minimized.

Copy link
@nobrakal

nobrakal Aug 20, 2019

Contributor

I think we can add the times sign to be coherent with the rest of the library (here and in others comments).

Suggested change
-- Complexity: /O(L log(L))/ time, where /L/ is the length of the given list.
-- Complexity: /O(L * log(L))/ time, where /L/ is the length of the given list.

This comment has been minimized.

Copy link
@snowleopard

snowleopard Aug 26, 2019

Owner

Yes, we use * in the rest of the library.

type Item (List a a) = a

fromList [] = Nil
fromList (x:xt) = Cons x (fromList xt)

This comment has been minimized.

Copy link
@nobrakal

nobrakal Aug 20, 2019

Contributor

We can use foldr here:

Suggested change
fromList (x:xt) = Cons x (fromList xt)
fromList = foldr Cons Nil
path :: (Ord a, Ord b) => List a b -> AdjacencyMap a b
path Nil = empty
path (Cons x Nil) = leftVertex x
path xs@(Cons _ xt@(Cons _ xr)) = edges $ zip (odds xs) (odds xt) ++

This comment has been minimized.

Copy link
@nobrakal

nobrakal Aug 21, 2019

Contributor

You can factorize odds xt here.

@snowleopard

This comment has been minimized.

Copy link
Owner

commented Sep 10, 2019

@vasalf Just a reminder: I'm awaiting the last few fixes following the comments by @nobrakal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.