Skip to content

Commit

Permalink
Json layouts working
Browse files Browse the repository at this point in the history
  • Loading branch information
YouGuessedMyName committed Jul 2, 2024
1 parent e6c1e9b commit 6acd405
Show file tree
Hide file tree
Showing 12 changed files with 263 additions and 1,243 deletions.
12 changes: 11 additions & 1 deletion notebooks/custom_layout.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
{
"color": "red"
"nodes": {
"color": {
"background": "red",
"border": "orange"
}
},
"init": {},
"rounding": {
"fractions": "False",
"digits": 2
}
}
47 changes: 19 additions & 28 deletions notebooks/die.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -12,36 +12,14 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"# Create a new model with the name \"Die\"\n",
"dtmc = stormvogel.model.new_dtmc(\"Die\")\n",
"\n",
"init = dtmc.get_initial_state()\n",
"\n",
"# From the initial state, add the transition to 6 new states with probability 1/6th.\n",
"init.set_transitions(\n",
" [(1 / 6, dtmc.new_state(f\"rolled{i}\", {\"rolled\": i})) for i in range(6)]\n",
")\n",
"\n",
"# Print the resulting model in dot format.\n",
"# print(dtmc.to_dot())"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"diegraph.html\n"
"model.html\n"
]
},
{
Expand All @@ -51,23 +29,36 @@
" <iframe\n",
" width=\"100%\"\n",
" height=\"600px\"\n",
" src=\"diegraph.html\"\n",
" src=\"model.html\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" \n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7efdc3cc9010>"
"<IPython.lib.display.IFrame at 0x7f91ac3f6d50>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"stormvogel.visualization.show(model=dtmc, name=\"diegraph\")"
"# Create a new model with the name \"Die\"\n",
"dtmc = stormvogel.model.new_dtmc(\"Die\")\n",
"\n",
"init = dtmc.get_initial_state()\n",
"\n",
"# From the initial state, add the transition to 6 new states with probability 1/6th.\n",
"init.set_transitions(\n",
" [(1 / 6, dtmc.new_state(f\"rolled{i}\", {\"rolled\": i})) for i in range(6)]\n",
")\n",
"\n",
"stormvogel.visualization.show(dtmc)\n",
"\n",
"# Print the resulting model in dot format.\n",
"# print(dtmc.to_dot())"
]
},
{
Expand Down
Loading

0 comments on commit 6acd405

Please sign in to comment.