Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
74b8dae7
Commit
74b8dae7
authored
Sep 28, 2016
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[GRAPH] Graphs saved with distance and bridgeness parameters.
parent
bb1e553b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
7 deletions
+19
-7
cooccurrences.py
graph/cooccurrences.py
+4
-2
graph.py
graph/graph.py
+13
-4
rest.py
graph/rest.py
+2
-1
No files found.
graph/cooccurrences.py
View file @
74b8dae7
...
@@ -38,8 +38,10 @@ def cooc2graph( cooc_id, cooc_matrix, field1="ngrams", field2="ngrams", distance
...
@@ -38,8 +38,10 @@ def cooc2graph( cooc_id, cooc_matrix, field1="ngrams", field2="ngrams", distance
print
(
"GRAPH#
%
d ... Saving Graph in hyperdata as json."
%
cooc_id
)
print
(
"GRAPH#
%
d ... Saving Graph in hyperdata as json."
%
cooc_id
)
node
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
cooc_id
)
.
first
()
node
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
cooc_id
)
.
first
()
node
.
hyperdata
[
distance
]
=
dict
()
if
node
.
hyperdata
.
get
(
distance
,
None
)
is
None
:
node
.
hyperdata
[
distance
][
"data"
]
=
data
node
.
hyperdata
[
distance
]
=
dict
()
node
.
hyperdata
[
distance
][
bridgeness
]
=
data
node
.
save_hyperdata
()
node
.
save_hyperdata
()
session
.
commit
()
session
.
commit
()
...
...
graph/graph.py
View file @
74b8dae7
...
@@ -57,15 +57,24 @@ def get_graph( request=None , corpus=None
...
@@ -57,15 +57,24 @@ def get_graph( request=None , corpus=None
print
(
"Getting data for matrix
%
d"
,
int
(
cooc_id
))
print
(
"Getting data for matrix
%
d"
,
int
(
cooc_id
))
node
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
cooc_id
)
.
first
()
node
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
cooc_id
)
.
first
()
# Check if
# Structure of the Node.hyperdata[distance][bridbeness]
# All parameters (but distance and bridgeness)
# are in Node.hyperdata["parameters"]
# Check distance of the graph
if
node
.
hyperdata
.
get
(
distance
,
None
)
is
not
None
:
if
node
.
hyperdata
.
get
(
distance
,
None
)
is
not
None
:
data
=
node
.
hyperdata
[
distance
][
"data"
]
graph
=
node
.
hyperdata
[
distance
]
return
data
print
(
node
.
hyperdata
[
distance
]
.
keys
())
# Check bridgeness of the graph
if
graph
.
get
(
str
(
bridgeness
),
None
)
is
not
None
:
return
graph
[
str
(
bridgeness
)]
# Case of graph has not been computed already
# Case of graph has not been computed already
# First, check the parameters
# First, check the parameters
# Case of mapList not big enough
# Case of mapList not big enough
# ==============================
# ==============================
...
...
graph/rest.py
View file @
74b8dae7
...
@@ -91,7 +91,8 @@ class Graph(APIView):
...
@@ -91,7 +91,8 @@ class Graph(APIView):
,
field1
=
field1
,
field2
=
field2
,
field1
=
field1
,
field2
=
field2
,
mapList_id
=
mapList_id
,
groupList_id
=
groupList_id
,
mapList_id
=
mapList_id
,
groupList_id
=
groupList_id
,
start
=
start
,
end
=
end
,
start
=
start
,
end
=
end
,
threshold
=
threshold
,
distance
=
distance
,
threshold
=
threshold
,
distance
=
distance
,
bridgeness
=
bridgeness
,
saveOnly
=
saveOnly
,
saveOnly
=
saveOnly
)
)
...
...
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