Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kodex
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
kodex
Commits
c6ab2f0b
Commit
c6ab2f0b
authored
Dec 20, 2017
by
Yannick Chudy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
limit igraph response > 300 nodes filter on vertex
parent
f1ea797d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
botapadapp.py
botapadapp.py
+24
-0
No files found.
botapadapp.py
View file @
c6ab2f0b
...
...
@@ -16,8 +16,17 @@ from flask import render_template, render_template_string, abort, redirect, url_
from
botapi
import
BotApiError
,
Botagraph
,
BotaIgraph
,
BotLoginError
from
botapad
import
Botapad
,
BotapadError
,
BotapadParseError
,
BotapadURLError
,
BotapadCsvError
from
cello.graphs.filter
import
RemoveNotConnected
,
GenericVertexFilter
from
reliure.utils.log
import
get_app_logger_color
DEBUG
=
os
.
environ
.
get
(
'APP_DEBUG'
,
""
)
.
lower
()
==
"true"
log_level
=
logging
.
INFO
if
DEBUG
else
logging
.
WARN
logger
=
get_app_logger_color
(
"cillex"
,
app_log_level
=
log_level
,
log_level
=
log_level
)
RUN_GUNICORN
=
os
.
environ
.
get
(
'RUN_GUNICORN'
,
None
)
==
"1"
# padagraph host valid token
...
...
@@ -296,6 +305,8 @@ def import2pdg(repo='igraph', content=None):
def
botimport
(
repo
,
padurl
,
gid
,
content_type
):
print
repo
,
content_type
,
gid
,
padurl
action
=
"
%
s?
%
s"
%
(
repo
,
request
.
query_string
)
routes
=
"
%
s/engines"
%
ENGINES_HOST
...
...
@@ -359,6 +370,19 @@ def botimport(repo, padurl, gid, content_type):
else
:
graph
=
pad2igraph
(
gid
,
padurl
)
if
graph
.
vcount
()
>
300
:
LENMIN
=
graph
.
vcount
()
/
100
-
5
LENMIN
=
10
vfilter
=
lambda
v
:
len
(
v
.
neighbors
())
<
LENMIN
expander
=
RemoveNotConnected
()
|
GenericVertexFilter
(
vfilter
)
# | composable()
#for v in graph.vs : print vfilter(v)
print
0
,
graph
.
summary
()
graph
=
expander
(
graph
)
print
LENMIN
,
graph
.
summary
()
graph
=
prepare_graph
(
graph
)
data
=
export_graph
(
graph
,
id_attribute
=
'uuid'
)
complete
=
True
...
...
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