diff --git a/README.md b/README.md index b5966b2..b2f89bb 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ 2. Enne oma rekursiivse meetodi välja kutsumist kutsu välja `Dendrologist.wakeUp()`. 3. Käita programm ja aken rekursioonipuuga avaneb automaatselt. -Näide rekrusiivse Fibonacci arvude arvutamise meetodiga: +Näide rekrusiivse Fibonacci arvude arvutamise meetodiga (vt. [Katsed.java](src/test/java/Katsed.java)): ![image](https://github.com/Scytheface/dendroloj/assets/5256211/fe3ca679-a942-4e39-8611-f4c8536cdca4) ### Kahendpuude joonistamine @@ -28,9 +28,19 @@ Näide rekrusiivse Fibonacci arvude arvutamise meetodiga: (Kui tegemist ei ole kahendpuuga saab kasutada üldisemat meetodit `Dendrologist.drawTree`. Kasutuse kohta leiab lisainfot meetodi Javadoc kommentaarist.) -Näide kasutaja defineeritud Tipp klassiga: +Näide kasutaja defineeritud Tipp klassiga (vt. [TippKatsed.java](src/test/java/TippKatsed.java)): ![image](https://github.com/Scytheface/dendroloj/assets/5256211/04b18c0b-4281-4c06-b3df-2b12a55b8867) +### Graafide joonistamine + +Graafide joonistamiseks saab kasutada klassi `GraphCanvas`, kus `V` on joonistatava graafi tippude tüüp. +See klass toimib lõuendina, kuhu saab vastavate meetodite abil joonistada graafi servad ja tipud. +Lõuendi kuvamiseks kutsu välja meetod `Dendrologist.drawGraph(lõuend)`. + +Lisainfot leiab `GraphCanvas` klassi ja vastavate meetodite _JavaDoc_ kommentaaridest. + +Vaata ka näidet failis [GraafKatsed.java](src/test/java/GraafKatsed.java). + ### Graafilise liidese kasutamine Liigutades riba akna alumises servas saab vaadata väljakutsete puu ajalugu. Iga samm on kas üks meetodi väljakutse või üks tagastus meetodist. diff --git a/src/main/java/ee/ut/dendroloj/Dendrologist.java b/src/main/java/ee/ut/dendroloj/Dendrologist.java index d73982e..0ebcde3 100644 --- a/src/main/java/ee/ut/dendroloj/Dendrologist.java +++ b/src/main/java/ee/ut/dendroloj/Dendrologist.java @@ -149,7 +149,9 @@ public static void drawGraph(GraphCanvas graphCanvas) { * * @param adjacencyMatrix graph adjacency matrix; value at [i][j] is treated as the weight of the edge from vertex i to vertex j * @param labels string labels for vertices; pass null to use vertex indices as labels + * @deprecated THIS API IS EXPERIMENTAL AND MAY EVENTUALLY BE REMOVED */ + @Deprecated public static void drawGraph(int[][] adjacencyMatrix, String[] labels) { if (isHeadless()) { System.err.println("Dendrologist: Running in headless environment. Ignoring call to drawGraph."); @@ -175,7 +177,9 @@ public static void drawGraph(int[][] adjacencyMatrix, String[] labels) { * * @param adjacencyMatrix graph adjacency matrix; value at [i][j] is treated as the weight of the edge from vertex i to vertex j * @param labels string labels for vertices; pass null to use vertex indices as labels + * @deprecated THIS API IS EXPERIMENTAL AND MAY EVENTUALLY BE REMOVED */ + @Deprecated public static void drawGraph(double[][] adjacencyMatrix, String[] labels) { if (isHeadless()) { System.err.println("Dendrologist: Running in headless environment. Ignoring call to drawGraph."); @@ -201,7 +205,9 @@ public static void drawGraph(double[][] adjacencyMatrix, String[] labels) { * * @param adjacencyMatrix graph adjacency matrix; value at [i][j] is treated as the weight of the edge from vertex i to vertex j * @param labels string labels for vertices; pass null to use vertex indices as labels + * @deprecated THIS API IS EXPERIMENTAL AND MAY EVENTUALLY BE REMOVED */ + @Deprecated public static void drawGraph(float[][] adjacencyMatrix, String[] labels) { if (isHeadless()) { System.err.println("Dendrologist: Running in headless environment. Ignoring call to drawGraph."); diff --git a/src/test/java/GraafKatsed.java b/src/test/java/GraafKatsed.java index 27a6b02..447621e 100644 --- a/src/test/java/GraafKatsed.java +++ b/src/test/java/GraafKatsed.java @@ -8,6 +8,7 @@ public class GraafKatsed { public static void main(String[] args) { + // Note: The API for drawing directly from an adjacency matrix is experimental and may eventually be removed. String[] nimed = new String[]{ "A", "B",