Skip to content

Commit 9e5c3ae

Browse files
authored
Added a example function
1 parent 1926517 commit 9e5c3ae

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Runtime Analysis Enviroment for Algorithms in PHP
2-
This runtime analysis environment allows to analyse the runtime of an AVL tree, graph colouring and matrix multiplication. The runtime environment can be used independently of the given algorithms.
2+
This runtime analysis environment allows to analyse the runtime of an AVL tree, graph colouring and matrix multiplication. The runtime environment can be used independently of the given algorithms.
33

44
The following questions can be anwsered with this implemetation:
55
1. What problem sizes `n` exist for a runtime of `target_time` seconds when multiplying two `n x n` matrices in PHP?
@@ -9,7 +9,12 @@ The following questions can be anwsered with this implemetation:
99
## Installation
1010
The runtime measurement can be started with the file `config.php`.
1111

12-
## Usage and explanation
12+
## Usage
13+
An example `foo` function is provided to ease initial usage. Simply update this function with your algorithm to get started quickly.
14+
15+
If you want to replace the file `foo.php` or use a customized file, you need to create an `analysis_yourfunction($size)` function along with a corresponding file, similar to the implementations for matrix multiplication, AVL trees, graph coloring or the foo. Additionally, this function must be included in the `analysis.php` file via an `elseif` statement. The requirement of the file must be specified in the `config.php` for both your function file and the analysis function file.
16+
17+
## Explanation
1318
The runtime measurement is performed by the `analyse` function using time measurement as a basis. For this, the start time before the function begins and the end time after the function is completed are measured in microseconds using `microtime(true)`. These values are subtracted from each other and the execution time is printed at the end.
1419

1520
```php
@@ -39,6 +44,9 @@ The runtime analysis of the AVL tree is implemented by the `analyse_avl_tree` fu
3944
The `analyse_graph_coloring` function implements the runtime analysis of graph coloring. In this function, an adjacency matrix of size `n` is created, representing the complete graph. Additionally, an array of length `n` is created for color assignments. The `graph_coloring(0, $adjacency_matrix, $assignments, $size)` function colors the individual nodes of the graph from the adjacency matrix. The number of colors corresponds to the size `n` and therefore, the number of nodes. The time measurement starts immediately before executing this function and ends after its completion.
4045

4146
## Version History
47+
### 1.1 (2024-05-23)
48+
- Added a example function
49+
4250
### 1.0 (2024-05-13)
4351
- First public release
4452

0 commit comments

Comments
 (0)