Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in
haskell-gargantext
haskell-gargantext
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 179
    • Issues 179
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 10
    • Merge Requests 10
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • gargantext
  • haskell-gargantexthaskell-gargantext
  • Issues
  • #445

Closed
Open
Opened Jan 30, 2025 by david Chavalarias@davidchavalarias
  • Report abuse
  • New issue
Report abuse New issue

Order 1 advanced distance

Summary

The goal is to implement an advanced Order 1 distance such that interclusters links are filtered according to their absolute weight.

Where

The function to add is in Gargantext > Core > Viz > Graph > Bridgeness.hs It is a variant of filterComs :

---- This function implemented in Order 1 graph distance, to be renamed something like 'O1 simple' takes the same number of links for each clusters pairs. ---------

filterComs :: (Ord n1, Eq n2)
           => Int
           -> Map (n2, n2) [(a3, n1)]
           -> Map (n2, n2) [(a3, n1)]
filterComs b m = Map.filter (\n -> length n > 0) $ mapWithKey filter' m
  where
    filter' (c1,c2) a
      | c1 == c2  = a
      -- TODO use n here
      | otherwise = take (b * 2*n) $ List.sortOn (Down . snd) a
           where
            n :: Int
            n = round $ 100 * a' / t
            a'= fromIntegral $ length a
            t :: Double
            t = fromIntegral $ length $ List.concat $ elems m

The alternative function, filterComs', let's call it for now 'Order1 Advanced', filter all inter-cluster links below a threshold. This threshold should ideally be a parameter at generation:

-- Weak links are often due to noise in the data and decrease the readability of the graph. 
-- This function prunes the links between the clusters when their weight is under a given 'threshold'.  
filterComs' :: (Ord a1, Fractional a1, Eq a2) =>
                     Int -> Map (a2, a2) [(a3, a1)] -> Map (a2, a2) [(a3, a1)]
filterComs' _b m = Map.filter (\n -> length n > 0) $ mapWithKey filter' m
  where
    threshold=0.03 -- this threshold will be moved to user parameters
    filter' (c1,c2) xs
      | c1 == c2  = xs
      | otherwise = List.filter (\(_nn,v) -> v >= threshold) xs

The goal of this issue is to create a new choice in the Graph distance drop down: Place to add a third option for graph distance

such that users can choose either simple O1 maps that highlights clusters or advanced O1 maps that enable to explore the relations between clusters.

Assignee
Assign to
Stabilisation
Milestone
Stabilisation
Assign milestone
Time tracking
None
Due date
None
2
Labels
Doing New feature
Assign labels
  • View project labels
Reference: gargantext/haskell-gargantext#445