Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
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
david Chavalarias
clinicaltrials
Commits
dfd5cab4
Commit
dfd5cab4
authored
May 11, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
with strict: ensure all parseCustom vars are declared
parent
cd888bf2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
57 deletions
+53
-57
sigma.parseCustom.js
tinawebJS/sigma.parseCustom.js
+53
-57
No files found.
tinawebJS/sigma.parseCustom.js
View file @
dfd5cab4
'use strict'
;
// TODO REFA longterm refactoring: scanXX and dictifyXX is doing double work
// TODO REFA longterm refactoring: scanXX and dictifyXX is doing double work
// (for instance loop on full gexf in scanGexf then again in dictfyGexf)
// (for instance loop on full gexf in scanGexf then again in dictfyGexf)
...
@@ -67,6 +67,7 @@ ParseCustom.prototype.scanFile = function() {
...
@@ -67,6 +67,7 @@ ParseCustom.prototype.scanFile = function() {
// Level-02
// Level-02
ParseCustom
.
prototype
.
makeDicts
=
function
(
categories
)
{
ParseCustom
.
prototype
.
makeDicts
=
function
(
categories
)
{
let
dictionaries
=
{}
switch
(
this
.
format
)
{
switch
(
this
.
format
)
{
case
"api.json"
:
case
"api.json"
:
console
.
log
(
"makeDicts: "
+
this
.
format
)
console
.
log
(
"makeDicts: "
+
this
.
format
)
...
@@ -172,17 +173,17 @@ function scanGexf(gexfContent) {
...
@@ -172,17 +173,17 @@ function scanGexf(gexfContent) {
var
declaredAttrs
=
gexfCheckAttributesMap
(
gexfContent
)
var
declaredAttrs
=
gexfCheckAttributesMap
(
gexfContent
)
elsNodes
=
gexfContent
.
getElementsByTagName
(
'nodes'
);
let
elsNodes
=
gexfContent
.
getElementsByTagName
(
'nodes'
);
// console.debug('>>> tr: elsNodes', elsNodes) // <<<
// console.debug('>>> tr: elsNodes', elsNodes) // <<<
for
(
i
=
0
;
i
<
elsNodes
.
length
;
i
++
){
for
(
i
=
0
;
i
<
elsNodes
.
length
;
i
++
){
var
elNodes
=
elsNodes
[
i
];
// Each xml node 'nodes' (plural)
var
elNodes
=
elsNodes
[
i
];
// Each xml node 'nodes' (plural)
node
=
elNodes
.
getElementsByTagName
(
'node'
);
let
node
=
elNodes
.
getElementsByTagName
(
'node'
);
for
(
j
=
0
;
j
<
node
.
length
;
j
++
){
for
(
j
=
0
;
j
<
node
.
length
;
j
++
){
attvalueNodes
=
node
[
j
].
getElementsByTagName
(
'attvalue'
);
let
attvalueNodes
=
node
[
j
].
getElementsByTagName
(
'attvalue'
);
for
(
k
=
0
;
k
<
attvalueNodes
.
length
;
k
++
){
for
(
k
=
0
;
k
<
attvalueNodes
.
length
;
k
++
){
attvalueNode
=
attvalueNodes
[
k
];
let
attvalueNode
=
attvalueNodes
[
k
];
attr
=
attvalueNode
.
getAttribute
(
'for'
);
let
attr
=
attvalueNode
.
getAttribute
(
'for'
);
val
=
attvalueNode
.
getAttribute
(
'value'
);
let
val
=
attvalueNode
.
getAttribute
(
'value'
);
// some attrs are gexf-local indices refering to an <attributes> declaration
// some attrs are gexf-local indices refering to an <attributes> declaration
// so if it matches declared we translate their integer in title
// so if it matches declared we translate their integer in title
...
@@ -205,9 +206,7 @@ function scanGexf(gexfContent) {
...
@@ -205,9 +206,7 @@ function scanGexf(gexfContent) {
}
}
// sorting observed json node types into Sem (=> 1)/Soc (=> 0)
// sorting observed json node types into Sem (=> 1)/Soc (=> 0)
result
=
sortNodeTypes
(
categoriesDict
)
return
sortNodeTypes
(
categoriesDict
)
return
result
;
}
}
// sorting observed node types into Sem/Soc (factorized 11/05/2017)
// sorting observed node types into Sem/Soc (factorized 11/05/2017)
...
@@ -245,7 +244,7 @@ function sortNodeTypes(observedTypesDict) {
...
@@ -245,7 +244,7 @@ function sortNodeTypes(observedTypesDict) {
// POSSible: allow more than 2 cats
// POSSible: allow more than 2 cats
for
(
var
i
in
observedTypes
)
{
for
(
var
i
in
observedTypes
)
{
c
=
observedTypes
[
i
]
let
c
=
observedTypes
[
i
]
if
(
c
==
TW
.
catSoc
||
(
c
!=
TW
.
catSem
&&
c
.
indexOf
(
"term"
)
==-
1
))
{
// NOT a term-category
if
(
c
==
TW
.
catSoc
||
(
c
!=
TW
.
catSem
&&
c
.
indexOf
(
"term"
)
==-
1
))
{
// NOT a term-category
newcats
[
0
]
=
c
;
newcats
[
0
]
=
c
;
catDict
[
c
]
=
0
;
catDict
[
c
]
=
0
;
...
@@ -323,10 +322,10 @@ function dictfyGexf( gexf , categories ){
...
@@ -323,10 +322,10 @@ function dictfyGexf( gexf , categories ){
// [ get Size ]
// [ get Size ]
var
size
=
false
;
var
size
=
false
;
sizeNodes
=
elNode
.
getElementsByTagName
(
'size'
);
let
sizeNodes
=
elNode
.
getElementsByTagName
(
'size'
);
sizeNodes
=
sizeNodes
.
length
?
sizeNodes
:
elNode
.
getElementsByTagName
(
'viz:size'
);
sizeNodes
=
sizeNodes
.
length
?
sizeNodes
:
elNode
.
getElementsByTagName
(
'viz:size'
);
if
(
sizeNodes
.
length
>
0
){
if
(
sizeNodes
.
length
>
0
){
sizeNode
=
sizeNodes
[
0
];
let
sizeNode
=
sizeNodes
[
0
];
size
=
parseFloat
(
sizeNode
.
getAttribute
(
'value'
));
size
=
parseFloat
(
sizeNode
.
getAttribute
(
'value'
));
// debug: for stats ---------------------------
// debug: for stats ---------------------------
...
@@ -357,7 +356,7 @@ function dictfyGexf( gexf , categories ){
...
@@ -357,7 +356,7 @@ function dictfyGexf( gexf , categories ){
colorNodes
=
colorNodes
.
length
?
colorNodes
:
elNode
.
getElementsByTagNameNS
(
'*'
,
'color'
);
colorNodes
=
colorNodes
.
length
?
colorNodes
:
elNode
.
getElementsByTagNameNS
(
'*'
,
'color'
);
var
color
;
var
color
;
if
(
colorNodes
.
length
>
0
){
if
(
colorNodes
.
length
>
0
){
colorNode
=
colorNodes
[
0
];
let
colorNode
=
colorNodes
[
0
];
color
=
'#'
+
sigmaTools
.
rgbToHex
(
parseFloat
(
colorNode
.
getAttribute
(
'r'
)),
color
=
'#'
+
sigmaTools
.
rgbToHex
(
parseFloat
(
colorNode
.
getAttribute
(
'r'
)),
parseFloat
(
colorNode
.
getAttribute
(
'g'
)),
parseFloat
(
colorNode
.
getAttribute
(
'g'
)),
parseFloat
(
colorNode
.
getAttribute
(
'b'
)));
parseFloat
(
colorNode
.
getAttribute
(
'b'
)));
...
@@ -389,6 +388,7 @@ function dictfyGexf( gexf , categories ){
...
@@ -389,6 +388,7 @@ function dictfyGexf( gexf , categories ){
}
}
node
.
attributes
=
atts
;
node
.
attributes
=
atts
;
let
node_cat
=
""
// nodew=parseInt(attributes["weight"]);
// nodew=parseInt(attributes["weight"]);
if
(
atts
[
"category"
]
)
{
if
(
atts
[
"category"
]
)
{
node_cat
=
atts
[
"category"
];
node_cat
=
atts
[
"category"
];
...
@@ -398,9 +398,9 @@ function dictfyGexf( gexf , categories ){
...
@@ -398,9 +398,9 @@ function dictfyGexf( gexf , categories ){
node_cat
=
categories
[
0
]
node_cat
=
categories
[
0
]
}
}
node
.
type
=
node_cat
;
if
(
!
catCount
[
node_cat
])
catCount
[
node_cat
]
=
0
if
(
!
catCount
[
node_cat
])
catCount
[
node_cat
]
=
0
catCount
[
node_cat
]
++
;
catCount
[
node_cat
]
++
;
node
.
type
=
node_cat
;
// node.id = (node_cat==categories[0])? ("D:"+node.id) : ("N:"+node.id);
// node.id = (node_cat==categories[0])? ("D:"+node.id) : ("N:"+node.id);
if
(
!
node
.
size
)
console
.
log
(
"node without size: "
+
node
.
id
+
" : "
+
node
.
label
);
if
(
!
node
.
size
)
console
.
log
(
"node without size: "
+
node
.
id
+
" : "
+
node
.
label
);
...
@@ -445,7 +445,7 @@ function dictfyGexf( gexf , categories ){
...
@@ -445,7 +445,7 @@ function dictfyGexf( gexf , categories ){
}
}
// console.warn ('parseCustom output nodes', nodes)
// console.warn ('parseCustom output nodes', nodes)
// console.warn ('parseCustom inverted index: vals to
ids
', tmpVals)
// console.warn ('parseCustom inverted index: vals to
srcType
', tmpVals)
// -------------- debug: for local stats ----------------
// -------------- debug: for local stats ----------------
// allSizes.sort();
// allSizes.sort();
...
@@ -468,7 +468,7 @@ function dictfyGexf( gexf , categories ){
...
@@ -468,7 +468,7 @@ function dictfyGexf( gexf , categories ){
// clusters and other facets => type => name => [{label,val/range,nodeids}]
// clusters and other facets => type => name => [{label,val/range,nodeids}]
TW
.
Clusters
=
{}
TW
.
Clusters
=
{}
// sorting out properties in n.attributes ==> £TODO shared function up to classvalues_fin
// sorting out properties in n.attributes ==> £TODO shared function
createClusterIndex()
up to classvalues_fin
// --------------------------------------
// --------------------------------------
if
(
gotClusters
)
{
if
(
gotClusters
)
{
...
@@ -642,6 +642,7 @@ function dictfyGexf( gexf , categories ){
...
@@ -642,6 +642,7 @@ function dictfyGexf( gexf , categories ){
}
}
// £TODO second shared function: createRelations() (same for gexf/json)
var
edgeId
=
0
;
var
edgeId
=
0
;
var
edgesNodes
=
gexf
.
getElementsByTagName
(
'edges'
);
var
edgesNodes
=
gexf
.
getElementsByTagName
(
'edges'
);
...
@@ -667,7 +668,7 @@ function dictfyGexf( gexf , categories ){
...
@@ -667,7 +668,7 @@ function dictfyGexf( gexf , categories ){
attributes
:
[]
attributes
:
[]
};
};
edge_weight
=
edgeNode
.
getAttribute
(
'weight'
)
let
edge_weight
=
edgeNode
.
getAttribute
(
'weight'
)
edge
.
weight
=
(
edge_weight
)?
edge_weight
:
1
;
edge
.
weight
=
(
edge_weight
)?
edge_weight
:
1
;
var
kind
;
var
kind
;
...
@@ -687,21 +688,21 @@ function dictfyGexf( gexf , categories ){
...
@@ -687,21 +688,21 @@ function dictfyGexf( gexf , categories ){
if
(
nodes
[
source
]
&&
nodes
[
target
]
)
{
if
(
nodes
[
source
]
&&
nodes
[
target
]
)
{
// console.debug('>>> tr: new edge has matching source and target nodes')
// console.debug('>>> tr: new edge has matching source and target nodes')
idS
=
nodes
[
source
].
type
;
let
srcType
=
nodes
[
source
].
type
;
idT
=
nodes
[
target
].
type
;
let
tgtType
=
nodes
[
target
].
type
;
// if(source==89 || target==89) console.log(edge)
// if(source==89 || target==89) console.log(edge)
// [ New Code! ]
// [ New Code! ]
petitDict
=
{}
let
petitDict
=
{}
petitDict
[
nodes
[
source
].
type
]
=
true
;
petitDict
[
nodes
[
source
].
type
]
=
true
;
petitDict
[
nodes
[
target
].
type
]
=
true
;
petitDict
[
nodes
[
target
].
type
]
=
true
;
idInRelations
=
[]
let
idInRelations
=
[]
for
(
var
c
in
petitDict
)
idInRelations
[
catDict
[
c
]]
=
true
;
for
(
var
c
in
petitDict
)
idInRelations
[
catDict
[
c
]]
=
true
;
for
(
var
c
=
0
;
c
<
categories
.
length
;
c
++
)
{
for
(
var
c
=
0
;
c
<
categories
.
length
;
c
++
)
{
if
(
!
idInRelations
[
c
])
idInRelations
[
c
]
=
false
;
if
(
!
idInRelations
[
c
])
idInRelations
[
c
]
=
false
;
}
}
idArray
=
idInRelations
.
map
(
Number
).
join
(
"|"
)
let
idArray
=
idInRelations
.
map
(
Number
).
join
(
"|"
)
edge
.
categ
=
idArray
;
edge
.
categ
=
idArray
;
if
(
!
TW
.
Relations
[
idArray
])
TW
.
Relations
[
idArray
]
=
{}
if
(
!
TW
.
Relations
[
idArray
])
TW
.
Relations
[
idArray
]
=
{}
...
@@ -713,7 +714,7 @@ function dictfyGexf( gexf , categories ){
...
@@ -713,7 +714,7 @@ function dictfyGexf( gexf , categories ){
// Doc <-> Doc
// Doc <-> Doc
if
(
idS
==
categories
[
0
]
&&
idT
==
categories
[
0
]
)
{
if
(
srcType
==
categories
[
0
]
&&
tgtType
==
categories
[
0
]
)
{
edge
.
label
=
"nodes1"
;
edge
.
label
=
"nodes1"
;
if
(
isUndef
(
nodes1
[
source
]))
{
if
(
isUndef
(
nodes1
[
source
]))
{
...
@@ -736,7 +737,7 @@ function dictfyGexf( gexf , categories ){
...
@@ -736,7 +737,7 @@ function dictfyGexf( gexf , categories ){
if
(
categories
.
length
>
1
)
{
if
(
categories
.
length
>
1
)
{
// Term <-> Term
// Term <-> Term
if
(
idS
==
categories
[
1
]
&&
idT
==
categories
[
1
]){
if
(
srcType
==
categories
[
1
]
&&
tgtType
==
categories
[
1
]){
edge
.
label
=
"nodes2"
;
edge
.
label
=
"nodes2"
;
if
(
isUndef
(
nodes2
[
source
]))
{
if
(
isUndef
(
nodes2
[
source
]))
{
...
@@ -758,12 +759,12 @@ function dictfyGexf( gexf , categories ){
...
@@ -758,12 +759,12 @@ function dictfyGexf( gexf , categories ){
}
}
// Doc <-> Term
// Doc <-> Term
if
((
idS
==
categories
[
0
]
&&
idT
==
categories
[
1
])
||
if
((
srcType
==
categories
[
0
]
&&
tgtType
==
categories
[
1
])
||
(
idS
==
categories
[
1
]
&&
idT
==
categories
[
0
]))
{
(
srcType
==
categories
[
1
]
&&
tgtType
==
categories
[
0
]))
{
edge
.
label
=
"bipartite"
;
edge
.
label
=
"bipartite"
;
// // Source is Document
// // Source is Document
if
(
idS
==
categories
[
0
])
{
if
(
srcType
==
categories
[
0
])
{
if
(
isUndef
(
bipartiteD2N
[
source
]))
{
if
(
isUndef
(
bipartiteD2N
[
source
]))
{
bipartiteD2N
[
source
]
=
{
bipartiteD2N
[
source
]
=
{
...
@@ -820,9 +821,7 @@ function dictfyGexf( gexf , categories ){
...
@@ -820,9 +821,7 @@ function dictfyGexf( gexf , categories ){
// ------------------------------- resDict <<<
// ------------------------------- resDict <<<
resDict
=
{}
let
resDict
=
{}
// TODO unify catDict and catCount (dict is count.keys())
resDict
.
catDict
=
catDict
;
// ex : {'ISIterms':0}
resDict
.
catCount
=
catCount
;
// ex: {'ISIterms':1877} ie #nodes
resDict
.
catCount
=
catCount
;
// ex: {'ISIterms':1877} ie #nodes
resDict
.
nodes
=
nodes
;
// { nid1: {label:"...", size:"11.1", attributes:"...", color:"#aaa", etc}, nid2: ...}
resDict
.
nodes
=
nodes
;
// { nid1: {label:"...", size:"11.1", attributes:"...", color:"#aaa", etc}, nid2: ...}
resDict
.
edges
=
edges
;
resDict
.
edges
=
edges
;
...
@@ -841,14 +840,12 @@ function scanJSON( data ) {
...
@@ -841,14 +840,12 @@ function scanJSON( data ) {
var
nodes
=
data
.
nodes
;
var
nodes
=
data
.
nodes
;
for
(
var
i
in
nodes
)
{
for
(
var
i
in
nodes
)
{
n
=
nodes
[
i
];
let
n
=
nodes
[
i
];
if
(
n
.
type
)
categoriesDict
[
n
.
type
]
=
n
.
type
;
if
(
n
.
type
)
categoriesDict
[
n
.
type
]
=
n
.
type
;
}
}
// sorting observed json node types into Sem (=> 1)/Soc (=> 0)
// sorting observed json node types into Sem (=> 1)/Soc (=> 0)
result
=
sortNodeTypes
(
categoriesDict
)
return
sortNodeTypes
(
categoriesDict
);
return
result
;
}
}
// Level-00
// Level-00
...
@@ -866,8 +863,8 @@ function dictfyJSON( data , categories ) {
...
@@ -866,8 +863,8 @@ function dictfyJSON( data , categories ) {
}
}
for
(
var
i
in
data
.
nodes
)
{
for
(
var
i
in
data
.
nodes
)
{
n
=
data
.
nodes
[
i
];
let
n
=
data
.
nodes
[
i
];
node
=
{}
let
node
=
{}
node
.
id
=
(
n
.
id
)
?
n
.
id
:
i
;
// use the key if no id
node
.
id
=
(
n
.
id
)
?
n
.
id
:
i
;
// use the key if no id
node
.
label
=
(
n
.
label
)?
n
.
label
:
(
"node_"
+
node
.
id
)
;
node
.
label
=
(
n
.
label
)?
n
.
label
:
(
"node_"
+
node
.
id
)
;
node
.
size
=
(
n
.
size
)?
n
.
size
:
3
;
node
.
size
=
(
n
.
size
)?
n
.
size
:
3
;
...
@@ -901,8 +898,8 @@ function dictfyJSON( data , categories ) {
...
@@ -901,8 +898,8 @@ function dictfyJSON( data , categories ) {
// edges
// edges
for
(
var
i
in
data
.
links
){
for
(
var
i
in
data
.
links
){
e
=
data
.
links
[
i
];
let
e
=
data
.
links
[
i
];
edge
=
{}
let
edge
=
{}
var
source
=
(
!
isUndef
(
e
.
s
))?
e
.
s
:
e
.
source
;
var
source
=
(
!
isUndef
(
e
.
s
))?
e
.
s
:
e
.
source
;
var
target
=
(
!
isUndef
(
e
.
t
))?
e
.
t
:
e
.
target
;
var
target
=
(
!
isUndef
(
e
.
t
))?
e
.
t
:
e
.
target
;
...
@@ -917,19 +914,19 @@ function dictfyJSON( data , categories ) {
...
@@ -917,19 +914,19 @@ function dictfyJSON( data , categories ) {
edge
.
type
=
type
;
edge
.
type
=
type
;
if
(
nodes
[
source
]
&&
nodes
[
target
])
{
if
(
nodes
[
source
]
&&
nodes
[
target
])
{
idS
=
nodes
[
source
].
type
;
let
srcType
=
nodes
[
source
].
type
;
idT
=
nodes
[
target
].
type
;
let
tgtType
=
nodes
[
target
].
type
;
// [ New Code! ]
// [ New Code! ]
petitDict
=
{}
let
petitDict
=
{}
petitDict
[
nodes
[
source
].
type
]
=
true
;
petitDict
[
nodes
[
source
].
type
]
=
true
;
petitDict
[
nodes
[
target
].
type
]
=
true
;
petitDict
[
nodes
[
target
].
type
]
=
true
;
idInRelations
=
[]
let
idInRelations
=
[]
for
(
var
c
in
petitDict
)
idInRelations
[
catDict
[
c
]]
=
true
;
for
(
var
c
in
petitDict
)
idInRelations
[
catDict
[
c
]]
=
true
;
for
(
var
c
=
0
;
c
<
categories
.
length
;
c
++
)
{
for
(
var
c
=
0
;
c
<
categories
.
length
;
c
++
)
{
if
(
!
idInRelations
[
c
])
idInRelations
[
c
]
=
false
;
if
(
!
idInRelations
[
c
])
idInRelations
[
c
]
=
false
;
}
}
idArray
=
idInRelations
.
map
(
Number
).
join
(
"|"
)
let
idArray
=
idInRelations
.
map
(
Number
).
join
(
"|"
)
edge
.
categ
=
idArray
;
edge
.
categ
=
idArray
;
if
(
!
TW
.
Relations
[
idArray
])
TW
.
Relations
[
idArray
]
=
{}
if
(
!
TW
.
Relations
[
idArray
])
TW
.
Relations
[
idArray
]
=
{}
...
@@ -941,7 +938,7 @@ function dictfyJSON( data , categories ) {
...
@@ -941,7 +938,7 @@ function dictfyJSON( data , categories ) {
// Doc <-> Doc
// Doc <-> Doc
if
(
idS
==
categories
[
0
]
&&
idT
==
categories
[
0
]
)
{
if
(
srcType
==
categories
[
0
]
&&
tgtType
==
categories
[
0
]
)
{
edge
.
label
=
"nodes1"
;
edge
.
label
=
"nodes1"
;
if
(
isUndef
(
nodes1
[
source
]))
{
if
(
isUndef
(
nodes1
[
source
]))
{
...
@@ -963,7 +960,7 @@ function dictfyJSON( data , categories ) {
...
@@ -963,7 +960,7 @@ function dictfyJSON( data , categories ) {
if
(
categories
.
length
>
1
)
{
if
(
categories
.
length
>
1
)
{
// Term <-> Term
// Term <-> Term
if
(
idS
==
categories
[
1
]
&&
idT
==
categories
[
1
]){
if
(
srcType
==
categories
[
1
]
&&
tgtType
==
categories
[
1
]){
edge
.
label
=
"nodes2"
;
edge
.
label
=
"nodes2"
;
if
(
isUndef
(
nodes2
[
source
]))
{
if
(
isUndef
(
nodes2
[
source
]))
{
...
@@ -985,12 +982,12 @@ function dictfyJSON( data , categories ) {
...
@@ -985,12 +982,12 @@ function dictfyJSON( data , categories ) {
}
}
// Doc <-> Term
// Doc <-> Term
if
((
idS
==
categories
[
0
]
&&
idT
==
categories
[
1
])
||
if
((
srcType
==
categories
[
0
]
&&
tgtType
==
categories
[
1
])
||
(
idS
==
categories
[
1
]
&&
idT
==
categories
[
0
]))
{
(
srcType
==
categories
[
1
]
&&
tgtType
==
categories
[
0
]))
{
edge
.
label
=
"bipartite"
;
edge
.
label
=
"bipartite"
;
// // Source is Document
// // Source is Document
if
(
idS
==
categories
[
0
])
{
if
(
srcType
==
categories
[
0
])
{
if
(
isUndef
(
bipartiteD2N
[
source
]))
{
if
(
isUndef
(
bipartiteD2N
[
source
]))
{
bipartiteD2N
[
source
]
=
{
bipartiteD2N
[
source
]
=
{
...
@@ -1040,8 +1037,7 @@ function dictfyJSON( data , categories ) {
...
@@ -1040,8 +1037,7 @@ function dictfyJSON( data , categories ) {
}
}
}
}
resDict
=
{}
let
resDict
=
{}
resDict
.
catDict
=
catDict
;
resDict
.
catCount
=
catCount
;
resDict
.
catCount
=
catCount
;
resDict
.
nodes
=
nodes
;
resDict
.
nodes
=
nodes
;
resDict
.
edges
=
edges
;
resDict
.
edges
=
edges
;
...
@@ -1070,13 +1066,13 @@ function makeSystemStates (cats) {
...
@@ -1070,13 +1066,13 @@ function makeSystemStates (cats) {
for
(
i
=
0
;
i
<
N
;
i
++
)
{
for
(
i
=
0
;
i
<
N
;
i
++
)
{
bin
=
(
i
).
toString
(
2
)
let
bin
=
(
i
).
toString
(
2
)
bin_splitted
=
[]
let
bin_splitted
=
[]
for
(
var
j
in
bin
)
for
(
var
j
in
bin
)
bin_splitted
.
push
(
bin
[
j
])
bin_splitted
.
push
(
bin
[
j
])
bin_array
=
[];
let
bin_array
=
[];
toadd
=
cats
.
length
-
bin_splitted
.
length
;
let
toadd
=
cats
.
length
-
bin_splitted
.
length
;
for
(
k
=
0
;
k
<
toadd
;
k
++
)
for
(
k
=
0
;
k
<
toadd
;
k
++
)
bin_array
.
push
(
"0"
)
bin_array
.
push
(
"0"
)
...
@@ -1084,10 +1080,10 @@ function makeSystemStates (cats) {
...
@@ -1084,10 +1080,10 @@ function makeSystemStates (cats) {
bin_array
.
push
(
bin
[
j
])
bin_array
.
push
(
bin
[
j
])
bin_array
=
bin_array
.
map
(
Number
)
bin_array
=
bin_array
.
map
(
Number
)
sum
=
bin_array
.
reduce
(
function
(
a
,
b
){
return
a
+
b
;})
let
sum
=
bin_array
.
reduce
(
function
(
a
,
b
){
return
a
+
b
;})
if
(
sum
!=
0
&&
sum
<
3
)
{
if
(
sum
!=
0
&&
sum
<
3
)
{
id
=
bin_array
.
join
(
"|"
)
let
id
=
bin_array
.
join
(
"|"
)
systemstates
[
id
]
=
bin_array
.
map
(
Boolean
)
systemstates
[
id
]
=
bin_array
.
map
(
Boolean
)
}
}
}
}
...
...
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