Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ba
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
Container 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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
markn92
ba
Commits
cc9d6f0a
Commit
cc9d6f0a
authored
5 years ago
by
markn92
Browse files
Options
Downloads
Patches
Plain Diff
Add possibility to create all graphs as tex files.
parent
c993ce97
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.gitignore
+2
-0
2 additions, 0 deletions
.gitignore
README.md
+12
-0
12 additions, 0 deletions
README.md
draw_graphs.py
+23
-0
23 additions, 0 deletions
draw_graphs.py
tests/config.py
+3
-0
3 additions, 0 deletions
tests/config.py
tests/test_graph.py
+0
-6
0 additions, 6 deletions
tests/test_graph.py
with
40 additions
and
6 deletions
.gitignore
+
2
−
0
View file @
cc9d6f0a
.idea
plots
__pycache__
This diff is collapsed.
Click to expand it.
README.md
+
12
−
0
View file @
cc9d6f0a
# Routing for Electric Vehicles
## Extras
### Draw Graphs used for Testing
To draw all graphs, respectively create
```.tex```
snippets (that make use of the
[
tikz-network
](
https://www.ctan.org/pkg/tikz-network
)
).
```
bash
python draw_graphs.py
[
export_dir_path]
```
This diff is collapsed.
Click to expand it.
tests/draw
.py
→
draw_graphs
.py
+
23
−
0
View file @
cc9d6f0a
...
...
@@ -50,3 +50,26 @@ def _get_node_styles(G):
styles
[
'
nodes_style
'
]
=
nodes_style
return
styles
if
__name__
==
'
__main__
'
:
# Write Latex files of all test case graph configs
import
os
import
sys
from
tests
import
config
try
:
plot_dir
=
sys
.
argv
[
1
]
except
IndexError
:
plot_dir
=
'
plots
'
if
config
.
config_list
:
try
:
os
.
mkdir
(
plot_dir
)
except
FileExistsError
:
pass
for
conf_name
in
config
.
config_list
:
conf
=
getattr
(
config
,
conf_name
)
G
=
config
.
get_graph
(
conf
)
draw_graph
(
G
,
os
.
path
.
join
(
plot_dir
,
conf_name
+
'
.tex
'
))
This diff is collapsed.
Click to expand it.
tests/config.py
+
3
−
0
View file @
cc9d6f0a
...
...
@@ -5,6 +5,9 @@ import networkx as nx
Street
=
namedtuple
(
'
Street
'
,
[
'
u
'
,
'
v
'
,
'
distance
'
,
'
consumption
'
])
Node
=
namedtuple
(
'
Node
'
,
[
'
label
'
,
'
charging_coeff
'
],
defaults
=
(
None
,
None
))
# List of configs
config_list
=
[
'
edge_case
'
]
edge_case
=
{
'
b_0
'
:
0
,
'
b_t
'
:
0
,
...
...
This diff is collapsed.
Click to expand it.
tests/test_graph.py
+
0
−
6
View file @
cc9d6f0a
import
networkx
as
nx
from
.draw
import
draw_graph
def
test_graph_creation
(
G_Edge_Case
:
nx
.
Graph
):
assert
G_Edge_Case
.
number_of_nodes
()
==
3
assert
G_Edge_Case
.
number_of_edges
()
==
3
def
test_print_graph
(
G_Edge_Case
:
nx
.
Graph
):
draw_graph
(
G_Edge_Case
,
'
graph.tex
'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment