PENUGASAN 9 -- GRAPH
Implementasi Graph Java 1. Adjacency Matrix The situation where our nodes/vertices are objects (like they most likely would be) is highly complicated and requires a lot of maintenance methods that make adjacency matrices more trouble than they're worth most of the time, so we'll only provide the implementation of the "simple" case. Source public class Graph { private int numOfNodes ; private boolean directed ; private boolean weighted ; private float [][] matrix ; /* This will allow us to safely add weighted graphs in our class since we will be able to check whether an edge exists without relying on specific special values (like 0) */ private boolean [][] isSetMatrix ; public Graph ( int numOfNodes , boolean directed , boolean weighted ) { this . directed = directed ; this . weighted = weighted ; this . numOfNodes = numOfNodes ; // Simply initializes ou...