retrohacker/dagGen
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
Javadoc can be found here: http://wblankenship.github.io/dagGen/javadoc/ Below are some code snippets showing how to use the library /* * Generate a random matrix and print it */ DAGSmith smith = new DAGSmith(); boolean[][] dag = smith.generateRandomDAG(10, 2); System.out.println(DAGTools.printDAG(dag)); System.out.println("Generated a " + dag.length + "x" + dag[0].length + " DAG with " + DAGTools.getEdges(dag) + " edges."); /* * Save file to disk */ DAGTools.saveToFile(dag, "1.dag"); /* * Read file from disk */ DAGParse parse = new DAGParse(); try { dag = parse.parseDependancies("1.dag"); System.out.println(DAGTools.printDAG(dag)); System.out.println("Read a " + dag.length + "x" + dag[0].length + " DAG with " + DAGTools.getEdges(dag) + " edges."); } catch (Exception e) { System.out.println("Failed getting file!"); e.printStackTrace(); }