Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
0afcba5e
Commit
0afcba5e
authored
Mar 20, 2023
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CLEAN] Towards bipartite graph
parent
37484f3f
Pipeline
#3782
failed with stage
in 0 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
16 deletions
+20
-16
Update.purs
...Gargantext/Components/Forest/Tree/Node/Action/Update.purs
+3
-1
Layout.purs
src/Gargantext/Components/GraphExplorer/Layout.purs
+5
-5
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+4
-3
Types.purs
src/Gargantext/Hooks/Sigmax/Types.purs
+8
-7
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Update.purs
View file @
0afcba5e
...
@@ -119,12 +119,14 @@ updateGraphCpt = here.component "updateGraph" cpt where
...
@@ -119,12 +119,14 @@ updateGraphCpt = here.component "updateGraph" cpt where
, callback: \val -> T.write_ val methodGraphNodeType1
, callback: \val -> T.write_ val methodGraphNodeType1
, print: show } []
, print: show } []
, H.text "NodeType 2 ?"
--}
, H.text "Ngrams ?"
, formChoiceSafe { items: [GT.CTabTerms, GT.CTabSources, GT.CTabAuthors, GT.CTabInstitutes]
, formChoiceSafe { items: [GT.CTabTerms, GT.CTabSources, GT.CTabAuthors, GT.CTabInstitutes]
, default: methodGraphNodeType2'
, default: methodGraphNodeType2'
, callback: \val -> T.write_ val methodGraphNodeType2
, callback: \val -> T.write_ val methodGraphNodeType2
, print: show } []
, print: show } []
{-
, H.text "Show Strong (expected) links or weak (maybe unexpected) links?"
, H.text "Show Strong (expected) links or weak (maybe unexpected) links?"
, formChoiceSafe { items: [Strong, Weak]
, formChoiceSafe { items: [Strong, Weak]
, default: methodGraphEdgesStrength'
, default: methodGraphEdgesStrength'
...
...
src/Gargantext/Components/GraphExplorer/Layout.purs
View file @
0afcba5e
...
@@ -370,12 +370,12 @@ convert (GET.GraphData r) = Tuple r.metaData $ SigmaxT.Graph {nodes, edges}
...
@@ -370,12 +370,12 @@ convert (GET.GraphData r) = Tuple r.metaData $ SigmaxT.Graph {nodes, edges}
-- | See sigmajs/plugins/sigma.renderers.customShapes/shape-library.js
-- | See sigmajs/plugins/sigma.renderers.customShapes/shape-library.js
modeGraphType :: Types.Mode -> String
modeGraphType :: Types.Mode -> String
modeGraphType Types.Authors = "
squar
e"
modeGraphType Types.Authors = "
ccircl
e"
modeGraphType Types.Institutes = "
equilateral
"
modeGraphType Types.Institutes = "
square
"
modeGraphType Types.Sources = "
star
"
modeGraphType Types.Sources = "
diamond
"
--modeGraphType Types.Terms = "def"
--modeGraphType Types.Terms = "def"
--modeGraphType Types.Terms = "circle"
--modeGraphType Types.Terms = "circle"
modeGraphType Types.Terms = "
ccirc
le"
modeGraphType Types.Terms = "
triang
le"
--------------------------------------------------------------
--------------------------------------------------------------
...
@@ -437,7 +437,7 @@ transformGraph graph { edgeConfluence'
...
@@ -437,7 +437,7 @@ transformGraph graph { edgeConfluence'
selectedEdgeIds =
selectedEdgeIds =
Set.fromFoldable
Set.fromFoldable
$ Seq.map _.id
$ Seq.map _.id
$ SigmaxT.neighbo
u
ringEdges graph selectedNodeIds'
$ SigmaxT.neighboringEdges graph selectedNodeIds'
hasSelection = not $ Set.isEmpty selectedNodeIds'
hasSelection = not $ Set.isEmpty selectedNodeIds'
newEdges' = Seq.filter edgeFilter $ Seq.map (
newEdges' = Seq.filter edgeFilter $ Seq.map (
...
...
src/Gargantext/Components/GraphExplorer/Sidebar.purs
View file @
0afcba5e
...
@@ -529,7 +529,7 @@ neighborhoodCpt = R.memo' $ here.component "neighborhood" cpt where
...
@@ -529,7 +529,7 @@ neighborhoodCpt = R.memo' $ here.component "neighborhood" cpt where
let refreshed = neighbourBadges graph' selectedNodeIds'
let refreshed = neighbourBadges graph' selectedNodeIds'
let count = Seq.length refreshed
let count = Seq.length refreshed
let ordered = A.sortWith (\n -> -n.size) $ Seq.toUnfoldable refreshed
let ordered = A.sortWith (\n -> -n.size) $ Seq.toUnfoldable refreshed
T.write_
count
termCountBox
T.write_
(count-1)
termCountBox
T.write_ ordered termListBox
T.write_ ordered termListBox
T.write_ false showMoreBox
T.write_ false showMoreBox
...
@@ -704,7 +704,8 @@ badges :: SigmaxT.SGraph -> SigmaxT.NodeIds -> Seq.Seq (Record SigmaxT.Node)
...
@@ -704,7 +704,8 @@ badges :: SigmaxT.SGraph -> SigmaxT.NodeIds -> Seq.Seq (Record SigmaxT.Node)
badges graph selectedNodeIds = SigmaxT.graphNodes $ SigmaxT.nodesById graph selectedNodeIds
badges graph selectedNodeIds = SigmaxT.graphNodes $ SigmaxT.nodesById graph selectedNodeIds
neighbourBadges :: SigmaxT.SGraph -> SigmaxT.NodeIds -> Seq.Seq (Record SigmaxT.Node)
neighbourBadges :: SigmaxT.SGraph -> SigmaxT.NodeIds -> Seq.Seq (Record SigmaxT.Node)
neighbourBadges graph selectedNodeIds = SigmaxT.neighbours graph selectedNodes' where
neighbourBadges graph selectedNodeIds = SigmaxT.neighbors graph selectedNodes'
where
selectedNodes' = SigmaxT.graphNodes $ SigmaxT.nodesById graph selectedNodeIds
selectedNodes' = SigmaxT.graphNodes $ SigmaxT.nodesById graph selectedNodeIds
---------------------------------------------------------
---------------------------------------------------------
...
...
src/Gargantext/Hooks/Sigmax/Types.purs
View file @
0afcba5e
...
@@ -14,7 +14,7 @@ import Data.Traversable (class Traversable)
...
@@ -14,7 +14,7 @@ import Data.Traversable (class Traversable)
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import Effect (Effect)
import Effect (Effect)
import Partial.Unsafe (unsafePartial)
import Partial.Unsafe (unsafePartial)
import Prelude (class Eq, class Show, map, ($), (&&), (==), (||), (<$>), (<), mod, not, pure)
import Prelude (class Eq, class Show, map, ($), (&&), (==), (||), (<$>), (<), mod, not, pure
, (<=)
)
import Record.Unsafe (unsafeGet, unsafeSet)
import Record.Unsafe (unsafeGet, unsafeSet)
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..))
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..))
...
@@ -171,7 +171,8 @@ graphEdges (Graph {edges}) = edges
...
@@ -171,7 +171,8 @@ graphEdges (Graph {edges}) = edges
graphNodes :: SGraph -> Seq.Seq (Record Node)
graphNodes :: SGraph -> Seq.Seq (Record Node)
graphNodes (Graph {nodes}) = nodes
graphNodes (Graph {nodes}) = nodes
idMap :: forall r t. Traversable t => t { id :: String | r } -> Map.Map String { id :: String | r }
idMap :: forall r t. Traversable t
=> t { id :: String | r } -> Map.Map String { id :: String | r }
idMap xs = Map.fromFoldable $ (\x@{ id } -> Tuple id x) <$> xs
idMap xs = Map.fromFoldable $ (\x@{ id } -> Tuple id x) <$> xs
edgesGraphMap :: SGraph -> EdgesMap
edgesGraphMap :: SGraph -> EdgesMap
...
@@ -204,16 +205,16 @@ sub graph (Graph {nodes, edges}) = newGraph
...
@@ -204,16 +205,16 @@ sub graph (Graph {nodes, edges}) = newGraph
filteredEdges = edgesFilter edgeFilterFunc graph
filteredEdges = edgesFilter edgeFilterFunc graph
newGraph = nodesFilter (\n -> not (Set.member n.id nodeIds)) filteredEdges
newGraph = nodesFilter (\n -> not (Set.member n.id nodeIds)) filteredEdges
neighbo
u
rs :: SGraph -> Seq.Seq (Record Node) -> Seq.Seq (Record Node)
neighbors :: SGraph -> Seq.Seq (Record Node) -> Seq.Seq (Record Node)
neighbo
urs g nodes = Seq.fromFoldable $ Set.unions [Set.fromFoldable nodes, sources, target
s]
neighbo
rs g nodes = Seq.fromFoldable $ Set.unions [if Set.size sources <= 1 then targets else source
s]
where
where
nodeIds = Set.fromFoldable $ Seq.map _.id nodes
nodeIds = Set.fromFoldable $ Seq.map _.id nodes
selectedEdges = neighbo
u
ringEdges g nodeIds
selectedEdges = neighboringEdges g nodeIds
sources = Set.fromFoldable $ graphNodes $ nodesById g $ Set.fromFoldable $ Seq.map _.source selectedEdges
sources = Set.fromFoldable $ graphNodes $ nodesById g $ Set.fromFoldable $ Seq.map _.source selectedEdges
targets = Set.fromFoldable $ graphNodes $ nodesById g $ Set.fromFoldable $ Seq.map _.target selectedEdges
targets = Set.fromFoldable $ graphNodes $ nodesById g $ Set.fromFoldable $ Seq.map _.target selectedEdges
neighbo
u
ringEdges :: SGraph -> NodeIds -> Seq.Seq (Record Edge)
neighboringEdges :: SGraph -> NodeIds -> Seq.Seq (Record Edge)
neighbo
u
ringEdges g nodeIds = Seq.filter condition $ graphEdges g
neighboringEdges g nodeIds = Seq.filter condition $ graphEdges g
where
where
condition {source, target} = (Set.member source nodeIds) || (Set.member target nodeIds)
condition {source, target} = (Set.member source nodeIds) || (Set.member target nodeIds)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment