Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CiS Projekt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ockenden, Samuel
CiS Projekt
Compare revisions
6594b1a7bfd7541a35d19f952a15a2de832c0cf0 to 95e73bd70fdd1a379fab48aa4dea6c1a460b7259
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
baw8330/projekt-cis-biochemie-2021-22
Select target project
No results found
95e73bd70fdd1a379fab48aa4dea6c1a460b7259
Select Git revision
Branches
main
1 result
Swap
Target
baw8330/projekt-cis-biochemie-2021-22
Select target project
baw8330/projekt-cis-biochemie-2021-22
bax5890/projekt-cis-biochemie-2021-22
2 results
6594b1a7bfd7541a35d19f952a15a2de832c0cf0
Select Git revision
Branches
main
1 result
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
verarbeitung/json_demo.py
+49
-0
49 additions, 0 deletions
verarbeitung/json_demo.py
verarbeitung/nötige Tests.txt
+4
-0
4 additions, 0 deletions
verarbeitung/nötige Tests.txt
with
53 additions
and
0 deletions
verarbeitung/json_demo.py
0 → 100644
View file @
95e73bd7
#!/usr/bin/env python3
import
json
from
input_fj
import
input
"""
Functions that format the computed graph to match the interface to the output-part
"""
# creates a list that contains a dictionary for each node
# the dictionaries store the values for the attributes
def
format_nodes
(
V
):
list_of_node_dicts
=
list
()
for
node
in
V
:
new_dict
=
dict
()
new_dict
[
"
name
"
]
=
node
.
title
new_dict
[
"
author
"
]
=
node
.
contributors
new_dict
[
"
year
"
]
=
node
.
publication_date
new_dict
[
"
journal
"
]
=
node
.
journal
new_dict
[
"
doi
"
]
=
node
.
doi_url
new_dict
[
"
group
"
]
=
node
.
group
list_of_node_dicts
.
append
(
new_dict
)
return
list_of_node_dicts
# creates a list that contains a disctionary for each edge
# the dictionaries contain the source as keys and the target as values
def
format_edges
(
E
):
list_of_edge_dicts
=
list
()
for
edge
in
E
:
new_dict_2
=
dict
()
new_dict_2
[
"
source
"
]
=
edge
[
0
]
new_dict_2
[
"
target
"
]
=
edge
[
1
]
list_of_edge_dicts
.
append
(
new_dict_2
)
return
list_of_edge_dicts
# combine the lists of nodes and edges to a dictionary and saves it to a json file
def
output_to_json
(
V
,
E
):
dict_of_all
=
dict
()
list_of_node_dicts
=
format_nodes
(
V
)
list_of_edge_dicts
=
format_edges
(
E
)
dict_of_all
[
"
nodes
"
]
=
list_of_node_dicts
dict_of_all
[
"
links
"
]
=
list_of_edge_dicts
with
open
(
'
json_text.json
'
,
'
w
'
)
as
outfile
:
json
.
dump
(
dict_of_all
,
outfile
)
#knoten = ["doi1", "doi2", "doi3"]
#kanten = [[1,2],[3,4],[5,6]]
#output_to_json(knoten,kanten)
This diff is collapsed.
Click to expand it.
verarbeitung/nötige Tests.txt
0 → 100644
View file @
95e73bd7
Zyklus
großer Zyklus
Innere Kanten vervollständigen
This diff is collapsed.
Click to expand it.
Prev
1
2
3
Next