+ output.push(
this.changeColor(tempCount, e)}/>
- this.changeDistribution(tempCount, e)} min="0" max="1" currentValue={s[1]} step="0.001"/>
+ this.changeDistribution(tempCount, e)} min="0" max="1" currentValue={s[1]} step="0.001"/>
);
count ++;
diff --git a/src/Simulation/exampleNetworks/Custom.jsx b/src/Simulation/exampleNetworks/Custom.jsx
index cc3a0fd..dc42e16 100644
--- a/src/Simulation/exampleNetworks/Custom.jsx
+++ b/src/Simulation/exampleNetworks/Custom.jsx
@@ -5,10 +5,53 @@ class Custom extends Network {
constructor(){
super("Custom",
[[1,1], [2,1], [3,1], [4,1]]);
+ this.state = {input: ""};
}
+ textFieldChanged = (e) => {
+ let newText = e.target.value;
+ this.setState({input: newText});
+ }
+
+ getGraph() {
+ return this.parseInput(this.state.input);
+ }
+
+ parseInput(input) {
+ //first we clean the input using a regex
+ let re = /[([]{1}\s*([0-9]*)\s*,\s*[0-9]+\s*[)\]]{1}/g;
+ let cleaned = input.match(re);
+ let output = [];
+
+ //strip spaces, tabs and newlines
+ input = input.replaceAll(" ", "");
+ input = input.replaceAll("\t", "");
+ input = input.replaceAll("\n", "");
+
+ //we now match each single number and put it in our output
+ re = /[0-9]+/g;
+ if (cleaned == null) {
+ return [];
+ }
+ cleaned.forEach((element) => {
+ let newEntry = element.match(re);
+ //convert to numbers
+ newEntry[0] = Number(newEntry[0]);
+ newEntry[1] = Number(newEntry[1]);
+ output.push(newEntry);
+ });
+
+ console.log(output);
+ return output;
+ }
+
render(){
- return (
Custom
)
+ return (
+
Enter an edgelist like: (0, 1), (0, 2), (1,2)
+
+ );
}
}
diff --git a/src/Simulation/exampleNetworks/Karate.jsx b/src/Simulation/exampleNetworks/Karate.jsx
index 14cda7e..348ea8d 100644
--- a/src/Simulation/exampleNetworks/Karate.jsx
+++ b/src/Simulation/exampleNetworks/Karate.jsx
@@ -5,11 +5,12 @@ class KarateClass extends Network {
//super("Karate",
//[[2,1], [3,1], [4,1], [5,1]]);
super("Karate",
- [[0,1], [1,2], [3,4], [4,5], [6,7], [7,8], [0,3], [3,6], [1,4], [4,7], [2,5], [5,8]]);
- }
+ [[2, 1],[3, 1], [3, 2],[4 ,1], [4, 2], [4, 3],[5, 1],[6, 1],[7, 1], [7, 5], [7, 6],[8, 1], [8, 2], [8, 3], [8, 4],[9, 1], [9, 3],[10, 3],[11, 1], [11, 5], [11, 6],[12, 1],[13, 1], [13, 4],[14, 1], [14, 2], [14, 3], [14, 4],[17, 6], [17, 7],[18, 1], [18, 2],[20, 1], [20, 2],[22, 1], [22, 2],[26, 24], [26, 25],[28, 3], [28, 24], [28, 25],[29, 3],[30, 24], [30, 27],[31, 2], [31, 9],[32, 1], [32, 25], [32, 26], [32, 29],[33, 3], [33, 9], [33, 15], [33, 16], [33, 19], [33, 21], [33, 23], [33, 24], [33, 30], [33, 31], [33, 32], [34, 9], [34, 10], [34, 14], [34, 15], [34, 16], [34, 19], [34, 20], [34, 21], [34, 23], [34, 24], [34, 27], [34, 28], [34, 29], [34, 30], [34, 31], [34, 32], [34, 33]]
+ );
+ }
render(){
- return (
placeholder
);
+ return (
This is the so called "Zachary Karate Club Network". It models a university karate club.
);
}
}
diff --git a/src/Simulation/exampleNetworks/Network.jsx b/src/Simulation/exampleNetworks/Network.jsx
index 99d757d..72f09d9 100644
--- a/src/Simulation/exampleNetworks/Network.jsx
+++ b/src/Simulation/exampleNetworks/Network.jsx
@@ -1,4 +1,5 @@
import React from "react";
+import '../../css/Network.css'
class Network extends React.Component{
constructor(optionName, graph){
diff --git a/src/SimulationScripts/graphUtils.js b/src/SimulationScripts/graphUtils.js
index bd8a5b2..6797ee3 100644
--- a/src/SimulationScripts/graphUtils.js
+++ b/src/SimulationScripts/graphUtils.js
@@ -1,29 +1,29 @@
-function edgelistToDot(name, inp){
- var output = "strict graph \"" + name + "\" {\n";
- for(var e in inp){
- e = inp[e];
- output += e[0] + " -- " + e[1] + ";\n";
- }
- output += "}";
- return output;
-}
-
-function dotToEdgelist(graph){
- var outList = [];
- graph = graph.split("\n");
- //var name = graph[0].split(" ")[2];
- //name = name.slice(1, name.length - 1);
- for (var i = 0; i < graph.length - 1; i++){
- if(i === 0){
- continue;
- }
- var nodes = graph[i].split("--");
- var node1 = Number(nodes[0]);
- var node2 = Number(nodes[1].slice(0, nodes[1].length - 1));
- outList.push([node1, node2]);
- }
- return outList;
-}
+//function edgelistToDot(name, inp){
+ //var output = "strict graph \"" + name + "\" {\n";
+ //for(var e in inp){
+ //e = inp[e];
+ //output += e[0] + " -- " + e[1] + ";\n";
+ //}
+ //output += "}";
+ //return output;
+//}
+//
+//function dotToEdgelist(graph){
+ //var outList = [];
+ //graph = graph.split("\n");
+ ////var name = graph[0].split(" ")[2];
+ ////name = name.slice(1, name.length - 1);
+ //for (var i = 0; i < graph.length - 1; i++){
+ //if(i === 0){
+ //continue;
+ //}
+ //var nodes = graph[i].split("--");
+ //var node1 = Number(nodes[0]);
+ //var node2 = Number(nodes[1].slice(0, nodes[1].length - 1));
+ //outList.push([node1, node2]);
+ //}
+ //return outList;
+//}
function edgeListToGraph(list){
let outNodes = [];
diff --git a/src/css/App.css b/src/css/App.css
index 748abd5..99aefcb 100644
--- a/src/css/App.css
+++ b/src/css/App.css
@@ -1,2 +1,8 @@
.App {
+ font-family: 'Roboto', sans-serif;
+ color: #eeeeee;
+}
+
+html {
+ background-color: #222831;
}
diff --git a/src/css/Dropdown.css b/src/css/Dropdown.css
new file mode 100644
index 0000000..7efa745
--- /dev/null
+++ b/src/css/Dropdown.css
@@ -0,0 +1,18 @@
+.DropdownDescription {
+ display: inline-block;
+ font-size: 12pt;
+ margin-bottom: 10px;
+}
+
+.Dropdown {
+ color: #eeeeee;
+ font-size: 15pt;
+ display: block;
+ background-color: #2d4059;
+ outline: none;
+ border: none;
+ border-radius: 10px;
+ height: 50px;
+ width: 85%;
+ margin-bottom: 10px;
+}
diff --git a/src/css/Graph.css b/src/css/Graph.css
index 1a71f53..87b19ff 100644
--- a/src/css/Graph.css
+++ b/src/css/Graph.css
@@ -1,6 +1,53 @@
+#recalculate {
+ margin-right: 20px;
+ margin-bottom: 20px;
+ border: none;
+ outline: none;
+ font-size: 25pt;
+ color: #eeeeee;
+ background-color: #ff5722;
+ border-radius: 10px;
+ padding: 5px 10px;
+}
+
+#runSimulationButton {
+ margin-right: 20px;
+ border: none;
+ outline: none;
+ font-size: 25pt;
+ color: #eeeeee;
+ background-color: green;
+ border-radius: 10px;
+ padding: 5px 10px;
+}
+
+#durationDescription {
+ display: inline-block;
+ margin-right: 20px;
+ color: #eeeeee;
+ font-size: 20pt;
+}
+
+#animationDuration {
+ width: 60px;
+ font-size: 20pt;
+ color: #ff5722;
+ border-color: #ff5722;
+ border-radius: 3px;
+ background-color: #222831;
+ border: none;
+ outline: none;
+}
+
+#animationDuration:focus {
+ outline-width: 0;
+ outline: solid;
+}
+
/* Generated graph container */
#cy {
width: 100%;
- height: 600px;
- background-color: blue;
+ height: 100%;
+ min-height: 600px;
+ background-color: #222831;
}
diff --git a/src/css/Header.css b/src/css/Header.css
new file mode 100644
index 0000000..4c92186
--- /dev/null
+++ b/src/css/Header.css
@@ -0,0 +1,4 @@
+a {
+ text-decoration: none;
+ color: #ff5722;
+}
diff --git a/src/css/Model.css b/src/css/Model.css
new file mode 100644
index 0000000..613d5d0
--- /dev/null
+++ b/src/css/Model.css
@@ -0,0 +1,34 @@
+#karateExplanation {
+ width: 85%;
+}
+
+.ColorPicker {
+ display: inline-block;
+ margin-left: 150px;
+ margin-top: 5px;
+ width: 60px;
+ height: 30px;
+ transform: translateY(37px);
+}
+
+/* valudation text thingy */
+.DistributionStatus {
+ padding: 1px 15px 1px 15px;
+ border-radius: 10px;
+ width: fit-content;
+ margin-bottom: -10px;
+ transition: width 1s;
+}
+
+.valid {
+ background-color: green;
+}
+
+.invalid {
+ background-color: red;
+}
+
+/* padding for the validation below */
+.CustomModel {
+ margin-bottom: 15px;
+}
diff --git a/src/css/Network.css b/src/css/Network.css
new file mode 100644
index 0000000..9a40063
--- /dev/null
+++ b/src/css/Network.css
@@ -0,0 +1,23 @@
+/* this also applies to network */
+.CustomInput {
+ width: 83%;
+ height: 50px;
+ background-color: #2d4059;
+ border: none;
+ border-radius: 10px;
+ padding: 10px;
+ color: #eeeeee;
+ font-size: 15pt;
+}
+
+.CustomInput:focus {
+ outline: none;
+}
+
+.CustomInput:invalid {
+ outline: solid red;
+}
+
+code {
+ font-size: 15pt;
+}
diff --git a/src/css/Simulation.css b/src/css/Simulation.css
index 43c6150..e0570d6 100644
--- a/src/css/Simulation.css
+++ b/src/css/Simulation.css
@@ -8,18 +8,22 @@
width: 60%;
height: 100%;
flex: 50%;
- text-align: center;
+ text-align: left;
}
#SimulationGraph {
width: 40%;
height: 100%;
+ position: sticky;
+ top: 3%;
}
+
/* Responsive layout - makes a one column layout instead of a two-column layout */
@media screen and (max-width: 800px) {
#SimulationSettings, #SimulationGraph {
width: 100%;
+ position: inherit;
}
#Simulation {
flex-direction: column;
diff --git a/src/css/Slider.css b/src/css/Slider.css
index 1d9b9b6..81049cb 100644
--- a/src/css/Slider.css
+++ b/src/css/Slider.css
@@ -1,16 +1,78 @@
+.SliderDiv {
+ padding: 10px 0px 10px 0px;
+}
.Slider {
- width: 70%;
+ width: 80%;
+}
+
+/* remove default slider */
+input[type="range"] {
+ -webkit-appearance: none;
+ background-color: #222831;
+}
+
+input[type="range"]:focus {
+ outline: none;
+}
+
+/* track */
+input[type="range"]::-webkit-slider-runnable-track {
+ background: linear-gradient(90deg, rgba(45,64,89,1) 35%, rgba(255,87,34,1) 100%);
+ height: 6px;
+ border-radius: 10px;
+}
+
+input[type="range"]::-moz-range-track {
+ background: linear-gradient(90deg, rgba(45,64,89,1) 35%, rgba(255,87,34,1) 100%);
+ height: 6px;
+ border-radius: 10px;
+}
+
+/* thumb */
+input[type="range"]::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ height: 23px;
+ width: 23px;
+ background: #ff5722;
+ margin-top: -9px;
+ border-radius: 50%;
+ border-width: 8px;
+ border-color: #ff5722;
+}
+
+input[type="range"]::-moz-range-thumb {
+ height: 14px;
+ width: 14px;
+ background: #ff5722;
+ border-radius: 50%;
+ border-width: 4px;
+ border-color: #ff5722;
}
.SliderDescription {
display: block;
text-align: left;
- padding-left: 13%;
+ padding-left: 5px;
+ margin-bottom: 10px;
+ font-size: 15pt;
}
.SliderValue {
display: inline-block;
width: 3em;
+ /*transform: translateY(-3px);*/
+ margin-left: 1em;
+ background-color: #222831;
+ color: #ff5722;
+ border-color: #ff5722;
+ border-style: none;
+ border-radius: 3px;
+ font-size: 15pt;
+}
+
+.SliderValue:focus {
+ outline-width: 0;
+ outline: solid;
}
/* Remove arrows from number input */
@@ -21,7 +83,7 @@ input::-webkit-inner-spin-button {
margin: 0;
}
-/* Firefox */
+/* Firefox remove arrows */
input[type=number] {
-moz-appearance: textfield;
}
diff --git a/ä b/ä
new file mode 100644
index 0000000..d97534e
--- /dev/null
+++ b/ä
@@ -0,0 +1,71 @@
+.SliderDiv {
+ padding: 10px 0px 10px 0px;
+}
+.Slider {
+ width: 80%;
+}
+
+/* remove default slider */
+input[type="range"] {
+ -webkit-appearance: none;
+ background-color: #222831;
+}
+
+input[type="range"]:focus {
+ outline: none;
+}
+
+/* track */
+input[type="range"]::-webkit-slider-runnable-track {
+ background: #ff5722;
+ height: 5px;
+}
+
+input[type="range"]::-moz-range-track {
+ background: #ff5722;
+ height: 5px;
+}
+
+/* thumb */
+input[type="range"]::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ height: 15px;
+ width: 15px;
+ background: pink;
+ margin-top: -5px;
+ border-radius: 50%;
+}
+
+input[type="range"]::-moz-range-thumb {
+ height: 15px;
+ width: 15px;
+ background: pink;
+ margin-top: -5px;
+ border-radius: 50%;
+}
+
+.SliderDescription {
+ display: block;
+ text-align: left;
+}
+
+.SliderValue {
+ display: inline-block;
+ width: 3em;
+ transform: translateY(-6px);
+ margin-left: 1em;
+}
+
+/* Remove arrows from number input */
+/* Chrome, Safari, Edge, Opera */
+input::-webkit-outer-spin-button,
+input::-webkit-inner-spin-button {
+ -webkit-appearance: none;
+ margin: 0;
+}
+
+/* Firefox */
+input[type=number] {
+ -moz-appearance: textfield;
+}
+