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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Grégoire Locqueville
purescript-gargantext
Commits
09ec80f7
Commit
09ec80f7
authored
Oct 24, 2022
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/454-dev-fix-graphology-edge-ids' into dev
parents
6f08b72a
1afa3fd5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
22 deletions
+17
-22
Graphology.js
src/Gargantext/Hooks/Sigmax/Graphology.js
+17
-22
No files found.
src/Gargantext/Hooks/Sigmax/Graphology.js
View file @
09ec80f7
...
...
@@ -19,39 +19,37 @@ export function _mergeNodeAttributes(g, name, attrs) {
}
export
function
_addEdge
(
g
,
source
,
target
,
e
)
{
return
g
.
addEdge
(
source
,
target
,
e
);
//return g.addEdge(source, target, e);
// NOTE: Our edge.id is the main key. We don't need sigma
// auto-generated keys for edges
return
g
.
addEdgeWithKey
(
e
.
id
,
source
,
target
,
e
);
}
// Almost the same as graphology.mapNodes but with a change that only
// 1 argument is passed: the whole node structure
export
function
_mapNodes
(
g
,
fn
)
{
return
g
.
mapNodes
(
function
(
name
,
attrs
)
{
return
fn
(
{
id
:
name
,
...
attrs
}
);
return
g
.
mapNodes
(
function
(
_
name
,
attrs
)
{
return
fn
(
attrs
);
});
}
export
function
_filterNodes
(
g
,
fn
)
{
return
g
.
filterNodes
(
function
(
name
,
attrs
)
{
return
fn
(
{
id
:
name
,
...
attrs
}
);
return
g
.
filterNodes
(
function
(
_
name
,
attrs
)
{
return
fn
(
attrs
);
})
}
export
function
_forEachEdge
(
g
,
fn
)
{
return
g
.
forEachEdge
(
function
(
name
,
attrs
,
source
,
target
,
sourceAttributes
,
targetAttributes
,
undirected
)
{
return
fn
({
id
:
name
,
source
,
target
,
...
attrs
});
return
g
.
forEachEdge
(
function
(
_name
,
attrs
,
_source
,
_target
,
_sourceAttributes
,
_targetAttributes
,
_undirected
)
{
return
fn
(
attrs
);
});
}
export
function
_updateEachEdgeAttributes
(
g
,
fn
)
{
return
g
.
updateEachEdgeAttributes
(
function
(
name
,
attrs
,
source
,
target
)
{
return
fn
({
id
:
name
,
source
,
target
,
...
attrs
});
return
g
.
updateEachEdgeAttributes
(
function
(
_name
,
attrs
,
_source
,
_target
)
{
return
fn
(
attrs
);
});
}
...
...
@@ -59,16 +57,13 @@ export function _updateEachEdgeAttributes(g, fn) {
// 1 argument is passed: the whole node structure
// https://graphology.github.io/iteration.html#mapedges
export
function
_mapEdges
(
g
,
fn
)
{
return
g
.
mapEdges
(
function
(
name
,
attrs
,
source
,
target
,
sourceAttributes
,
targetAttributes
,
undirected
)
{
return
fn
({
id
:
name
,
source
,
target
,
...
attrs
});
return
g
.
mapEdges
(
function
(
_name
,
attrs
,
_source
,
_target
,
_sourceAttributes
,
_targetAttributes
,
_undirected
)
{
return
fn
(
attrs
);
});
}
export
function
_filterEdges
(
g
,
fn
)
{
return
g
.
filterEdges
(
function
(
name
,
attrs
)
{
return
fn
(
{
id
:
name
,
...
attrs
}
);
return
g
.
filterEdges
(
function
(
_
name
,
attrs
)
{
return
fn
(
attrs
);
})
}
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